volume.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::volume
26 
27 Description
28  Abstract zoneGenerator which selects points, cells or faces with centres
29  either inside a volume.
30 
31  By default all the points, cells or faces of the mesh are tested for being
32  inside or outside the volume 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 volume 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 of volume | 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  zone | Optional zone to sub-set | no |
48  zones | Optional list of zones to sub-set | no |
49  \endtable
50 
51 SourceFiles
52  volume.C
53 
54 \*---------------------------------------------------------------------------*/
55 
56 #ifndef volume_zoneGenerator_H
57 #define volume_zoneGenerator_H
58 
59 #include "zoneGeneratorList.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 namespace zoneGenerators
66 {
67 
68 /*---------------------------------------------------------------------------*\
69  Class volume Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class volume
73 :
74  public zoneGenerator
75 {
76 protected:
77 
78  // Protected Member Data
79 
81 
82  //- Enumeration for inside/outside selection
83  enum class selection {inside, outside};
84 
85  //- Enumeration names for inside/outside selection
86  static const NamedEnum<selection, 2> selectionNames;
87 
88  //- Initialisation function for selection enumeration names
90  {
91  return {"inside", "outside"};
92  }
93 
94  //- Inside/outside selection
96 
97  //- Optional list of zoneGenerators which provide the zones to sub-set
98  // Default selection is all of the points, cells or faces
100 
101 
102  // Protected Member Functions
103 
104  template<class ZoneType, class UnaryOp, class ZoneGenType>
106  (
107  const ZoneGenType& zoneGen,
108  const vectorField& pts,
109  const UnaryOp& uop
110  ) const;
111 
112  template<class ZoneType, class UnaryOp, class ZoneGenType>
114  (
115  const ZoneGenType& zoneGen,
116  const zoneGeneratorList& zoneGenerators,
117  const vectorField& pts,
118  const UnaryOp& uop
119  ) const;
120 
121  template<class ZoneType, class ZoneGenType>
123  (
124  const ZoneGenType& zoneGen,
125  const zoneGeneratorList& zoneGenerators,
126  const vectorField& pts
127  ) const;
128 
129  template<class UnaryOp, class ZoneGenType>
131  (
132  const ZoneGenType& zoneGen,
133  const zoneGeneratorList& zoneGenerators,
134  const vectorField& pts,
135  boolList& flipMap,
136  const UnaryOp& uop
137  ) const;
138 
139  template<class ZoneGenType>
141  (
142  const ZoneGenType& zoneGen,
143  const zoneGeneratorList& zoneGenerators,
144  const vectorField& pts,
145  boolList& flipMap
146  ) const;
147 
148  //- Generate the zone of the given type
149  template<class ZoneGenType>
150  zoneSet generate(const ZoneGenType& zone) const;
151 
152 
153 public:
154 
155  // Constructors
156 
157  //- Construct from dictionary
158  volume
159  (
160  const word& name,
161  const polyMesh& mesh,
162  const dictionary& dict
163  );
164 
165 
166  //- Destructor
167  virtual ~volume();
168 
169 
170  // Member Functions
171 
172  virtual zoneSet generate() const = 0;
173 };
174 
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 } // End namespace zoneGenerators
179 } // End namespace Foam
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #ifdef NoRepository
184  #include "volumeTemplates.C"
185 #endif
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 #endif
190 
191 // ************************************************************************* //
FixedList< word, nEnum > namesType
Definition: NamedEnum.H:64
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
List of zoneGenerators.
friend class zoneGeneratorList
Definition: zoneGenerator.H:80
const word & name() const
virtual ~volume()
Destructor.
Definition: volume.C:52
static NamedEnum< selection, 2 >::namesType selectionNames_()
Initialisation function for selection enumeration names.
Definition: volume.H:128
volume(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Definition: volume.C:37
labelList selectOp(const ZoneGenType &zoneGen, const zoneGeneratorList &zoneGenerators, const vectorField &pts) const
selection
Enumeration for inside/outside selection.
Definition: volume.H:122
static const NamedEnum< selection, 2 > selectionNames
Enumeration names for inside/outside selection.
Definition: volume.H:125
zoneGeneratorList zoneGenerators_
Optional list of zoneGenerators which provide the zones to sub-set.
Definition: volume.H:138
virtual zoneSet generate() const =0
Generate and return the zoneSet.
selection select_
Inside/outside selection.
Definition: volume.H:134
labelList select(const ZoneGenType &zoneGen, const vectorField &pts, const UnaryOp &uop) const
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
Field< vector > vectorField
Specialisation of Field<T> for vector.
zoneTypes
Enumeration defining the zone types.
Definition: zoneSet.H:66
dictionary dict