120 using namespace Foam;
134 forAll(patchesToRename, i)
136 label patchi = patchesToRename[i];
139 if (isA<coupledPolyPatch>(pp))
142 <<
"Encountered coupled patch " << pp.
name()
143 <<
". Will only rename the patch itself," 144 <<
" not any referred patches." 145 <<
" This might have to be done by hand." 149 pp.
name() = prefix +
'_' + pp.
name();
156 template<
class GeoField>
170 mesh.objectRegistry::lookupClass<GeoField>()
174 const GeoField&
fld = *iter.val();
192 forAll(tSubFld().boundaryField(), patchi)
194 if (addedPatches.
found(patchi))
196 tSubFld.ref().boundaryFieldRef()[patchi] ==
197 typename GeoField::value_type(
Zero);
202 GeoField* subFld = tSubFld.ptr();
203 subFld->rename(
fld.name());
210 template<
class GeoField>
211 void subsetSurfaceFields
224 mesh.objectRegistry::lookupClass<GeoField>()
228 const GeoField&
fld = *iter.val();
246 forAll(tSubFld().boundaryField(), patchi)
248 if (addedPatches.
found(patchi))
250 tSubFld.ref().boundaryFieldRef()[patchi] ==
251 typename GeoField::value_type(
Zero);
256 GeoField* subFld = tSubFld.ptr();
257 subFld->rename(
fld.name());
269 if (cellRegion[celli] != regionI)
271 nonRegionCells.append(celli);
274 return nonRegionCells.shrink();
282 const label ownRegion,
283 const label neiRegion,
289 min(ownRegion, neiRegion),
290 max(ownRegion, neiRegion)
298 auto zoneIter = iter().find(zoneID);
299 if (zoneIter.found())
307 iter().insert(zoneID, 1);
314 zoneToSize.
insert(zoneID, 1);
322 void getInterfaceSizes
325 const bool useFaceZones,
348 if (ownRegion != neiRegion)
370 coupledRegion[i] = cellRegion[celli];
378 label neiRegion = coupledRegion[i];
380 if (ownRegion != neiRegion)
409 auto masterIter = regionsToSize.
find(slaveIter.key());
411 if (masterIter.found())
418 const label zoneID = iter.key();
419 const label slaveSize = iter.val();
421 auto zoneIter = masterInfo.
find(zoneID);
422 if (zoneIter.found())
424 *zoneIter += slaveSize;
428 masterInfo.
insert(zoneID, slaveSize);
434 regionsToSize.
insert(slaveIter.key(), slaveInfo);
448 toMaster << regionsToSize;
460 label nInterfaces = 0;
464 nInterfaces += info.
size();
467 interfaces.
setSize(nInterfaces);
468 interfaceNames.
setSize(nInterfaces);
469 interfaceSizes.
setSize(nInterfaces);
475 const edge&
e = iter.key();
483 interfaces[nInterfaces] = iter.key();
484 label zoneID = infoIter.key();
489 name0 +
"_to_" + name1,
490 name1 +
"_to_" + name0
498 zoneName +
"_" + name0 +
"_to_" + name1,
499 zoneName +
"_" + name1 +
"_to_" + name0
502 interfaceSizes[nInterfaces] = infoIter();
504 if (regionsToInterface.found(
e))
506 regionsToInterface[
e].insert(zoneID, nInterfaces);
511 zoneAndInterface.
insert(zoneID, nInterfaces);
512 regionsToInterface.insert(
e, zoneAndInterface);
537 if (ownRegion != neiRegion)
547 min(ownRegion, neiRegion),
548 max(ownRegion, neiRegion)
551 faceToInterface[facei] = regionsToInterface[
interface][zoneID];
558 label neiRegion = coupledRegion[i];
560 if (ownRegion != neiRegion)
570 min(ownRegion, neiRegion),
571 max(ownRegion, neiRegion)
574 faceToInterface[facei] = regionsToInterface[
interface][zoneID];
604 coupledRegion[i] = cellRegion[celli];
616 labelList cellsToRemove(getNonRegionCells(cellRegion, regionI));
621 labelList exposedFaces = cellRemover.getExposedFaces(cellsToRemove);
626 label facei = exposedFaces[i];
627 label interfacei = faceToInterface[facei];
630 label neiRegion = -1;
645 label otherRegion = -1;
647 if (ownRegion == regionI && neiRegion != regionI)
649 otherRegion = neiRegion;
651 else if (ownRegion != regionI && neiRegion == regionI)
653 otherRegion = ownRegion;
658 <<
"Exposed face:" << facei
660 <<
" has owner region " << ownRegion
661 <<
" and neighbour region " << neiRegion
662 <<
" when handling region:" << regionI
667 if (regionI < otherRegion)
669 exposedPatchIDs[i] = interfacePatches[interfacei];
673 exposedPatchIDs[i] = interfacePatches[interfacei]+1;
678 cellRemover.setRefinement
704 void createAndWriteRegion
709 const bool prefixRegion,
713 const word& newMeshInstance
716 Info<<
"Creating mesh for region " << regionI
734 forAll(interfacePatches, interfacei)
736 addedPatches.
insert(interfacePatches[interfacei]);
737 addedPatches.
insert(interfacePatches[interfacei]+1);
744 newMesh().updateMesh(map());
747 subsetVolFields<volScalarField>
755 subsetVolFields<volVectorField>
763 subsetVolFields<volSphericalTensorField>
771 subsetVolFields<volSymmTensorField>
779 subsetVolFields<volTensorField>
788 subsetSurfaceFields<surfaceScalarField>
796 subsetSurfaceFields<surfaceVectorField>
804 subsetSurfaceFields<surfaceSphericalTensorField>
812 subsetSurfaceFields<surfaceSymmTensorField>
820 subsetSurfaceFields<surfaceTensorField>
831 newPatches.checkParallelSync(
true);
837 labelList oldToNew(newPatches.size(), -1);
841 Info<<
"Deleting empty patches" <<
endl;
844 forAll(newPatches, patchi)
846 const polyPatch& pp = newPatches[patchi];
848 if (!isA<processorPolyPatch>(pp))
852 oldToNew[patchi] = newI;
853 if (!addedPatches.
found(patchi))
855 sharedPatches.append(newI);
863 forAll(newPatches, patchi)
865 const polyPatch& pp = newPatches[patchi];
867 if (isA<processorPolyPatch>(pp) && pp.size())
869 oldToNew[patchi] = newI++;
873 const label nNewPatches = newI;
878 if (oldToNew[patchi] == -1)
880 oldToNew[patchi] = newI++;
890 Info<<
"Prefixing patches with region name" <<
endl;
892 renamePatches(newMesh(),
regionNames[regionI], sharedPatches);
898 newMesh().setInstance(newMeshInstance);
904 Info<<
"Writing addressing to base mesh" <<
endl;
910 "pointRegionAddressing",
911 newMesh().facesInstance(),
912 newMesh().meshSubDir,
920 Info<<
"Writing map " << pointProcAddressing.name()
921 <<
" from region" << regionI
922 <<
" points back to base mesh." <<
endl;
923 pointProcAddressing.
write();
929 "faceRegionAddressing",
930 newMesh().facesInstance(),
931 newMesh().meshSubDir,
939 forAll(faceProcAddressing, facei)
943 label oldFacei = map().faceMap()[facei];
947 map().cellMap()[newMesh().faceOwner()[facei]]
951 faceProcAddressing[facei] = oldFacei+1;
955 faceProcAddressing[facei] = -(oldFacei+1);
958 Info<<
"Writing map " << faceProcAddressing.name()
959 <<
" from region" << regionI
960 <<
" faces back to base mesh." <<
endl;
961 faceProcAddressing.
write();
967 "cellRegionAddressing",
968 newMesh().facesInstance(),
969 newMesh().meshSubDir,
977 Info<<
"Writing map " <<cellProcAddressing.name()
978 <<
" from region" << regionI
979 <<
" cells back to base mesh." <<
endl;
980 cellProcAddressing.
write();
986 "boundaryRegionAddressing",
987 newMesh().facesInstance(),
988 newMesh().meshSubDir,
998 if (!addedPatches.
found(i))
1000 label newI = oldToNew[i];
1001 if (newI >= 0 && newI < nNewPatches)
1003 boundaryProcAddressing[oldToNew[i]] = i;
1007 Info<<
"Writing map " << boundaryProcAddressing.name()
1008 <<
" from region" << regionI
1009 <<
" boundary back to base mesh." <<
endl;
1010 boundaryProcAddressing.
write();
1030 forAll(interfaces, interI)
1032 const edge&
e = interfaces[interI];
1085 <<
" " << interfacePatches[interI]
1088 <<
" " << interfacePatches[interI]+1
1092 return interfacePatches;
1097 label findCorrespondingRegion
1101 const label nCellRegions,
1103 const label minOverlapSize
1109 forAll(cellRegion, celli)
1111 if (existingZoneID[celli] == zoneI)
1113 cellsInZone[cellRegion[celli]]++;
1120 label regionI =
findMax(cellsInZone);
1123 if (cellsInZone[regionI] < minOverlapSize)
1131 forAll(cellRegion, celli)
1133 if (cellRegion[celli] == regionI && existingZoneID[celli] != zoneI)
1163 forAll(clusterToZones, clusterI)
1165 for (
const label zoneI : clusterToZones[clusterI])
1167 const cellZone& cz = cellZones[zoneI];
1171 label celli = cz[i];
1172 if (clusterID[celli] == -1)
1174 clusterID[celli] = clusterI;
1179 <<
"Cell " << celli <<
" with cell centre " 1181 <<
" is multiple zones. This is not allowed." <<
endl 1182 <<
"It is in zone " << clusterNames[clusterID[celli]]
1183 <<
" and in zone " << clusterNames[clusterI]
1198 const label regioni,
1237 clusterNames.
clear();
1238 clusterToZones.
clear();
1242 if (zoneClusters.
size())
1244 forAll(zoneClusters, clusteri)
1250 zoneClusterNames[clusteri].size()
1251 ? zoneClusterNames[clusteri]
1263 forAll(zoneToCluster, zonei)
1265 if (zoneToCluster[zonei] == -1)
1267 clusterNames.
append(cellZones[zonei].
name());
1269 zoneToCluster[zonei] = clusterToZones.
size();
1275 for (
const auto&
cellZone : cellZones)
1277 const label nClusters = clusterToZones.
size();
1288 const bool sloppyCellZones,
1295 const label nCellRegions,
1305 regionToZones.
setSize(nCellRegions);
1314 forAll(clusterToZones, clusterI)
1316 for (
const label zoneI : clusterToZones[clusterI])
1318 clusterSizes[clusterI] += cellZones[zoneI].
size();
1323 if (sloppyCellZones)
1325 Info<<
"Trying to match regions to existing cell zones;" 1326 <<
" region can be subset of cell zone." <<
nl <<
endl;
1328 forAll(clusterToZones, clusterI)
1330 label regionI = findCorrespondingRegion
1336 label(0.5*clusterSizes[clusterI])
1341 Info<<
"Sloppily matched region " << regionI
1343 <<
" to cluster " << clusterI
1344 <<
" size " << clusterSizes[clusterI]
1349 clusterToZones[clusterI]
1351 regionToZones[regionI] = clusterToZones[clusterI];
1358 Info<<
"Trying to match regions to existing cell zones." <<
nl <<
endl;
1360 forAll(clusterToZones, clusterI)
1362 label regionI = findCorrespondingRegion
1368 clusterSizes[clusterI]
1376 clusterToZones[clusterI]
1378 regionToZones[regionI] = clusterToZones[clusterI];
1392 regionToZones[regionI]
1416 cellToRegion.write();
1418 Info<<
"Writing region per cell file (for manual decomposition) to " 1419 << cellToRegion.objectPath() <<
nl <<
endl;
1436 zeroGradientFvPatchScalarField::typeName
1438 forAll(cellRegion, celli)
1440 cellToRegion[celli] = cellRegion[celli];
1442 cellToRegion.write();
1444 Info<<
"Writing region per cell as volScalarField to " 1445 << cellToRegion.objectPath() <<
nl <<
endl;
1452 int main(
int argc,
char *argv[])
1456 "Split mesh into multiple regions (detected by walking across faces)" 1463 "Additionally split cellZones off into separate regions" 1468 "Use cellZones only to split mesh into regions; do not use walking" 1472 "cellZonesFileOnly",
1474 "Like -cellZonesOnly, but use specified file" 1480 "Combine zones in follow-on analysis" 1486 "Combine zones in follow-on analysis" 1492 "Specify additional region boundaries that walking does not cross" 1497 "Place cells into cellZones instead of splitting mesh" 1502 "Only write largest region" 1508 "Only write region containing point" 1518 "Try to match heuristically regions to existing cell zones" 1523 "Use faceZones to patch inter-region faces instead of single patch" 1528 "Prefix region name to all patches, not just coupling patches" 1539 word blockedFacesName;
1542 Info<<
"Reading blocked internal faces from faceSet " 1543 << blockedFacesName <<
nl <<
endl;
1546 const bool makeCellZones =
args.
found(
"makeCellZones");
1547 const bool largestOnly =
args.
found(
"largestOnly");
1548 const bool insidePoint =
args.
found(
"insidePoint");
1549 const bool useCellZones =
args.
found(
"cellZones");
1550 const bool useCellZonesOnly =
args.
found(
"cellZonesOnly");
1551 const bool useCellZonesFile =
args.
found(
"cellZonesFileOnly");
1552 const bool combineZones =
args.
found(
"combineZones");
1553 const bool addZones =
args.
found(
"addZones");
1554 const bool overwrite =
args.
found(
"overwrite");
1555 const bool detectOnly =
args.
found(
"detectOnly");
1556 const bool sloppyCellZones =
args.
found(
"sloppyCellZones");
1557 const bool useFaceZones =
args.
found(
"useFaceZones");
1558 const bool prefixRegion =
args.
found(
"prefixRegion");
1563 (useCellZonesOnly || useCellZonesFile)
1564 && (useCellZones || blockedFacesName.size())
1568 <<
"You cannot specify both -cellZonesOnly or -cellZonesFileOnly" 1569 <<
" (which specify complete split)" 1570 <<
" in combination with -blockedFaces or -cellZones" 1571 <<
" (which imply a split based on topology)" 1578 Info<<
"Using current faceZones to divide inter-region interfaces" 1579 <<
" into multiple patches." 1584 Info<<
"Creating single patch per inter-region interface." 1590 if (insidePoint && largestOnly)
1593 <<
"You cannot specify both -largestOnly" 1594 <<
" (keep region with most cells)" 1595 <<
" and -insidePoint (keep region containing point)" 1610 <<
"Cannot specify both combineZones and addZones" 1620 forAll(zoneClusters, clusteri)
1624 wordRes& wrs = zoneClusters[clusteri];
1626 zoneClusterNames[clusteri] = wrs[0];
1628 for (label i = 1; i < wrs.
size(); i++)
1649 label nCellRegions = 0;
1650 if (useCellZonesOnly)
1652 Info<<
"Using current cellZones to split mesh into regions." 1653 <<
" This requires all" 1654 <<
" cells to be in one and only one cellZone." <<
nl <<
endl;
1685 label unzonedCelli = clusterID.
find(-1);
1686 if (unzonedCelli != -1)
1689 <<
"For the cellZonesOnly option all cells " 1690 <<
"have to be in a cellZone." <<
endl 1691 <<
"Cell " << unzonedCelli
1693 <<
" is not in a cellZone. There might be more unzoned cells." 1696 cellRegion = clusterID;
1697 nCellRegions =
gMax(cellRegion)+1;
1698 zoneToRegion = zoneToCluster;
1699 regionToZones = clusterToZones;
1702 else if (useCellZonesFile)
1704 const word zoneFile(
args[
"cellZonesFileOnly"]);
1705 Info<<
"Reading split from cellZones file " << zoneFile <<
endl 1706 <<
"This requires all" 1707 <<
" cells to be in one and only one cellZone." <<
nl <<
endl;
1753 label unzonedCelli = clusterID.find(-1);
1754 if (unzonedCelli != -1)
1757 <<
"For the cellZonesFileOnly option all cells " 1758 <<
"have to be in a cellZone." <<
endl 1759 <<
"Cell " << unzonedCelli
1761 <<
" is not in a cellZone. There might be more unzoned cells." 1764 cellRegion = clusterID;
1765 nCellRegions =
gMax(cellRegion)+1;
1766 zoneToRegion = zoneToCluster;
1767 regionToZones = clusterToZones;
1779 if (blockedFacesName.size())
1784 <<
" blocked faces from set " << blockedFacesName <<
nl <<
endl;
1788 for (
const label facei : blockedFaceSet)
1790 blockedFace[facei] =
true;
1834 if (ownCluster != neiCluster)
1836 blockedFace[facei] =
true;
1845 label neiCluster = neiClusterID[i];
1847 if (ownCluster != neiCluster)
1849 blockedFace[facei] =
true;
1856 nCellRegions = regions.nRegions();
1881 if (largestOnly || insidePoint)
1883 forAll(regionToZones, regionI)
1885 if (regionToZones[regionI].empty())
1891 else if (insidePoint)
1895 else if (largestOnly)
1904 Info<<
endl <<
"Number of regions:" << nCellRegions <<
nl <<
endl;
1908 writeCellToRegion(
mesh, cellRegion);
1917 forAll(cellRegion, celli)
1919 regionSizes[cellRegion[celli]]++;
1921 forAll(regionSizes, regionI)
1926 Info<<
"Region\tCells" <<
nl 1927 <<
"------\t-----" <<
endl;
1929 forAll(regionSizes, regionI)
1931 Info<< regionI <<
'\t' << regionSizes[regionI] <<
nl;
1938 Info<<
"Region\tZone\tName" <<
nl 1939 <<
"------\t----\t----" <<
endl;
1940 forAll(regionToZones, regionI)
1981 Info<<
"Sizes of interfaces between regions:" <<
nl <<
nl 1982 <<
"Interface\tRegion\tRegion\tFaces" <<
nl 1983 <<
"---------\t------\t------\t-----" <<
endl;
1985 forAll(interfaces, interI)
1987 const edge&
e = interfaces[interI];
1990 <<
"\t\t" <<
e[0] <<
"\t" <<
e[1]
1991 <<
"\t" << interfaceSizes[interI] <<
nl;
2050 if (nCellRegions == 1)
2052 Info<<
"Only one region. Doing nothing." <<
endl;
2054 else if (makeCellZones)
2056 Info<<
"Putting cells into cellZones instead of splitting mesh." 2061 for (label regionI = 0; regionI < nCellRegions; regionI++)
2063 const labelList& zones = regionToZones[regionI];
2065 if (zones.
size() == 1 && zones[0] != -1)
2068 const label zoneI = zones[0];
2069 Info<<
" Region " << regionI <<
" : corresponds to existing" 2092 std::move(regionCells),
2103 Info<<
" Region " << regionI <<
" : created new cellZone " 2128 Info<<
"Writing cellSets corresponding to cellZones." <<
nl <<
endl;
2174 Info<<
nl <<
"Found point " << insidePoint <<
" in cell " << celli
2179 regionI = cellRegion[celli];
2185 <<
"Subsetting region " << regionI
2186 <<
" containing point " << insidePoint <<
endl;
2191 <<
"Point " << insidePoint
2192 <<
" is not inside the mesh." <<
nl 2193 <<
"Bounding box of the mesh:" <<
mesh.
bounds()
2197 createAndWriteRegion
2209 else if (largestOnly)
2211 label regionI =
findMax(regionSizes);
2214 <<
"Subsetting region " << regionI
2215 <<
" of size " << regionSizes[regionI]
2218 createAndWriteRegion
2233 for (label regionI = 0; regionI < nCellRegions; regionI++)
2236 <<
"Region " << regionI <<
nl 2237 <<
"-------- " <<
endl;
2239 createAndWriteRegion
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
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.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
bool found(const Key &key) const
True if hashed key is found in table.
virtual const labelList & faceNeighbour() const
Return face neighbour.
const labelIOList & tetBasePtIs() const
Return the tetBasePtIs.
const word & name() const noexcept
Return the object name.
virtual bool write(const bool valid=true) const
Write mesh using IO settings from time.
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 the UList 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())
label size() const noexcept
The number of elements in table.
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
Default world communicator (all processors). May differ from globalComm 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 processes in communicator.
multivariateSurfaceInterpolationScheme< scalar >::fieldTable fields
#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.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Foam::word regionName(Foam::polyMesh::defaultRegion)
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 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 point labels. The functionality it provides supports the discretisation on a...
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i)
void clear()
Clear the list, i.e. set size to zero.
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
Process index of the master (always 0)
label size() const noexcept
The number of elements in the list.
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
virtual const labelList & faceOwner() const
Return face owner.
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.
A HashTable similar to std::unordered_map.
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...
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
const word & name() const noexcept
The patch name.
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 time name of given scalar time formatted with the given precision.
Map from edge (expressed as its endpoints) to value. For easier forward declaration it is currently i...
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 processes in communicator.
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
const boundBox & bounds() const
Return mesh bounding box.
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.
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)
Am I the master rank.
const word & name() const noexcept
The zone name.
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)
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...
bool found(const word &optName) const
Return true if the named option is found.
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)