Go to the documentation of this file.
43 { areaSelectionAlgo::INSIDE,
"inside" },
44 { areaSelectionAlgo::OUTSIDE,
"outside" },
45 { areaSelectionAlgo::INSIDEPOINT,
"insidePoint" },
46 { areaSelectionAlgo::NONE,
"none" },
56 { faceZoneNaming::NOZONE,
"none" },
57 { faceZoneNaming::SINGLE,
"single" },
58 { faceZoneNaming::REGION,
"region" }
68 { faceZoneType::INTERNAL,
"internal" },
69 { faceZoneType::BAFFLE,
"baffle" },
70 { faceZoneType::BOUNDARY,
"boundary" },
89 const label nRegions = surface.
regions().size();
99 if (surfacesDict.
found(
"faceZoneNaming"))
102 <<
"Cannot provide both \"faceZone\" and \"faceZoneNaming\""
106 namingType = faceZoneNaming::SINGLE;
107 faceZoneNames_.setSize(nRegions, faceZoneName);
109 else if (surfacesDict.
readIfPresent(
"faceZoneNaming", namingMethod))
112 namingType = faceZoneNamingNames[namingMethod];
117 case faceZoneNaming::NOZONE:
120 case faceZoneNaming::SINGLE:
123 faceZoneNames_.setSize
126 surfacesDict.
get<
word>(
"faceZone")
131 case faceZoneNaming::REGION:
133 faceZoneNames_ = regionNames;
139 if (faceZoneNames_.size())
141 if (faceZoneNames_.size() != nRegions)
144 <<
"Number of faceZones (through 'faceZones' keyword)"
145 <<
" does not correspond to the number of regions "
146 << nRegions <<
" in surface " << surface.
name()
153 bool hasSide = surfacesDict.
readIfPresent(
"cellZoneInside", method);
156 zoneInside_ = areaSelectionAlgoNames[method];
157 if (zoneInside_ == INSIDEPOINT)
159 surfacesDict.
readEntry(
"insidePoint", zoneInsidePoint_);
170 zoneInside_ = (inside ? INSIDE : OUTSIDE);
181 zoneInside_ == INSIDE
182 || zoneInside_ == OUTSIDE
188 <<
"Illegal entry zoneInside "
189 << areaSelectionAlgoNames[zoneInside_]
192 <<
" since surface is not closed." <<
endl;
198 <<
"Unused entry zoneInside for faceZone "
200 <<
" since no cellZone specified."
208 faceType_ = faceZoneTypeNames[faceTypeMethod];
217 const word& cellZoneName,
219 const point& zoneInsidePoint,
223 faceZoneNames_(faceZoneNames),
224 cellZoneName_(cellZoneName),
225 zoneInside_(zoneInside),
226 zoneInsidePoint_(zoneInsidePoint),
233 faceZoneNames_(
surfZone.faceZoneNames()),
234 cellZoneName_(
surfZone.cellZoneName()),
236 zoneInsidePoint_(
surfZone.zoneInsidePoint()),
246 labelList anonymousSurfaces(surfList.size());
251 if (surfList[surfI].faceZoneNames().empty())
253 anonymousSurfaces[i++] = surfI;
256 anonymousSurfaces.setSize(i);
258 return anonymousSurfaces;
267 labelList namedSurfaces(surfList.size());
275 && surfList[surfI].faceZoneNames().size()
278 namedSurfaces[namedI++] = surfI;
283 return namedSurfaces;
292 labelList namedSurfaces(surfList.size());
300 && surfList[surfI].faceZoneNames().size()
301 && !surfList[surfI].cellZoneName().size()
304 namedSurfaces[namedI++] = surfI;
309 return namedSurfaces;
328 && surfList[surfI].cellZoneName().size()
333 && allGeometry[surfaces[surfI]].hasVolumeType()
336 closed[closedI++] = surfI;
339 closed.setSize(closedI);
360 && !allGeometry[surfaces[surfI]].hasVolumeType()
363 unclosed[unclosedI++] = surfI;
366 unclosed.setSize(unclosedI);
387 && surfList[surfI].cellZoneName().size()
388 && allGeometry[surfaces[surfI]].hasVolumeType()
391 closed[closedI++] = surfI;
394 closed.setSize(closedI);
413 && surfList[surfI].cellZoneName().size()
417 closed[closedI++] = surfI;
420 closed.setSize(closedI);
439 zoneI = cellZones.size();
440 cellZones.setSize(zoneI+1);
464 labelList surfaceToCellZone(surfList.size(), -1);
468 label surfI = namedSurfaces[i];
470 const word& cellZoneName = surfList[surfI].cellZoneName();
474 label zoneI = addCellZone
481 surfaceToCellZone[surfI] = zoneI;
491 for (label proci = 1; proci < allCellZones.size(); proci++)
493 if (allCellZones[proci] != allCellZones[0])
496 <<
"Zones not synchronised among processors." <<
nl
497 <<
" Processor0 has cellZones:" << allCellZones[0]
498 <<
" , processor" << proci
499 <<
" has cellZones:" << allCellZones[proci]
504 return surfaceToCellZone;
523 zoneI = faceZones.size();
524 faceZones.setSize(zoneI+1);
555 label surfI = namedSurfaces[i];
557 const wordList& faceZoneNames = surfList[surfI].faceZoneNames();
559 surfaceToFaceZones[surfI].
setSize(faceZoneNames.size(), -1);
562 const word& faceZoneName = faceZoneNames[j];
564 label zoneI = addFaceZone
572 surfaceToFaceZones[surfI][j] = zoneI;
582 for (label proci = 1; proci < allFaceZones.size(); proci++)
584 if (allFaceZones[proci] != allFaceZones[0])
587 <<
"Zones not synchronised among processors." <<
nl
588 <<
" Processor0 has faceZones:" << allFaceZones[0]
589 <<
" , processor" << proci
590 <<
" has faceZones:" << allFaceZones[proci]
595 return surfaceToFaceZones;
List< label > labelList
A List of labels.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
faceZoneType
What to do with faceZone faces.
const word & name() const
Return name.
A class for handling words, derived from Foam::string.
static labelList getInsidePointNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of surfaces with a cellZone that have 'insidePoint'.
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
const cellZoneMesh & cellZones() const
Return cell zone mesh.
List< bool > boolList
A List of bools.
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName)
Ostream & endl(Ostream &os)
Add newline and flush stream.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
static labelList getAllClosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are closed.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
Mesh consisting of general polyhedral cells.
#define forAll(list, i)
Loop across all elements in list.
const faceZoneMesh & faceZones() const
Return face zone mesh.
static labelList getStandaloneNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces without a cellZone.
virtual const wordList & regions() const =0
Names of regions.
A subset of mesh faces organised as a primitive patch.
word name(const complex &c)
Return string representation of complex.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
void setSize(const label newLen)
Same as resize()
areaSelectionAlgo
Types of selection of area.
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual bool hasVolumeType() const
Whether supports volume type (below).
static const Enum< faceZoneNaming > faceZoneNamingNames
const T * set(const label i) const
Return const pointer to element (if set) or nullptr.
label findZoneID(const word &zoneName) const
Find zone index given a name, return -1 if not found.
static labelList getClosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are closed and.
wordList names() const
A list of the zone names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static labelList getUnclosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are unclosed.
static labelList getUnnamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of unnamed surfaces (surfaces without faceZoneName)
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
static const Enum< faceZoneType > faceZoneTypeNames
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
faceZoneNaming
How to generate faceZone name.
A surface zone on a MeshedSurface.
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
static const word null
An empty word.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
static labelListList addFaceZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
void setSize(const label newSize)
Alias for resize(const label)
static const Enum< areaSelectionAlgo > areaSelectionAlgoNames
surfaceZonesInfo(const searchableSurface &surface, const dictionary &surfacesDict, const wordList ®ionNames)
Construct from surfaces and dictionary and fully resolved.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
static label addCellZone(const word &name, const labelList &addressing, polyMesh &mesh)
static labelList addCellZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
static label addFaceZone(const word &name, const labelList &addressing, const boolList &flipMap, polyMesh &mesh)