twoPhaseEulerFoam:frictionalStressModel/Schaeffer: Correct mut on processor boundaries
[OpenFOAM-1.7.x.git] / src / meshTools / sets / cellSources / surfaceToCell / surfaceToCell.H
blob7592ab4c16520cdee533dda536c3f104c6c4eef1
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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/>.
24 Class
25     Foam::surfaceToCell
27 Description
28     A topoSetSource to select cells based on relation to surface.
30     Selects:
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)
37 SourceFiles
38     surfaceToCell.C
40 \*---------------------------------------------------------------------------*/
42 #ifndef surfaceToCell_H
43 #define surfaceToCell_H
45 #include "topoSetSource.H"
46 #include "Map.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 namespace Foam
52 class triSurfaceSearch;
53 class triSurface;
55 /*---------------------------------------------------------------------------*\
56                            Class surfaceToCell Declaration
57 \*---------------------------------------------------------------------------*/
59 class surfaceToCell
61     public topoSetSource
64     // Private data
66         //- Add usage string
67         static addToUsageTable usage_;
69         //- Name of surface file
70         fileName surfName_;
72         //- Points which are outside
73         pointField outsidePoints_;
75         //- Include cut cells
76         bool includeCut_;
78         //- Include inside cells
79         bool includeInside_;
81         //- Include outside cells
82         bool includeOutside_;
84         //- if > 0 : include cells with distance from cellCentre to surface
85         //  less than nearDist.
86         scalar nearDist_;
88         //- if > -1 : include cells with normals at nearest surface points
89         //  varying more than curvature_.
90         scalar 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
99         //  external.
100         bool IOwnPtrs_;
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
109         (
110             const triSurfaceSearch& querySurf,
111             const label pointI,
112             const point& pt,
113             const vector& searchSpan,
114             Map<label>& cache
115         );
117         //- Return true if surface normal of nearest points to vertices on
118         //  cell differ from that on cell centre. Points cached in
119         //  pointToNearest.
120         bool differingPointNormals
121         (
122             const triSurfaceSearch& querySurf,
123             const vector& span,
124             const label cellI,
125             const label cellTriI,
126             Map<label>& pointToNearest
127         ) const;
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
137         {
138             return *querySurfPtr_;
139         }
142 public:
144     //- Runtime type information
145     TypeName("surfaceToCell");
147     // Constructors
149         //- Construct from components
150         surfaceToCell
151         (
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
160         );
162         //- Construct from components (supplied surface, surfaceSearch)
163         surfaceToCell
164         (
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
175         );
177         //- Construct from dictionary
178         surfaceToCell
179         (
180             const polyMesh& mesh,
181             const dictionary& dict
182         );
184         //- Construct from Istream
185         surfaceToCell
186         (
187             const polyMesh& mesh,
188             Istream&
189         );
192     // Destructor
194         virtual ~surfaceToCell();
197     // Member Functions
199         virtual void applyToSet
200         (
201             const topoSetSource::setAction action,
202             topoSet&
203         ) const;
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 } // End namespace Foam
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 #endif
216 // ************************************************************************* //