generatedCellZone.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) 2022-2026 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::generatedCellZone
26 
27 Description
28  cellZone selection or generation class
29 
30  The cellZone is either looked-up from the mesh or generated by a
31  zoneGenerator and stored locally.
32 
33 Usage
34  Examples:
35  \verbatim
36  // Select all the cells
37  cellZone all;
38 
39  // Select the cells within the cellZone rotor
40  cellZone rotor;
41 
42  // Select the cells within the given box
43  cellZone
44  {
45  type box;
46  box (3.48 -0.1 -0.1) (3.5 0.1 0.1);
47  }
48 
49  // Select the cell containing the given point
50  cellZone
51  {
52  type containsPoints;
53  points ((0.075 0.2 0.05));
54  }
55  \endverbatim
56 
57 See also
58  Foam::generatedZoneSet
59  Foam::zoneGenerator
60 
61 SourceFiles
62  generatedCellZone.C
63  generatedCellZoneI.H
64 
65 \*---------------------------------------------------------------------------*/
66 
67 #ifndef generatedCellZone_H
68 #define generatedCellZone_H
69 
70 #include "generatedZoneSet.H"
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 namespace Foam
75 {
76 
77 class polyMesh;
78 class polyMeshMap;
79 class polyDistributionMap;
80 
81 /*---------------------------------------------------------------------------*\
82  Class generatedCellZone Declaration
83 \*---------------------------------------------------------------------------*/
84 
86 {
87  // Private data
88 
89  //- Reference to the mesh
90  const polyMesh& mesh_;
91 
92  //- Switch for all cells
93  bool all_;
94 
95  //- The generated cellZone
96  mutable generatedZoneSet cellZone_;
97 
98 
99 public:
100 
101  // Constructors
102 
103  //- Construct from mesh selecting all cells
105 
106  //- Construct from mesh and dictionary
108  (
109  const polyMesh& mesh,
110  const dictionary& dict,
111  const bool defaultIsAll = false,
112  const bool onDemand = false
113  );
114 
115  //- Disallow default bitwise copy construction
116  generatedCellZone(const generatedCellZone&) = delete;
117 
118 
119  //- Destructor
121 
122 
123  // Member Functions
124 
125  // Access
126 
127  //- Return true if the set comprises all the cells
128  inline bool all() const;
129 
130  //- Return const access to the name of cellZone
131  inline const word& name() const;
132 
133  //- Return const access to the cell set
134  inline const cellZone& zone() const;
135 
136  //- Return the number of cells in the set
137  inline label nCells() const;
138 
139  //- Return the cell index corresponding to the cell set index
140  inline label celli(const label i) const;
141 
142  //- Regenerate the cellZone if the regenerate switch is set true
143  // and true if regenerated
144  // Useful if the zone is not purely geometric e.g. field dependent
145  bool regenerate();
146 
147 
148  // Mesh changes
149 
150  //- Update for mesh motion
151  void movePoints();
152 
153  //- Update topology using the given map
154  void topoChange(const polyTopoChangeMap&);
155 
156  //- Update from another mesh using the given map
157  void mapMesh(const polyMeshMap&);
158 
159  //- Redistribute or update using the given distribution map
160  void distribute(const polyDistributionMap&);
161 
162 
163  // IO
164 
165  //- Read coefficients dictionary
166  bool read
167  (
168  const dictionary& dict,
169  const bool defaultIsAll = false,
170  const bool onDemand = false
171  );
172 
173 
174  // Member Operators
175 
176  //- Disallow default bitwise assignment
177  void operator=(const generatedCellZone&) = delete;
178 };
179 
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 } // End namespace Foam
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 #include "generatedCellZoneI.H"
188 
189 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 
191 #endif
192 
193 // ************************************************************************* //
Named list of cell indices representing a sub-set of the mesh.
Definition: cellZone.H:61
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
cellZone selection or generation class
const cellZone & zone() const
Return const access to the cell set.
label celli(const label i) const
Return the cell index corresponding to the cell set index.
void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
void movePoints()
Update for mesh motion.
bool all() const
Return true if the set comprises all the cells.
void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
void operator=(const generatedCellZone &)=delete
Disallow default bitwise assignment.
label nCells() const
Return the number of cells in the set.
bool read(const dictionary &dict, const bool defaultIsAll=false, const bool onDemand=false)
Read coefficients dictionary.
generatedCellZone(const polyMesh &mesh)
Construct from mesh selecting all cells.
const word & name() const
Return const access to the name of cellZone.
bool regenerate()
Regenerate the cellZone if the regenerate switch is set true.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Definition: word.H:63
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
dictionary dict