1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
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
13 the Free Software Foundation, either version 3 of the License, or
14 (at your 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, see <http://www.gnu.org/licenses/>.
28 A topoSetSource to select cells based on relation to surface.
31 - all cells inside/outside/cut by surface
32 - cells with centre nearer than XXX to surface
33 - cells with centre nearer than XXX to surface @b and with normal
34 at nearest point to centre and cell-corners differing by
35 more than YYY (i.e., point of high curvature)
40 \*---------------------------------------------------------------------------*/
42 #ifndef surfaceToCell_H
43 #define surfaceToCell_H
45 #include "topoSetSource.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 class triSurfaceSearch;
55 /*---------------------------------------------------------------------------*\
56 Class surfaceToCell Declaration
57 \*---------------------------------------------------------------------------*/
67 static addToUsageTable usage_;
69 //- Name of surface file
72 //- Points which are outside
73 pointField outsidePoints_;
78 //- Include inside cells
81 //- Include outside cells
84 //- if > 0 : include cells with distance from cellCentre to surface
85 // less than nearDist.
88 //- if > -1 : include cells with normals at nearest surface points
89 // varying more than curvature_.
92 //- triSurface to search on. On pointer since can be external.
93 const triSurface* surfPtr_;
95 //- search engine on surface.
96 const triSurfaceSearch* querySurfPtr_;
98 //- whether I allocated above surface ptrs or whether they are
103 // Private Member Functions
105 //- Find index of nearest triangle to point. Returns triangle or -1 if
106 // not found within search span.
107 // Cache result under pointI.
108 static label getNearest
110 const triSurfaceSearch& querySurf,
113 const vector& searchSpan,
117 //- Return true if surface normal of nearest points to vertices on
118 // cell differ from that on cell centre. Points cached in
120 bool differingPointNormals
122 const triSurfaceSearch& querySurf,
125 const label cellTriI,
126 Map<label>& pointToNearest
130 //- Depending on surface add to or delete from cellSet.
131 void combine(topoSet& set, const bool add) const;
133 //- Check values at construction time.
134 void checkSettings() const;
136 const triSurfaceSearch& querySurf() const
138 return *querySurfPtr_;
144 //- Runtime type information
145 TypeName("surfaceToCell");
149 //- Construct from components
152 const polyMesh& mesh,
153 const fileName& surfName,
154 const pointField& outsidePoints,
155 const bool includeCut,
156 const bool includeInside,
157 const bool includeOutside,
158 const scalar nearDist,
159 const scalar curvature
162 //- Construct from components (supplied surface, surfaceSearch)
165 const polyMesh& mesh,
166 const fileName& surfName,
167 const triSurface& surf,
168 const triSurfaceSearch& querySurf,
169 const pointField& outsidePoints,
170 const bool includeCut,
171 const bool includeInside,
172 const bool includeOutside,
173 const scalar nearDist,
174 const scalar curvature
177 //- Construct from dictionary
180 const polyMesh& mesh,
181 const dictionary& dict
184 //- Construct from Istream
187 const polyMesh& mesh,
194 virtual ~surfaceToCell();
199 virtual void applyToSet
201 const topoSetSource::setAction action,
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 } // End namespace Foam
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216 // ************************************************************************* //