insideSurface.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::zoneGenerators::insideSurface
26 
27 Description
28  A zoneGenerator which selects points, cells or faces with centres either
29  inside or outside a surface
30 
31  By default all the points, cells or faces of the mesh are tested for being
32  inside or outside the surface but an optional single zone or list of zones
33  may be provided and those points, cells or faces are tested instead. This
34  provides an efficient method of hierarchical sub-division of space where an
35  initial selection of points cells or faces is refined by selecting the
36  sub-set inside or outside the given surface rather than having to generate
37  another zone to intersect with.
38 
39 Usage
40  \table
41  Property | Description | Required | Default value
42  type | Type: insideSurface | yes |
43  name | Name of the zone | no | zoneGenerator name
44  zoneType | Type of zone | yes |
45  select | Select either the inside or outside | no | inside
46  moveUpdate | Switch to update after mesh motion | no | false
47  surface | searchableSurface type | yes |
48  zone | Optional zone to sub-set | no |
49  zones | Optional list of zones to sub-set | no |
50  \endtable
51 
52  A cellZone named \c cylinder containing the cells with centres inside the
53  \c closedTriSurface "sloshingCylinder.obj" is generated by
54  \verbatim
55  cylinder
56  {
57  type insideSurface;
58  zoneType cell;
59 
60  surface closedTriSurface;
61  file "sloshingCylinder.obj";
62  }
63  \endverbatim
64 
65 See also
66  zoneGenerators::volume
67 
68 SourceFiles
69  insideSurface.C
70 
71 \*---------------------------------------------------------------------------*/
72 
73 #ifndef insideSurface_zoneGenerator_H
74 #define insideSurface_zoneGenerator_H
75 
76 #include "volume.H"
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 namespace Foam
81 {
82 
83 class searchableSurface;
84 
85 namespace zoneGenerators
86 {
87 
88 /*---------------------------------------------------------------------------*\
89  Class insideSurface Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 class insideSurface
93 :
94  public volume
95 {
96  // Private Data
97 
98  //- Surface
99  autoPtr<searchableSurface> surfacePtr_;
100 
101 
102 protected:
103 
104  // Protected Member Functions
105 
106  friend class volume;
107 
108  template<class ZoneType, class UnaryOp>
110  (
111  const insideSurface& zoneGen,
112  const vectorField& pts,
113  const UnaryOp& uop
114  ) const;
115 
116  template<class ZoneType, class UnaryOp>
118  (
119  const insideSurface& zoneGen,
120  const zoneGeneratorList& zoneGenerators,
121  const vectorField& pts,
122  const UnaryOp& uop
123  ) const;
124 
125  template<class UnaryOp>
127  (
128  const insideSurface& zoneGen,
129  const zoneGeneratorList& zoneGenerators,
130  const vectorField& pts,
131  boolList& flipMap,
132  const UnaryOp& uop
133  ) const;
134 
135 
136 public:
137 
138  //- Runtime type information
139  TypeName("insideSurface");
140 
141 
142  // Constructors
143 
144  //- Construct from dictionary
146  (
147  const word& name,
148  const polyMesh& mesh,
149  const dictionary& dict
150  );
151 
152 
153  //- Destructor
154  virtual ~insideSurface();
155 
156 
157  // Member Functions
158 
159  virtual zoneSet generate() const;
160 };
161 
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 } // End namespace zoneGenerators
166 } // End namespace Foam
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 #endif
171 
172 // ************************************************************************* //
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
A class for handling words, derived from string.
Definition: word.H:62
friend class zoneGeneratorList
Definition: zoneGenerator.H:80
const word & name() const
virtual zoneSet generate() const
Generate and return the zoneSet.
TypeName("insideSurface")
Runtime type information.
labelList select(const insideSurface &zoneGen, const vectorField &pts, const UnaryOp &uop) const
virtual ~insideSurface()
Destructor.
insideSurface(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Zone container returned by zoneGenerator::generate.
Definition: zoneSet.H:94
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: labelList.H:56
List< bool > boolList
Bool container classes.
Definition: boolList.H:50
Field< vector > vectorField
Specialisation of Field<T> for vector.
dictionary dict