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" },
70 { faceZoneType::BOUNDARY,
"boundary" },
78 const searchableSurface& surface,
89 const label nRegions =
surface.regions().size();
96 if (surfacesDict.readIfPresent(
"faceZone", faceZoneName))
99 if (surfacesDict.found(
"faceZoneNaming"))
101 FatalIOErrorInFunction(surfacesDict)
102 <<
"Cannot provide both \"faceZone\" and \"faceZoneNaming\""
103 << exit(FatalIOError);
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)
143 FatalIOErrorInFunction(surfacesDict)
144 <<
"Number of faceZones (through 'faceZones' keyword)"
145 <<
" does not correspond to the number of regions "
146 << nRegions <<
" in surface " << surface.name()
147 << exit(FatalIOError);
153 bool hasSide = surfacesDict.readIfPresent(
"cellZoneInside", method);
156 zoneInside_ = areaSelectionAlgoNames[method];
157 if (zoneInside_ == INSIDEPOINT)
159 const bool foundPoints = surfacesDict.readIfPresent
171 <<
"Cannot supply both 'insidePoint'"
189 if (surfacesDict.readIfPresent(
"zoneInside", inside))
192 zoneInside_ = (inside ? INSIDE : OUTSIDE);
198 if (surfacesDict.readIfPresent(
"cellZone", cellZoneName_))
203 zoneInside_ == INSIDE
204 || zoneInside_ == OUTSIDE
206 && !surface.hasVolumeType()
209 IOWarningInFunction(surfacesDict)
210 <<
"Illegal entry zoneInside "
211 << areaSelectionAlgoNames[zoneInside_]
214 <<
" since surface is not closed." << endl;
220 <<
"Unused entry zoneInside for faceZone "
222 <<
" since no cellZone specified."
228 if (surfacesDict.readIfPresent(
"faceType", faceTypeMethod))
230 faceType_ = faceZoneTypeNames[faceTypeMethod];
239 const word& cellZoneName,
240 const areaSelectionAlgo& zoneInside,
242 const faceZoneType& faceType
245 faceZoneNames_(faceZoneNames),
255 faceZoneNames_(
surfZone.faceZoneNames()),
273 if (surfList[surfI].faceZoneNames().empty())
275 anonymousSurfaces[i++] = surfI;
278 anonymousSurfaces.setSize(i);
280 return anonymousSurfaces;
286 const PtrList<surfaceZonesInfo>& surfList
289 labelList namedSurfaces(surfList.size());
297 && surfList[surfI].faceZoneNames().size()
300 namedSurfaces[namedI++] = surfI;
303 namedSurfaces.setSize(namedI);
305 return namedSurfaces;
311 const PtrList<surfaceZonesInfo>& surfList
314 labelList namedSurfaces(surfList.size());
322 && surfList[surfI].faceZoneNames().size()
323 && !surfList[surfI].cellZoneName().size()
326 namedSurfaces[namedI++] = surfI;
329 namedSurfaces.setSize(namedI);
331 return namedSurfaces;
337 const PtrList<surfaceZonesInfo>& surfList,
338 const searchableSurfaces& allGeometry,
350 && surfList[surfI].cellZoneName().size()
355 && allGeometry[surfaces[surfI]].hasVolumeType()
358 closed[closedI++] = surfI;
361 closed.setSize(closedI);
369 const PtrList<surfaceZonesInfo>& surfList,
370 const searchableSurfaces& allGeometry,
382 && !allGeometry[surfaces[surfI]].hasVolumeType()
385 unclosed[unclosedI++] = surfI;
388 unclosed.setSize(unclosedI);
396 const PtrList<surfaceZonesInfo>& surfList,
397 const searchableSurfaces& allGeometry,
409 && surfList[surfI].cellZoneName().size()
410 && allGeometry[surfaces[surfI]].hasVolumeType()
413 closed[closedI++] = surfI;
416 closed.setSize(closedI);
424 const PtrList<surfaceZonesInfo>& surfList
435 && surfList[surfI].cellZoneName().size()
439 closed[closedI++] = surfI;
442 closed.setSize(closedI);
457 label zoneID = cellZones.findZoneID(
name);
461 zoneID = cellZones.size();
463 cellZones.emplace_back
478 const PtrList<surfaceZonesInfo>& surfList,
483 labelList surfaceToCellZone(surfList.size(), -1);
487 label surfI = namedSurfaces[i];
489 const word& cellZoneName = surfList[surfI].cellZoneName();
491 if (!cellZoneName.empty())
493 label zoneI = addCellZone
500 surfaceToCellZone[surfI] = zoneI;
509 for (label proci = 1; proci < allCellZones.size(); proci++)
511 if (allCellZones[proci] != allCellZones[0])
514 <<
"Zones not synchronised among processors." <<
nl
515 <<
" Processor0 has cellZones:" << allCellZones[0]
516 <<
" , processor" << proci
517 <<
" has cellZones:" << allCellZones[proci]
522 return surfaceToCellZone;
537 label zoneID = faceZones.findZoneID(
name);
541 zoneID = faceZones.size();
543 faceZones.emplace_back
639 label surfI = namedSurfaces[i];
641 const wordList& faceZoneNames = surfList[surfI].faceZoneNames();
643 surfaceToFaceZones[surfI].
setSize(faceZoneNames.
size(), -1);
646 const word& faceZoneName = faceZoneNames[j];
648 label zoneI = addFaceZone
656 surfaceToFaceZones[surfI][j] = zoneI;
665 for (label proci = 1; proci < allFaceZones.size(); proci++)
667 if (allFaceZones[proci] != allFaceZones[0])
670 <<
"Zones not synchronised among processors." <<
nl
671 <<
" Processor0 has faceZones:" << allFaceZones[0]
672 <<
" , processor" << proci
673 <<
" has faceZones:" << allFaceZones[proci]
678 return surfaceToFaceZones;
if(maxValue - minValue< SMALL)
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void setSize(label n)
Alias for resize().
static void allGatherList(UList< T > &values, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Gather data, but keep individual values separate. Uses MPI_Allgather or manual communication.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
T & emplace_back(Args &&... args)
Construct and append an element to the end of the list, return reference to the new list element.
void size(const label n)
Older name for setAddressableSize.
static int myProcNo(const label communicator=worldComm)
Rank of this process in the communicator (starting from masterNo()). Negative if the process is not a...
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator). It is 1 for serial run.
label size() const noexcept
The number of entries in the list.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
wordList names() const
A list of the zone names.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
Mesh consisting of general polyhedral cells.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
Base class of (analytical or triangulated) surface. Encapsulates all the search routines....
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
A surface zone on a MeshedSurface.
faceZoneNaming
How to generate faceZone name.
static labelList getInsidePointNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of surfaces with a cellZone that have 'insidePoint'.
areaSelectionAlgo
Types of selection of area.
static labelList getUnnamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of unnamed surfaces (surfaces without faceZoneName).
static labelList getStandaloneNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces without a cellZone.
faceZoneType
What to do with faceZone faces.
static label addFaceZone(const word &name, const labelList &addressing, const boolList &flipMap, polyMesh &mesh)
const pointField & zoneInsidePoints() const
Get specified inside locations for surfaces with a cellZone.
static const Enum< faceZoneType > faceZoneTypeNames
static labelList getNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList)
Get indices of named surfaces (surfaces with faceZoneName).
static labelList getAllClosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are closed.
const areaSelectionAlgo & zoneInside() const
const word & cellZoneName() const
Per 'interface' surface : empty or name of cellZone to put.
static const Enum< faceZoneNaming > faceZoneNamingNames
static labelList addCellZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
static labelList getUnclosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are unclosed.
static labelListList addFaceZonesToMesh(const PtrList< surfaceZonesInfo > &surfList, const labelList &namedSurfaces, polyMesh &mesh)
static const Enum< areaSelectionAlgo > areaSelectionAlgoNames
const faceZoneType & faceType() const
How to handle face of surfaces with a faceZone.
static label addCellZone(const word &name, const labelList &addressing, polyMesh &mesh)
surfaceZonesInfo(const searchableSurface &surface, const dictionary &surfacesDict, const wordList ®ionNames)
Construct from surfaces and dictionary and fully resolved.
static labelList getClosedNamedSurfaces(const PtrList< surfaceZonesInfo > &surfList, const searchableSurfaces &allGeometry, const labelList &surfaces)
Get indices of surfaces with a cellZone that are closed and.
const wordList & faceZoneNames() const
Per 'interface' surface : empty or names of faceZones to put.
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
@ NONE
No type, or default initialized type.
const wordList surface
Standard surface field types (scalar, vector, tensor, etc).
List< word > wordList
List of word.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with faceZone content on a polyMesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with cellZone content on a polyMesh.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
vector point
Point is a vector.
List< bool > boolList
A List of bools.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.