1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 A topoSetSource to select cells based on relation to surface.
32 - all cells inside/outside/cut by surface
33 - cells with centre nearer than XXX to surface
34 - cells with centre nearer than XXX to surface @b and with normal
35 at nearest point to centre and cell-corners differing by
36 more than YYY (i.e., point of high curvature)
41 \*---------------------------------------------------------------------------*/
43 #ifndef surfaceToCell_H
44 #define surfaceToCell_H
46 #include "topoSetSource.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 class triSurfaceSearch;
56 /*---------------------------------------------------------------------------*\
57 Class surfaceToCell Declaration
58 \*---------------------------------------------------------------------------*/
68 static addToUsageTable usage_;
70 //- Name of surface file
73 //- Points which are outside
74 pointField outsidePoints_;
79 //- Include inside cells
82 //- Include outside cells
85 //- if > 0 : include cells with distance from cellCentre to surface
86 // less than nearDist.
89 //- if > -1 : include cells with normals at nearest surface points
90 // varying more than curvature_.
93 //- triSurface to search on. On pointer since can be external.
94 const triSurface* surfPtr_;
96 //- search engine on surface.
97 const triSurfaceSearch* querySurfPtr_;
99 //- whether I allocated above surface ptrs or whether they are
104 // Private Member Functions
106 //- Find index of nearest triangle to point. Returns triangle or -1 if
107 // not found within search span.
108 // Cache result under pointI.
109 static label getNearest
111 const triSurfaceSearch& querySurf,
114 const vector& searchSpan,
118 //- Return true if surface normal of nearest points to vertices on
119 // cell differ from that on cell centre. Points cached in
121 bool differingPointNormals
123 const triSurfaceSearch& querySurf,
126 const label cellTriI,
127 Map<label>& pointToNearest
131 //- Depending on surface add to or delete from cellSet.
132 void combine(topoSet& set, const bool add) const;
134 //- Check values at construction time.
135 void checkSettings() const;
137 const triSurfaceSearch& querySurf() const
139 return *querySurfPtr_;
145 //- Runtime type information
146 TypeName("surfaceToCell");
150 //- Construct from components
153 const polyMesh& mesh,
154 const fileName& surfName,
155 const pointField& outsidePoints,
156 const bool includeCut,
157 const bool includeInside,
158 const bool includeOutside,
159 const scalar nearDist,
160 const scalar curvature
163 //- Construct from components (supplied surface, surfaceSearch)
166 const polyMesh& mesh,
167 const fileName& surfName,
168 const triSurface& surf,
169 const triSurfaceSearch& querySurf,
170 const pointField& outsidePoints,
171 const bool includeCut,
172 const bool includeInside,
173 const bool includeOutside,
174 const scalar nearDist,
175 const scalar curvature
178 //- Construct from dictionary
181 const polyMesh& mesh,
182 const dictionary& dict
185 //- Construct from Istream
188 const polyMesh& mesh,
195 virtual ~surfaceToCell();
200 virtual void applyToSet
202 const topoSetSource::setAction action,
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 } // End namespace Foam
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 // ************************************************************************* //