35 namespace zoneGenerators
70 geometry_(
dict.lookupOrDefault<bool>(
"geometry", true))
85 const bool printPointZones =
87 const bool printFaceZones =
89 const bool printCellZones =
94 if (!zoneNames_.valid())
97 if (printPointZones) allZoneNameSet.
insert(mesh_.pointZones().toc());
98 if (printFaceZones) allZoneNameSet.
insert(mesh_.faceZones().toc());
99 if (printCellZones) allZoneNameSet.
insert(mesh_.cellZones().toc());
100 allZoneNames = allZoneNameSet.
toc();
103 zoneNames_.valid() ? zoneNames_() : allZoneNames;
107 const faceList& faces = mesh_.faces();
108 const scalarField& magFaceAreas = mesh_.magFaceAreas();
109 const pointField& faceCentres = mesh_.faceCentres();
111 const scalarField& cellVolumes = mesh_.cellVolumes();
112 const pointField& cellCentres = mesh_.cellCentres();
123 const word&
name = zoneNames[zonei];
126 const bool printPointZone =
127 printPointZones && mesh_.pointZones().found(
name);
128 const bool printFaceZone =
129 printFaceZones && mesh_.faceZones().found(
name);
130 const bool printCellZone =
131 printCellZones && mesh_.cellZones().found(
name);
132 const bool printMultiple =
133 printPointZone + printFaceZone + printCellZone > 1;
137 << (printMultiple ?
"s" :
"")
138 <<
" '" <<
name <<
"' " << (printMultiple ?
"have" :
"has");
141 label pointZoneSize = 0;
143 scalar faceZoneMagArea = 0;
145 scalar cellZoneVolume = 0;
149 forAll(zonePointPoints, zonePointi)
151 pointZonePoints[zonePointPoints[zonePointi]] = -1;
153 zonePointPoints.
clear();
161 Info<<
' ' << nPz <<
" points";
163 if (geometry_ && nPz)
169 pointZoneAverage +=
points[pz[i]];
172 pointZoneAverage /= pointZoneSize;
177 const label pointi = pz[pzPointi];
178 if (pointZonePoints[pointi] != -1)
continue;
179 pointZonePoints[pointi] = zonePointPoints.
size();
180 zonePointPoints.
append(pointi);
191 if (printPointZone && printCellZone)
Info<<
",";
192 if (printPointZone && !printCellZone)
Info<<
" and";
193 Info<<
' ' << nFz <<
" faces";
195 if (geometry_ && nFz)
200 faceZoneMagArea += magFaceAreas[fz[fzFacei]];
202 magFaceAreas[fz[fzFacei]]*faceCentres[fz[fzFacei]];
206 faceZoneCentroid /= faceZoneMagArea;
211 const label facei = fz[fzFacei];
212 forAll(faces[facei], facePointi)
214 const label pointi = faces[facei][facePointi];
215 if (pointZonePoints[pointi] != -1)
continue;
216 pointZonePoints[pointi] = zonePointPoints.
size();
217 zonePointPoints.
append(pointi);
229 if (printPointZone || printFaceZone)
Info<<
" and";
230 Info<<
' ' << nCz <<
" cells";
232 if (geometry_ && nCz)
237 cellZoneVolume += cellVolumes[cz[czCelli]];
239 cellVolumes[cz[czCelli]]*cellCentres[cz[czCelli]];
243 cellZoneCentroid /= cellZoneVolume;
248 const label celli = cz[czCelli];
252 forAll(faces[facei], facePointi)
254 const label pointi = faces[facei][facePointi];
255 if (pointZonePoints[pointi] != -1)
continue;
256 pointZonePoints[pointi] = zonePointPoints.
size();
257 zonePointPoints.
append(pointi);
264 Info<< (geometry_ ?
":" :
"") <<
nl;
267 if (!geometry_)
continue;
270 if (printPointZone && pointZoneSize)
272 Info<<
" points average = "
273 << pointZoneAverage <<
nl;
275 if (printFaceZone && faceZoneMagArea > 0)
277 Info<<
" faces area/centroid = "
278 << faceZoneMagArea <<
'/' << faceZoneCentroid <<
nl;
280 if (printCellZone && cellZoneVolume > 0)
282 Info<<
" cells volume/centroid = "
283 << cellZoneVolume <<
'/' << cellZoneCentroid <<
nl;
291 Info<<
" bound box min/max = "
292 << bb.
min() <<
'/' << bb.
max() <<
nl;
295 Info<<
" bound sphere centre/radius = "
296 << bs.
c() <<
'/' << bs.
r() <<
nl;
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
DynamicList< T, SizeInc, SizeMult, SizeDiv > & append(const T &)
Append an element at the end of the list.
void clear()
Clear the addressed list, i.e. set the size to zero.
A HashTable with keys but without contents.
bool insert(const Key &key)
Insert a new entry.
List< Key > toc() const
Return the table of contents.
void size(const label)
Override size to be inconsistent with allocated storage.
A List with indirect addressing.
A bounding box defined in terms of the points at its extremities.
const point & min() const
Minimum point defining the bounding box.
const point & max() const
Maximum point defining the bounding box.
The smallest sphere enclosing a given set of points.
scalar r() const
Return the radius.
const point & c() const
Return the centre.
static boundSphere global(const PointList &ps, const bool strict=false)
Return the sphere bounding the given set of points using Welzl's.
Named list of cell indices representing a sub-set of the mesh.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Named list of face indices representing a sub-set of the mesh faces.
Named list of point indices representing a sub-set of the mesh faces.
Mesh consisting of general polyhedral cells.
A class for handling words, derived from string.
Abstract base class for all zoneGenerators, providing runtime selection.
A zoneGenerator which looks-up and returns a zoneSet containing point, and/or cell and/or faces zones...
A zoneGenerator which converts the point, cell and face zones from a list of zoneGenerators into a po...
A zoneGenerator which prints pointZones and/or cellZone and/or faceZones from the mesh.
virtual zoneSet generate() const
Generate and return the zoneSet.
virtual ~print()
Destructor.
print(const word &name, const polyMesh &mesh, const dictionary &dict)
Construct from dictionary.
Zone container returned by zoneGenerator::generate.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
defineTypeNameAndDebug(cylinderHeadPoints, 0)
addToRunTimeSelectionTable(zoneGenerator, cylinderHeadPoints, dictionary)
zoneTypesAll
Enumeration defining the zone types with an option for all the types.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
const NamedEnum< zoneTypesAll, 4 > zoneTypesAllNames
Named enumeration defining the zone type names.