zoneGenerator.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::zoneGenerator
26 
27 Description
28  Abstract base class for all zoneGenerators, providing runtime selection
29 
30 See also
31  Foam::zoneSet
32  Foam::zoneGeneratorList
33 
34 SourceFiles
35  zoneGenerator.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef zoneGenerator_H
40 #define zoneGenerator_H
41 
42 #include "zoneSet.H"
43 #include "runTimeSelectionTables.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declaration of classes
51 class polyMesh;
52 
53 /*---------------------------------------------------------------------------*\
54  Class zoneGenerator Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class zoneGenerator
58 {
59 protected:
60 
61  // Protected Data
62 
63  //- Name of zone generator
64  const word name_;
65 
66  //- Dictionary cached for error context
67  const dictionary dict_;
68 
69  //- Name of the zone (defaults to the name of the generator)
70  const word zoneName_;
71 
72  //- Reference to the polyMesh
73  const polyMesh& mesh_;
74 
75  //- Switch to update the zones if the mesh points are moved
76  mutable bool moveUpdate_;
77 
78 
79 public:
80 
81  friend class zoneGeneratorList;
82 
83 
84  //- Runtime type information
85  TypeName("zoneGenerator");
86 
87 
88  // Declare run-time constructor selection table
89 
91  (
92  autoPtr,
94  dictionary,
95  (
96  const word& name,
97  const polyMesh& mesh,
98  const dictionary& dict
99  ),
100  (name, mesh, dict)
101  );
102 
103 
104  // Constructors
105 
106  //- Construct from name, polyMesh and dictionary
108  (
109  const word& name,
110  const polyMesh& mesh,
111  const dictionary& dict
112  );
113 
114  //- Disallow default bitwise copy construction
115  zoneGenerator(const zoneGenerator&) = delete;
116 
117 
118  // Selectors
119 
120  //- Select constructed from name, mesh and dictionary
122  (
123  const word& name,
124  const polyMesh& mesh,
125  const dictionary& dict
126  );
127 
128  //- Select constructed from name, zoneType, mesh and dictionary
130  (
131  const word& name,
132  const zoneTypes& zoneType,
133  const polyMesh& mesh,
134  const dictionary& dict
135  );
136 
137  //- Select constructed from mesh and first valid dictionary
139  (
140  const polyMesh& mesh,
141  const dictionary& dict
142  );
143 
144 
145  //- Destructor
146  virtual ~zoneGenerator();
147 
148 
149  // Member Functions
150 
151  const word& name() const
152  {
153  return name_;
154  }
155 
156  const word& zoneName() const
157  {
158  return zoneName_;
159  }
160 
161  //- Return the list of selected indices
162  static labelList indices(const boolList& selected);
163 
164  //- Return true if the zoneGenerator updates any of the zones
165  // following mesh point motion
166  bool moveUpdate() const
167  {
168  return moveUpdate_;
169  }
170 
171  //- Generate and return the zoneSet
172  virtual zoneSet generate() const = 0;
173 
174  //- Regenerate the zoneSet following mesh point motion
175  virtual zoneSet movePoints() const;
176 
177 
178  // Member Operators
179 
180  //- Disallow default bitwise assignment
181  void operator=(const zoneGenerator&) = delete;
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
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.
Abstract base class for all zoneGenerators, providing runtime selection.
Definition: zoneGenerator.H:57
const word zoneName_
Name of the zone (defaults to the name of the generator)
Definition: zoneGenerator.H:69
TypeName("zoneGenerator")
Runtime type information.
virtual ~zoneGenerator()
Destructor.
Definition: zoneGenerator.C:58
static labelList indices(const boolList &selected)
Return the list of selected indices.
const word & zoneName() const
virtual zoneSet movePoints() const
Regenerate the zoneSet following mesh point motion.
const dictionary dict_
Dictionary cached for error context.
Definition: zoneGenerator.H:66
virtual zoneSet generate() const =0
Generate and return the zoneSet.
declareRunTimeSelectionTable(autoPtr, zoneGenerator, dictionary,(const word &name, const polyMesh &mesh, const dictionary &dict),(name, mesh, dict))
const word & name() const
bool moveUpdate_
Switch to update the zones if the mesh points are moved.
Definition: zoneGenerator.H:75
static autoPtr< zoneGenerator > New(const word &name, const polyMesh &mesh, const dictionary &dict)
Select constructed from name, mesh and dictionary.
Definition: zoneGenerator.C:66
const polyMesh & mesh_
Reference to the polyMesh.
Definition: zoneGenerator.H:72
bool moveUpdate() const
Return true if the zoneGenerator updates any of the zones.
void operator=(const zoneGenerator &)=delete
Disallow default bitwise assignment.
zoneGenerator(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from name, polyMesh and dictionary.
Definition: zoneGenerator.C:42
const word name_
Name of zone generator.
Definition: zoneGenerator.H:63
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.
zoneTypes
Enumeration defining the zone types.
Definition: zoneSet.H:66
Macros to ease declaration of run-time selection tables.
dictionary dict