119 using namespace Foam;
133 forAll(patchesToRename, i)
135 label patchi = patchesToRename[i];
138 if (isA<coupledPolyPatch>(
pp))
141 <<
"Encountered coupled patch " <<
pp.name()
142 <<
". Will only rename the patch itself," 143 <<
" not any referred patches." 144 <<
" This might have to be done by hand." 148 pp.name() = prefix +
'_' +
pp.name();
155 template<
class GeoField>
167 for (
const GeoField&
fld :
mesh.objectRegistry::csorted<GeoField>())
185 forAll(tSubFld().boundaryField(), patchi)
187 if (addedPatches.
found(patchi))
189 tSubFld.ref().boundaryFieldRef()[patchi] ==
Zero;
194 GeoField* subFld = tSubFld.ptr();
195 subFld->rename(
fld.name());
202 template<
class GeoField>
203 void subsetSurfaceFields
214 for (
const GeoField&
fld :
mesh.objectRegistry::csorted<GeoField>())
232 forAll(tSubFld().boundaryField(), patchi)
234 if (addedPatches.
found(patchi))
236 tSubFld.ref().boundaryFieldRef()[patchi] ==
Zero;
241 GeoField* subFld = tSubFld.ptr();
242 subFld->rename(
fld.name());
254 if (cellRegion[celli] != regionI)
256 nonRegionCells.append(celli);
259 return nonRegionCells.shrink();
267 const label ownRegion,
268 const label neiRegion,
274 min(ownRegion, neiRegion),
275 max(ownRegion, neiRegion)
283 auto zoneIter = iter().find(zoneID);
292 iter().insert(zoneID, 1);
299 zoneToSize.
insert(zoneID, 1);
307 void getInterfaceSizes
310 const bool useFaceZones,
333 if (ownRegion != neiRegion)
355 coupledRegion[i] = cellRegion[celli];
363 label neiRegion = coupledRegion[i];
365 if (ownRegion != neiRegion)
394 auto masterIter = regionsToSize.
find(slaveIter.key());
396 if (masterIter.good())
403 const label zoneID = iter.key();
404 const label slaveSize = iter.val();
406 auto zoneIter = masterInfo.
find(zoneID);
409 *zoneIter += slaveSize;
413 masterInfo.
insert(zoneID, slaveSize);
419 regionsToSize.
insert(slaveIter.key(), slaveInfo);
433 toMaster << regionsToSize;
445 label nInterfaces = 0;
449 nInterfaces += info.
size();
452 interfaces.
setSize(nInterfaces);
453 interfaceNames.
setSize(nInterfaces);
454 interfaceSizes.
setSize(nInterfaces);
460 const edge&
e = iter.key();
468 interfaces[nInterfaces] = iter.key();
469 label zoneID = infoIter.key();
474 name0 +
"_to_" + name1,
475 name1 +
"_to_" + name0
483 zoneName +
"_" + name0 +
"_to_" + name1,
484 zoneName +
"_" + name1 +
"_to_" + name0
487 interfaceSizes[nInterfaces] = infoIter();
489 if (regionsToInterface.found(
e))
491 regionsToInterface[
e].insert(zoneID, nInterfaces);
496 zoneAndInterface.
insert(zoneID, nInterfaces);
497 regionsToInterface.insert(
e, zoneAndInterface);
522 if (ownRegion != neiRegion)
532 min(ownRegion, neiRegion),
533 max(ownRegion, neiRegion)
536 faceToInterface[facei] = regionsToInterface[
interface][zoneID];
543 label neiRegion = coupledRegion[i];
545 if (ownRegion != neiRegion)
555 min(ownRegion, neiRegion),
556 max(ownRegion, neiRegion)
559 faceToInterface[facei] = regionsToInterface[
interface][zoneID];
589 coupledRegion[i] = cellRegion[celli];
601 labelList cellsToRemove(getNonRegionCells(cellRegion, regionI));
606 labelList exposedFaces = cellRemover.getExposedFaces(cellsToRemove);
611 label facei = exposedFaces[i];
612 label interfacei = faceToInterface[facei];
615 label neiRegion = -1;
630 label otherRegion = -1;
632 if (ownRegion == regionI && neiRegion != regionI)
634 otherRegion = neiRegion;
636 else if (ownRegion != regionI && neiRegion == regionI)
638 otherRegion = ownRegion;
643 <<
"Exposed face:" << facei
645 <<
" has owner region " << ownRegion
646 <<
" and neighbour region " << neiRegion
647 <<
" when handling region:" << regionI
652 if (regionI < otherRegion)
654 exposedPatchIDs[i] = interfacePatches[interfacei];
658 exposedPatchIDs[i] = interfacePatches[interfacei]+1;
663 cellRemover.setRefinement
689 void createAndWriteRegion
694 const bool prefixRegion,
698 const word& newMeshInstance
701 Info<<
"Creating mesh for region " << regionI
719 forAll(interfacePatches, interfacei)
721 addedPatches.
insert(interfacePatches[interfacei]);
722 addedPatches.
insert(interfacePatches[interfacei]+1);
729 newMesh().updateMesh(map());
732 subsetVolFields<volScalarField>
740 subsetVolFields<volVectorField>
748 subsetVolFields<volSphericalTensorField>
756 subsetVolFields<volSymmTensorField>
764 subsetVolFields<volTensorField>
773 subsetSurfaceFields<surfaceScalarField>
781 subsetSurfaceFields<surfaceVectorField>
789 subsetSurfaceFields<surfaceSphericalTensorField>
797 subsetSurfaceFields<surfaceSymmTensorField>
805 subsetSurfaceFields<surfaceTensorField>
816 newPatches.checkParallelSync(
true);
822 labelList oldToNew(newPatches.size(), -1);
826 Info<<
"Deleting empty patches" <<
endl;
829 forAll(newPatches, patchi)
833 if (!isA<processorPolyPatch>(
pp))
837 oldToNew[patchi] = newI;
838 if (!addedPatches.
found(patchi))
840 sharedPatches.append(newI);
848 forAll(newPatches, patchi)
852 if (isA<processorPolyPatch>(
pp) &&
pp.size())
854 oldToNew[patchi] = newI++;
858 const label nNewPatches = newI;
863 if (oldToNew[patchi] == -1)
865 oldToNew[patchi] = newI++;
875 Info<<
"Prefixing patches with region name" <<
endl;
877 renamePatches(newMesh(),
regionNames[regionI], sharedPatches);
883 newMesh().setInstance(newMeshInstance);
889 Info<<
"Writing addressing to base mesh" <<
endl;
895 "pointRegionAddressing",
896 newMesh().facesInstance(),
905 Info<<
"Writing map " << pointProcAddressing.name()
906 <<
" from region" << regionI
907 <<
" points back to base mesh." <<
endl;
908 pointProcAddressing.
write();
914 "faceRegionAddressing",
915 newMesh().facesInstance(),
924 forAll(faceProcAddressing, facei)
928 label oldFacei = map().faceMap()[facei];
932 map().cellMap()[newMesh().faceOwner()[facei]]
936 faceProcAddressing[facei] = oldFacei+1;
940 faceProcAddressing[facei] = -(oldFacei+1);
943 Info<<
"Writing map " << faceProcAddressing.name()
944 <<
" from region" << regionI
945 <<
" faces back to base mesh." <<
endl;
946 faceProcAddressing.
write();
952 "cellRegionAddressing",
953 newMesh().facesInstance(),
962 Info<<
"Writing map " <<cellProcAddressing.name()
963 <<
" from region" << regionI
964 <<
" cells back to base mesh." <<
endl;
965 cellProcAddressing.
write();
971 "boundaryRegionAddressing",
972 newMesh().facesInstance(),
983 if (!addedPatches.
found(i))
985 label newI = oldToNew[i];
986 if (newI >= 0 && newI < nNewPatches)
988 boundaryProcAddressing[oldToNew[i]] = i;
992 Info<<
"Writing map " << boundaryProcAddressing.name()
993 <<
" from region" << regionI
994 <<
" boundary back to base mesh." <<
endl;
995 boundaryProcAddressing.
write();
1015 forAll(interfaces, interI)
1017 const edge&
e = interfaces[interI];
1070 <<
" " << interfacePatches[interI]
1073 <<
" " << interfacePatches[interI]+1
1077 return interfacePatches;
1082 label findCorrespondingRegion
1086 const label nCellRegions,
1088 const label minOverlapSize
1094 forAll(cellRegion, celli)
1096 if (existingZoneID[celli] == zoneI)
1098 cellsInZone[cellRegion[celli]]++;
1105 label regionI =
findMax(cellsInZone);
1108 if (cellsInZone[regionI] < minOverlapSize)
1116 forAll(cellRegion, celli)
1118 if (cellRegion[celli] == regionI && existingZoneID[celli] != zoneI)
1148 forAll(clusterToZones, clusterI)
1150 for (
const label zoneI : clusterToZones[clusterI])
1152 const cellZone& cz = cellZones[zoneI];
1156 label celli = cz[i];
1157 if (clusterID[celli] == -1)
1159 clusterID[celli] = clusterI;
1164 <<
"Cell " << celli <<
" with cell centre " 1166 <<
" is multiple zones. This is not allowed." <<
endl 1167 <<
"It is in zone " << clusterNames[clusterID[celli]]
1168 <<
" and in zone " << clusterNames[clusterI]
1183 const label regioni,
1222 clusterNames.
clear();
1223 clusterToZones.
clear();
1227 if (zoneClusters.
size())
1229 forAll(zoneClusters, clusteri)
1235 zoneClusterNames[clusteri].size()
1236 ? zoneClusterNames[clusteri]
1248 forAll(zoneToCluster, zonei)
1250 if (zoneToCluster[zonei] == -1)
1252 clusterNames.
append(cellZones[zonei].
name());
1254 zoneToCluster[zonei] = clusterToZones.
size();
1260 for (
const auto&
cellZone : cellZones)
1262 const label nClusters = clusterToZones.
size();
1273 const bool sloppyCellZones,
1280 const label nCellRegions,
1290 regionToZones.
setSize(nCellRegions);
1299 forAll(clusterToZones, clusterI)
1301 for (
const label zoneI : clusterToZones[clusterI])
1303 clusterSizes[clusterI] += cellZones[zoneI].
size();
1308 if (sloppyCellZones)
1310 Info<<
"Trying to match regions to existing cell zones;" 1311 <<
" region can be subset of cell zone." <<
nl <<
endl;
1313 forAll(clusterToZones, clusterI)
1315 label regionI = findCorrespondingRegion
1321 label(0.5*clusterSizes[clusterI])
1326 Info<<
"Sloppily matched region " << regionI
1328 <<
" to cluster " << clusterI
1329 <<
" size " << clusterSizes[clusterI]
1334 clusterToZones[clusterI]
1336 regionToZones[regionI] = clusterToZones[clusterI];
1343 Info<<
"Trying to match regions to existing cell zones." <<
nl <<
endl;
1345 forAll(clusterToZones, clusterI)
1347 label regionI = findCorrespondingRegion
1353 clusterSizes[clusterI]
1361 clusterToZones[clusterI]
1363 regionToZones[regionI] = clusterToZones[clusterI];
1377 regionToZones[regionI]
1401 cellToRegion.write();
1403 Info<<
"Writing region per cell file (for manual decomposition) to " 1404 << cellToRegion.objectPath() <<
nl <<
endl;
1423 forAll(cellRegion, celli)
1425 cellToRegion[celli] = cellRegion[celli];
1427 cellToRegion.write();
1429 Info<<
"Writing region per cell as volScalarField to " 1430 << cellToRegion.objectPath() <<
nl <<
endl;
1437 int main(
int argc,
char *argv[])
1441 "Split mesh into multiple regions (detected by walking across faces)" 1448 "Additionally split cellZones off into separate regions" 1453 "Use cellZones only to split mesh into regions; do not use walking" 1457 "cellZonesFileOnly",
1459 "Like -cellZonesOnly, but use specified file" 1465 "Combine zones in follow-on analysis" 1471 "Combine zones in follow-on analysis" 1477 "Specify additional region boundaries that walking does not cross" 1482 "Place cells into cellZones instead of splitting mesh" 1487 "Only write largest region" 1493 "Only write region containing point" 1503 "Try to match heuristically regions to existing cell zones" 1508 "Use faceZones to patch inter-region faces instead of single patch" 1513 "Prefix region name to all patches, not just coupling patches" 1524 word blockedFacesName;
1527 Info<<
"Reading blocked internal faces from faceSet " 1528 << blockedFacesName <<
nl <<
endl;
1531 const bool makeCellZones =
args.
found(
"makeCellZones");
1532 const bool largestOnly =
args.
found(
"largestOnly");
1533 const bool insidePoint =
args.
found(
"insidePoint");
1534 const bool useCellZones =
args.
found(
"cellZones");
1535 const bool useCellZonesOnly =
args.
found(
"cellZonesOnly");
1536 const bool useCellZonesFile =
args.
found(
"cellZonesFileOnly");
1537 const bool combineZones =
args.
found(
"combineZones");
1538 const bool addZones =
args.
found(
"addZones");
1539 const bool overwrite =
args.
found(
"overwrite");
1540 const bool detectOnly =
args.
found(
"detectOnly");
1541 const bool sloppyCellZones =
args.
found(
"sloppyCellZones");
1542 const bool useFaceZones =
args.
found(
"useFaceZones");
1543 const bool prefixRegion =
args.
found(
"prefixRegion");
1548 (useCellZonesOnly || useCellZonesFile)
1549 && (useCellZones || blockedFacesName.size())
1553 <<
"You cannot specify both -cellZonesOnly or -cellZonesFileOnly" 1554 <<
" (which specify complete split)" 1555 <<
" in combination with -blockedFaces or -cellZones" 1556 <<
" (which imply a split based on topology)" 1563 Info<<
"Using current faceZones to divide inter-region interfaces" 1564 <<
" into multiple patches." 1569 Info<<
"Creating single patch per inter-region interface." 1575 if (insidePoint && largestOnly)
1578 <<
"You cannot specify both -largestOnly" 1579 <<
" (keep region with most cells)" 1580 <<
" and -insidePoint (keep region containing point)" 1595 <<
"Cannot specify both combineZones and addZones" 1605 forAll(zoneClusters, clusteri)
1609 wordRes& wrs = zoneClusters[clusteri];
1611 zoneClusterNames[clusteri] = wrs[0];
1613 for (label i = 1; i < wrs.
size(); i++)
1634 label nCellRegions = 0;
1635 if (useCellZonesOnly)
1637 Info<<
"Using current cellZones to split mesh into regions." 1638 <<
" This requires all" 1639 <<
" cells to be in one and only one cellZone." <<
nl <<
endl;
1670 label unzonedCelli = clusterID.
find(-1);
1671 if (unzonedCelli != -1)
1674 <<
"For the cellZonesOnly option all cells " 1675 <<
"have to be in a cellZone." <<
endl 1676 <<
"Cell " << unzonedCelli
1678 <<
" is not in a cellZone. There might be more unzoned cells." 1681 cellRegion = clusterID;
1682 nCellRegions =
gMax(cellRegion)+1;
1683 zoneToRegion = zoneToCluster;
1684 regionToZones = clusterToZones;
1687 else if (useCellZonesFile)
1689 const word zoneFile(
args[
"cellZonesFileOnly"]);
1690 Info<<
"Reading split from cellZones file " << zoneFile <<
endl 1691 <<
"This requires all" 1692 <<
" cells to be in one and only one cellZone." <<
nl <<
endl;
1738 label unzonedCelli = clusterID.find(-1);
1739 if (unzonedCelli != -1)
1742 <<
"For the cellZonesFileOnly option all cells " 1743 <<
"have to be in a cellZone." <<
endl 1744 <<
"Cell " << unzonedCelli
1746 <<
" is not in a cellZone. There might be more unzoned cells." 1749 cellRegion = clusterID;
1750 nCellRegions =
gMax(cellRegion)+1;
1751 zoneToRegion = zoneToCluster;
1752 regionToZones = clusterToZones;
1764 if (blockedFacesName.size())
1769 <<
" blocked faces from set " << blockedFacesName <<
nl <<
endl;
1773 for (
const label facei : blockedFaceSet)
1775 blockedFace[facei] =
true;
1819 if (ownCluster != neiCluster)
1821 blockedFace[facei] =
true;
1830 label neiCluster = neiClusterID[i];
1832 if (ownCluster != neiCluster)
1834 blockedFace[facei] =
true;
1841 nCellRegions = regions.nRegions();
1866 if (largestOnly || insidePoint)
1868 forAll(regionToZones, regionI)
1870 if (regionToZones[regionI].empty())
1876 else if (insidePoint)
1880 else if (largestOnly)
1889 Info<<
endl <<
"Number of regions:" << nCellRegions <<
nl <<
endl;
1893 writeCellToRegion(
mesh, cellRegion);
1902 forAll(cellRegion, celli)
1904 regionSizes[cellRegion[celli]]++;
1906 forAll(regionSizes, regionI)
1911 Info<<
"Region\tCells" <<
nl 1912 <<
"------\t-----" <<
endl;
1914 forAll(regionSizes, regionI)
1916 Info<< regionI <<
'\t' << regionSizes[regionI] <<
nl;
1923 Info<<
"Region\tZone\tName" <<
nl 1924 <<
"------\t----\t----" <<
endl;
1925 forAll(regionToZones, regionI)
1966 Info<<
"Sizes of interfaces between regions:" <<
nl <<
nl 1967 <<
"Interface\tRegion\tRegion\tFaces" <<
nl 1968 <<
"---------\t------\t------\t-----" <<
endl;
1970 forAll(interfaces, interI)
1972 const edge&
e = interfaces[interI];
1975 <<
"\t\t" <<
e[0] <<
"\t" <<
e[1]
1976 <<
"\t" << interfaceSizes[interI] <<
nl;
2035 if (nCellRegions == 1)
2037 Info<<
"Only one region. Doing nothing." <<
endl;
2039 else if (makeCellZones)
2041 Info<<
"Putting cells into cellZones instead of splitting mesh." 2046 for (label regionI = 0; regionI < nCellRegions; regionI++)
2048 const labelList& zones = regionToZones[regionI];
2050 if (zones.
size() == 1 && zones[0] != -1)
2053 const label zoneI = zones[0];
2054 Info<<
" Region " << regionI <<
" : corresponds to existing" 2077 std::move(regionCells),
2088 Info<<
" Region " << regionI <<
" : created new cellZone " 2113 Info<<
"Writing cellSets corresponding to cellZones." <<
nl <<
endl;
2159 Info<<
nl <<
"Found point " << insidePoint <<
" in cell " << celli
2164 regionI = cellRegion[celli];
2170 <<
"Subsetting region " << regionI
2171 <<
" containing point " << insidePoint <<
endl;
2176 <<
"Point " << insidePoint
2177 <<
" is not inside the mesh." <<
nl 2178 <<
"Bounding box of the mesh:" <<
mesh.
bounds()
2182 createAndWriteRegion
2194 else if (largestOnly)
2196 label regionI =
findMax(regionSizes);
2199 <<
"Subsetting region " << regionI
2200 <<
" of size " << regionSizes[regionI]
2203 createAndWriteRegion
2218 for (label regionI = 0; regionI < nCellRegions; regionI++)
2221 <<
"Region " << regionI <<
nl 2222 <<
"-------- " <<
endl;
2224 createAndWriteRegion
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all zones and in same order.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
void clearOut()
Clear all geometry and addressing.
label findMax(const ListType &input, label start=0)
Linear search for the index of the max element, similar to std::max_element but for lists and returns...
static tmp< DimensionedField< Type, volMesh > > interpolate(const DimensionedField< Type, volMesh > &, const fvMesh &sMesh, const labelUList &cellMap)
Map volume internal (dimensioned) field.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addNote(const string ¬e)
Add extra notes for the usage information.
void size(const label n)
Older name for setAddressableSize.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
const labelIOList & zoneIDs
void clearAddressing()
Clear addressing.
"blocking" : (MPI_Bsend, MPI_Recv)
nearest face on selected patch
List< word > names(const UPtrList< T > &list, const UnaryMatchPredicate &matcher)
List of names generated by calling name() for each list item and filtered for matches.
wordList ReadFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh >> &fields, const bool syncPar=true, const bool readOldTime=false)
Read Geometric fields of templated type.
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable, so the various sorted methods should be used if traversing in parallel.
errorManipArg< error, int > exit(error &err, const int errNo=1)
const fileName & facesInstance() const
Return the current instance directory for faces.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
bool found(const Key &key) const
Same as contains()
virtual const labelList & faceNeighbour() const
Return face neighbour.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
const word & name() const noexcept
Return the object name.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
constexpr char nl
The newline '\n' character (0x0a)
bool empty() const noexcept
True if List is empty (ie, size() is zero)
Given list of cells to remove, insert all the topology changes.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
interfaceProperties interface(alpha1, U, thermo->transportPropertiesDict())
Field reading functions for post-processing utilities.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
const Time & time() const
Return the top-level database.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
label nFaces() const noexcept
Number of mesh faces.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
static void broadcast(Type &value, const label comm=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
#define forAll(list, i)
Loop across all elements in list.
Input inter-processor communications stream.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
writeOption writeOpt() const noexcept
Get the write option.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
const dimensionedScalar e
Elementary charge.
const fileName & pointsInstance() const
Return the current instance directory for points.
void setSize(const label n)
Alias for resize()
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
labelList indices(const wordRe &matcher, const bool useGroups=true) const
Return (sorted) zone indices for all matches.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
void clear()
Clear the list, i.e. set size to zero.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
A class for handling words, derived from Foam::string.
iterator find(const edge &key)
Find and return an iterator set at the hashed entry.
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
static word defaultRegion
Return the default region name.
static constexpr int masterNo() noexcept
Relative rank for the master process - is always 0.
label size() const noexcept
The number of entries in the list.
virtual const labelList & faceOwner() const
Return face owner.
Reading is optional [identical to LAZY_READ].
static const word null
An empty word.
A List of wordRe with additional matching capabilities.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
label nInternalFaces() const noexcept
Number of internal faces.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
const vectorField & cellCentres() const
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
label find(const T &val) const
Find index of the first occurrence of the value.
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
label index() const noexcept
The index of this zone in the zone list.
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
Map from edge (expressed as its endpoints) to value. Hashing (and ==) on an edge is symmetric...
void updateMesh()
Correct polyBoundaryMesh after topology update.
Type gMax(const FieldField< Field, Type > &f)
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
Output inter-processor communications stream.
void setSize(const label newLen)
Same as resize()
static void broadcasts(const label comm, Type &arg1, Args &&... args)
Broadcast multiple items to all communicator ranks. Does nothing in non-parallel. ...
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
label whichZone(const label objectIndex) const
Given a global object index, return the zone it is in.
const vectorField & faceCentres() const
T get(const label index) const
Get a value from the argument at index.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
#define WarningInFunction
Report a warning using Foam::Warning.
const word & name() const
Return reference to name.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
label nCells() const noexcept
Number of mesh cells.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
A collection of cell labels.
Mesh data needed to do the Finite Volume discretisation.
A List with indirect addressing. Like IndirectList but does not store addressing. ...
Direct mesh changes based on v1.3 polyTopoChange syntax.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
const word & name() const noexcept
The zone name.
static const word & calculatedType() noexcept
The type name for calculated patch fields.
Automatically write from objectRegistry::writeObject()
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
label findCell(const point &p, const cellDecomposition=CELL_TETS) const
Find cell enclosing this location and return index.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const boundBox & bounds() const noexcept
Return mesh bounding box.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Mesh consisting of general polyhedral cells.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
List< label > labelList
A List of labels.
static rangeType subProcs(const label communicator=worldComm)
Range of process indices for sub-processes.
A class for managing temporary objects.
A patch is a list of labels that address the faces in the global face list.
label nBoundaryFaces() const noexcept
Number of boundary faces (== nFaces - nInternalFaces)
Foam::argList args(argc, argv)
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Do not request registration (bool: false)
bool found(const word &optName) const
Return true if the named option is found.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
forAllConstIters(mixture.phases(), phase)
static void listCombineReduce(List< T > &values, const CombineOp &cop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
After completion all processors have the same data.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
static constexpr const zero Zero
Global zero (0)