133 forAll(patchesToRename, i)
135 label patchi = patchesToRename[i];
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();
155template<
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());
202template<
class GeoField>
203void 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 labelList(std::move(nonRegionCells));
267 const label ownRegion,
268 const label neiRegion,
279 auto zoneIter = iter().find(zoneID);
288 iter().insert(zoneID, 1);
301void getInterfaceSizes
304 const bool useFaceZones,
309 List<Pair<word>>& interfaceNames,
324 label ownRegion = cellRegion[
mesh.faceOwner()[facei]];
325 label neiRegion = cellRegion[
mesh.faceNeighbour()[facei]];
327 if (ownRegion != neiRegion)
332 (useFaceZones ?
mesh.faceZones().whichZone(facei) : -1),
348 label celli =
mesh.faceOwner()[i+
mesh.nInternalFaces()];
349 coupledRegion[i] = cellRegion[celli];
355 label facei = i+
mesh.nInternalFaces();
356 label ownRegion = cellRegion[
mesh.faceOwner()[facei]];
357 label neiRegion = coupledRegion[i];
359 if (ownRegion != neiRegion)
364 (useFaceZones ?
mesh.faceZones().whichZone(facei) : -1),
387 auto masterIter = regionsToSize.
find(slaveIter.key());
389 if (masterIter.good())
396 const label zoneID = iter.key();
397 const label slaveSize = iter.val();
399 auto zoneIter = masterInfo.
find(zoneID);
402 *zoneIter += slaveSize;
406 masterInfo.
insert(zoneID, slaveSize);
412 regionsToSize.
insert(slaveIter.key(), slaveInfo);
431 label nInterfaces = 0;
435 nInterfaces += info.
size();
438 interfaces.
setSize(nInterfaces);
439 interfaceNames.
setSize(nInterfaces);
440 interfaceSizes.
setSize(nInterfaces);
446 const edge&
e = iter.key();
454 interfaces[nInterfaces] = iter.key();
455 label zoneID = infoIter.key();
458 interfaceNames[nInterfaces] = Pair<word>
460 name0 +
"_to_" + name1,
461 name1 +
"_to_" + name0
466 const word& zoneName =
mesh.faceZones()[zoneID].name();
467 interfaceNames[nInterfaces] = Pair<word>
469 zoneName +
"_" + name0 +
"_to_" + name1,
470 zoneName +
"_" + name1 +
"_to_" + name0
474 interfaceSizes[nInterfaces] = infoIter();
475 regionsToInterface(
e).insert(zoneID, nInterfaces);
497 label ownRegion = cellRegion[
mesh.faceOwner()[facei]];
498 label neiRegion = cellRegion[
mesh.faceNeighbour()[facei]];
500 if (ownRegion != neiRegion)
507 zoneID =
mesh.faceZones().whichZone(facei);
510 faceToInterface[facei] = regionsToInterface[
interface][zoneID];
515 label facei = i+
mesh.nInternalFaces();
516 label ownRegion = cellRegion[
mesh.faceOwner()[facei]];
517 label neiRegion = coupledRegion[i];
519 if (ownRegion != neiRegion)
526 zoneID =
mesh.faceZones().whichZone(facei);
529 faceToInterface[facei] = regionsToInterface[
interface][zoneID];
558 label celli =
mesh.faceOwner()[i+
mesh.nInternalFaces()];
559 coupledRegion[i] = cellRegion[celli];
571 labelList cellsToRemove(getNonRegionCells(cellRegion, regionI));
576 labelList exposedFaces = cellRemover.getExposedFaces(cellsToRemove);
581 label facei = exposedFaces[i];
582 label interfacei = faceToInterface[facei];
584 label ownRegion = cellRegion[
mesh.faceOwner()[facei]];
585 label neiRegion = -1;
587 if (
mesh.isInternalFace(facei))
589 neiRegion = cellRegion[
mesh.faceNeighbour()[facei]];
593 neiRegion = coupledRegion[facei-
mesh.nInternalFaces()];
600 label otherRegion = -1;
602 if (ownRegion == regionI && neiRegion != regionI)
604 otherRegion = neiRegion;
606 else if (ownRegion != regionI && neiRegion == regionI)
608 otherRegion = ownRegion;
613 <<
"Exposed face:" << facei
614 <<
" fc:" <<
mesh.faceCentres()[facei]
615 <<
" has owner region " << ownRegion
616 <<
" and neighbour region " << neiRegion
617 <<
" when handling region:" << regionI
622 if (regionI < otherRegion)
624 exposedPatchIDs[i] = interfacePatches[interfacei];
628 exposedPatchIDs[i] = interfacePatches[interfacei]+1;
633 cellRemover.setRefinement
647 mesh.time().timeName(),
659void createAndWriteRegion
664 const bool prefixRegion,
668 const word& newMeshInstance
671 Info<<
"Creating mesh for region " << regionI
689 forAll(interfacePatches, interfacei)
691 addedPatches.
insert(interfacePatches[interfacei]);
692 addedPatches.
insert(interfacePatches[interfacei]+1);
699 newMesh().updateMesh(map());
702 subsetVolFields<volScalarField>
710 subsetVolFields<volVectorField>
718 subsetVolFields<volSphericalTensorField>
726 subsetVolFields<volSymmTensorField>
734 subsetVolFields<volTensorField>
743 subsetSurfaceFields<surfaceScalarField>
751 subsetSurfaceFields<surfaceVectorField>
759 subsetSurfaceFields<surfaceSphericalTensorField>
767 subsetSurfaceFields<surfaceSymmTensorField>
775 subsetSurfaceFields<surfaceTensorField>
796 Info<<
"Deleting empty patches" <<
endl;
799 forAll(newPatches, patchi)
807 oldToNew[patchi] = newI;
808 if (!addedPatches.
found(patchi))
810 sharedPatches.append(newI);
818 forAll(newPatches, patchi)
824 oldToNew[patchi] = newI++;
828 const label nNewPatches = newI;
833 if (oldToNew[patchi] == -1)
835 oldToNew[patchi] = newI++;
845 Info<<
"Prefixing patches with region name" <<
endl;
847 renamePatches(newMesh(),
regionNames[regionI], sharedPatches);
853 newMesh().setInstance(newMeshInstance);
859 Info<<
"Writing addressing to base mesh" <<
endl;
865 "pointRegionAddressing",
866 newMesh().facesInstance(),
875 Info<<
"Writing map " << pointProcAddressing.name()
876 <<
" from region" << regionI
877 <<
" points back to base mesh." <<
endl;
878 pointProcAddressing.write();
884 "faceRegionAddressing",
885 newMesh().facesInstance(),
894 forAll(faceProcAddressing, facei)
898 label oldFacei = map().faceMap()[facei];
902 map().cellMap()[newMesh().faceOwner()[facei]]
903 ==
mesh.faceOwner()[oldFacei]
906 faceProcAddressing[facei] = oldFacei+1;
910 faceProcAddressing[facei] = -(oldFacei+1);
913 Info<<
"Writing map " << faceProcAddressing.name()
914 <<
" from region" << regionI
915 <<
" faces back to base mesh." <<
endl;
916 faceProcAddressing.write();
922 "cellRegionAddressing",
923 newMesh().facesInstance(),
932 Info<<
"Writing map " <<cellProcAddressing.name()
933 <<
" from region" << regionI
934 <<
" cells back to base mesh." <<
endl;
935 cellProcAddressing.write();
941 "boundaryRegionAddressing",
942 newMesh().facesInstance(),
953 if (!addedPatches.
found(i))
955 label newI = oldToNew[i];
956 if (newI >= 0 && newI < nNewPatches)
958 boundaryProcAddressing[oldToNew[i]] = i;
962 Info<<
"Writing map " << boundaryProcAddressing.name()
963 <<
" from region" << regionI
964 <<
" boundary back to base mesh." <<
endl;
965 boundaryProcAddressing.write();
978 const List<Pair<word>>& interfaceNames
985 forAll(interfaces, interI)
987 const edge&
e = interfaces[interI];
988 const Pair<word>&
names = interfaceNames[interI];
1040 <<
" " << interfacePatches[interI]
1041 <<
"\t" <<
mesh.boundaryMesh()[interfacePatches[interI]].name()
1043 <<
" " << interfacePatches[interI]+1
1044 <<
"\t" <<
mesh.boundaryMesh()[interfacePatches[interI]+1].name()
1047 return interfacePatches;
1052label findCorrespondingRegion
1056 const label nCellRegions,
1058 const label minOverlapSize
1064 forAll(cellRegion, celli)
1066 if (existingZoneID[celli] == zoneI)
1068 cellsInZone[cellRegion[celli]]++;
1075 label regionI =
findMax(cellsInZone);
1078 if (cellsInZone[regionI] < minOverlapSize)
1086 forAll(cellRegion, celli)
1088 if (cellRegion[celli] == regionI && existingZoneID[celli] != zoneI)
1118 forAll(clusterToZones, clusterI)
1120 for (
const label zoneI : clusterToZones[clusterI])
1122 const cellZone& cz = cellZones[zoneI];
1126 label celli = cz[i];
1127 if (clusterID[celli] == -1)
1129 clusterID[celli] = clusterI;
1134 <<
"Cell " << celli <<
" with cell centre "
1135 <<
mesh.cellCentres()[celli]
1136 <<
" is multiple zones. This is not allowed." <<
endl
1137 <<
"It is in zone " << clusterNames[clusterID[celli]]
1138 <<
" and in zone " << clusterNames[clusterI]
1153 const label regioni,
1170 for (label i = 1; i <
zoneIDs.size(); i++)
1181 const List<wordRes>& zoneClusters,
1192 clusterNames.
clear();
1193 clusterToZones.
clear();
1197 if (zoneClusters.
size())
1199 forAll(zoneClusters, clusteri)
1205 zoneClusterNames[clusteri].size()
1206 ? zoneClusterNames[clusteri]
1218 forAll(zoneToCluster, zonei)
1220 if (zoneToCluster[zonei] == -1)
1222 clusterNames.
append(cellZones[zonei].
name());
1224 zoneToCluster[zonei] = clusterToZones.
size();
1230 for (
const auto&
cellZone : cellZones)
1232 const label nClusters = clusterToZones.
size();
1243 const bool sloppyCellZones,
1250 const label nCellRegions,
1260 regionToZones.
setSize(nCellRegions);
1269 forAll(clusterToZones, clusterI)
1271 for (
const label zoneI : clusterToZones[clusterI])
1273 clusterSizes[clusterI] += cellZones[zoneI].
size();
1278 if (sloppyCellZones)
1280 Info<<
"Trying to match regions to existing cell zones;"
1281 <<
" region can be subset of cell zone." <<
nl <<
endl;
1283 forAll(clusterToZones, clusterI)
1285 label regionI = findCorrespondingRegion
1291 label(0.5*clusterSizes[clusterI])
1296 Info<<
"Sloppily matched region " << regionI
1298 <<
" to cluster " << clusterI
1299 <<
" size " << clusterSizes[clusterI]
1304 clusterToZones[clusterI]
1306 regionToZones[regionI] = clusterToZones[clusterI];
1313 Info<<
"Trying to match regions to existing cell zones." <<
nl <<
endl;
1315 forAll(clusterToZones, clusterI)
1317 label regionI = findCorrespondingRegion
1323 clusterSizes[clusterI]
1331 clusterToZones[clusterI]
1333 regionToZones[regionI] = clusterToZones[clusterI];
1347 regionToZones[regionI]
1363 mesh.facesInstance(),
1371 cellToRegion.write();
1373 Info<<
"Writing region per cell file (for manual decomposition) to "
1374 << cellToRegion.objectPath() <<
nl <<
endl;
1383 mesh.time().timeName(),
1393 forAll(cellRegion, celli)
1395 cellToRegion[celli] = cellRegion[celli];
1397 cellToRegion.write();
1399 Info<<
"Writing region per cell as volScalarField to "
1400 << cellToRegion.objectPath() <<
nl <<
endl;
1407int main(
int argc,
char *argv[])
1411 "Split mesh into multiple regions (detected by walking across faces)"
1418 "Additionally split cellZones off into separate regions"
1423 "Use cellZones only to split mesh into regions; do not use walking"
1427 "cellZonesFileOnly",
1429 "Like -cellZonesOnly, but use specified file"
1435 "Combine zones in follow-on analysis"
1441 "Combine zones in follow-on analysis"
1447 "Specify additional region boundaries that walking does not cross"
1452 "Place cells into cellZones instead of splitting mesh"
1457 "Only write largest region"
1463 "Only write region containing point"
1473 "Try to match heuristically regions to existing cell zones"
1478 "Use faceZones to patch inter-region faces instead of single patch"
1483 "Prefix region name to all patches, not just coupling patches"
1492 const word oldInstance =
mesh.pointsInstance();
1494 word blockedFacesName;
1495 if (
args.readIfPresent(
"blockedFaces", blockedFacesName))
1497 Info<<
"Reading blocked internal faces from faceSet "
1498 << blockedFacesName <<
nl <<
endl;
1501 const bool makeCellZones =
args.found(
"makeCellZones");
1502 const bool largestOnly =
args.found(
"largestOnly");
1503 const bool insidePoint =
args.found(
"insidePoint");
1504 const bool useCellZones =
args.found(
"cellZones");
1505 const bool useCellZonesOnly =
args.found(
"cellZonesOnly");
1506 const bool useCellZonesFile =
args.found(
"cellZonesFileOnly");
1507 const bool combineZones =
args.found(
"combineZones");
1508 const bool addZones =
args.found(
"addZones");
1509 const bool overwrite =
args.found(
"overwrite");
1510 const bool detectOnly =
args.found(
"detectOnly");
1511 const bool sloppyCellZones =
args.found(
"sloppyCellZones");
1512 const bool useFaceZones =
args.found(
"useFaceZones");
1513 const bool prefixRegion =
args.found(
"prefixRegion");
1518 (useCellZonesOnly || useCellZonesFile)
1519 && (useCellZones || blockedFacesName.size())
1523 <<
"You cannot specify both -cellZonesOnly or -cellZonesFileOnly"
1524 <<
" (which specify complete split)"
1525 <<
" in combination with -blockedFaces or -cellZones"
1526 <<
" (which imply a split based on topology)"
1533 Info<<
"Using current faceZones to divide inter-region interfaces"
1534 <<
" into multiple patches."
1539 Info<<
"Creating single patch per inter-region interface."
1545 if (insidePoint && largestOnly)
1548 <<
"You cannot specify both -largestOnly"
1549 <<
" (keep region with most cells)"
1550 <<
" and -insidePoint (keep region containing point)"
1556 mesh.cellZones().checkParallelSync(
true);
1558 List<wordRes> zoneClusters;
1565 <<
"Cannot specify both combineZones and addZones"
1568 zoneClusters =
args.get<List<wordRes>>(
"combineZones");
1573 zoneClusters =
args.get<List<wordRes>>(
"addZones");
1575 forAll(zoneClusters, clusteri)
1579 wordRes& wrs = zoneClusters[clusteri];
1581 zoneClusterNames[clusteri] = wrs[0];
1583 for (label i = 1; i < wrs.
size(); i++)
1604 label nCellRegions = 0;
1605 if (useCellZonesOnly)
1607 Info<<
"Using current cellZones to split mesh into regions."
1608 <<
" This requires all"
1609 <<
" cells to be in one and only one cellZone." <<
nl <<
endl;
1640 label unzonedCelli = clusterID.
find(-1);
1641 if (unzonedCelli != -1)
1644 <<
"For the cellZonesOnly option all cells "
1645 <<
"have to be in a cellZone." <<
endl
1646 <<
"Cell " << unzonedCelli
1647 <<
" at" <<
mesh.cellCentres()[unzonedCelli]
1648 <<
" is not in a cellZone. There might be more unzoned cells."
1651 cellRegion = clusterID;
1652 nCellRegions =
gMax(cellRegion)+1;
1653 zoneToRegion = zoneToCluster;
1654 regionToZones = clusterToZones;
1657 else if (useCellZonesFile)
1659 const word zoneFile(
args[
"cellZonesFileOnly"]);
1660 Info<<
"Reading split from cellZones file " << zoneFile <<
endl
1661 <<
"This requires all"
1662 <<
" cells to be in one and only one cellZone." <<
nl <<
endl;
1669 mesh.facesInstance(),
1708 label unzonedCelli = clusterID.
find(-1);
1709 if (unzonedCelli != -1)
1712 <<
"For the cellZonesFileOnly option all cells "
1713 <<
"have to be in a cellZone." <<
endl
1714 <<
"Cell " << unzonedCelli
1715 <<
" at" <<
mesh.cellCentres()[unzonedCelli]
1716 <<
" is not in a cellZone. There might be more unzoned cells."
1719 cellRegion = clusterID;
1720 nCellRegions =
gMax(cellRegion)+1;
1721 zoneToRegion = zoneToCluster;
1722 regionToZones = clusterToZones;
1734 if (blockedFacesName.size())
1739 <<
" blocked faces from set " << blockedFacesName <<
nl <<
endl;
1743 for (
const label facei : blockedFaceSet)
1745 blockedFace[facei] =
true;
1784 for (label facei = 0; facei <
mesh.nInternalFaces(); facei++)
1786 label ownCluster = clusterID[
mesh.faceOwner()[facei]];
1787 label neiCluster = clusterID[
mesh.faceNeighbour()[facei]];
1789 if (ownCluster != neiCluster)
1791 blockedFace[facei] =
true;
1798 label facei = i+
mesh.nInternalFaces();
1799 label ownCluster = clusterID[
mesh.faceOwner()[facei]];
1800 label neiCluster = neiClusterID[i];
1802 if (ownCluster != neiCluster)
1804 blockedFace[facei] =
true;
1811 nCellRegions = regions.nRegions();
1836 if (largestOnly || insidePoint)
1838 forAll(regionToZones, regionI)
1840 if (regionToZones[regionI].empty())
1846 else if (insidePoint)
1850 else if (largestOnly)
1859 Info<<
endl <<
"Number of regions:" << nCellRegions <<
nl <<
endl;
1863 writeCellToRegion(
mesh, cellRegion);
1872 forAll(cellRegion, celli)
1874 regionSizes[cellRegion[celli]]++;
1876 forAll(regionSizes, regionI)
1881 Info<<
"Region\tCells" <<
nl
1882 <<
"------\t-----" <<
endl;
1884 forAll(regionSizes, regionI)
1886 Info<< regionI <<
'\t' << regionSizes[regionI] <<
nl;
1893 Info<<
"Region\tZone\tName" <<
nl
1894 <<
"------\t----\t----" <<
endl;
1895 forAll(regionToZones, regionI)
1907 mesh.boundaryMesh().checkParallelSync(
true);
1908 mesh.faceZones().checkParallelSync(
true);
1918 List<Pair<word>> interfaceNames;
1936 Info<<
"Sizes of interfaces between regions:" <<
nl <<
nl
1937 <<
"Interface\tRegion\tRegion\tFaces" <<
nl
1938 <<
"---------\t------\t------\t-----" <<
endl;
1940 forAll(interfaces, interI)
1942 const edge&
e = interfaces[interI];
1945 <<
"\t\t" <<
e[0] <<
"\t" <<
e[1]
1946 <<
"\t" << interfaceSizes[interI] <<
nl;
2005 if (nCellRegions == 1)
2007 Info<<
"Only one region. Doing nothing." <<
endl;
2009 else if (makeCellZones)
2011 Info<<
"Putting cells into cellZones instead of splitting mesh."
2016 for (label regionI = 0; regionI < nCellRegions; regionI++)
2018 const labelList& zones = regionToZones[regionI];
2020 if (zones.
size() == 1 && zones[0] != -1)
2023 const label zoneI = zones[0];
2024 Info<<
" Region " << regionI <<
" : corresponds to existing"
2026 << zoneI <<
' ' <<
mesh.cellZones()[zoneI].name() <<
endl;
2035 label zoneI =
mesh.cellZones().findZoneID(zoneName);
2039 zoneI =
mesh.cellZones().size();
2040 mesh.cellZones().setSize(zoneI+1);
2041 mesh.cellZones().set
2047 std::move(regionCells),
2055 mesh.cellZones()[zoneI].clearAddressing();
2056 mesh.cellZones()[zoneI] = regionCells;
2058 Info<<
" Region " << regionI <<
" : created new cellZone "
2059 << zoneI <<
' ' <<
mesh.cellZones()[zoneI].name() <<
endl;
2071 mesh.setInstance(oldInstance);
2074 Info<<
"Writing cellZones as new mesh to time " <<
runTime.timeName()
2083 Info<<
"Writing cellSets corresponding to cellZones." <<
nl <<
endl;
2085 for (
const auto& cz :
mesh.cellZones())
2125 (void)
mesh.tetBasePtIs();
2127 label celli =
mesh.findCell(insidePoint);
2129 Info<<
nl <<
"Found point " << insidePoint <<
" in cell " << celli
2134 regionI = cellRegion[celli];
2140 <<
"Subsetting region " << regionI
2141 <<
" containing point " << insidePoint <<
endl;
2146 <<
"Point " << insidePoint
2147 <<
" is not inside the mesh." <<
nl
2148 <<
"Bounding box of the mesh:" <<
mesh.bounds()
2152 createAndWriteRegion
2161 (overwrite ? oldInstance :
runTime.timeName())
2164 else if (largestOnly)
2166 label regionI =
findMax(regionSizes);
2169 <<
"Subsetting region " << regionI
2170 <<
" of size " << regionSizes[regionI]
2173 createAndWriteRegion
2182 (overwrite ? oldInstance :
runTime.timeName())
2188 for (label regionI = 0; regionI < nCellRegions; regionI++)
2191 <<
"Region " << regionI <<
nl
2192 <<
"-------- " <<
endl;
2194 createAndWriteRegion
2203 (overwrite ? oldInstance :
runTime.timeName())
Field reading functions for post-processing utilities.
Info<< nl;Info<< "Write faMesh in vtk format:"<< nl;{ vtk::uindirectPatchWriter writer(aMesh.patch(), fileName(aMesh.time().globalPath()/vtkBaseFileName));writer.writeGeometry();globalIndex procAddr(aMesh.nFaces());labelList cellIDs;if(UPstream::master()) { cellIDs.resize(procAddr.totalSize());for(const labelRange &range :procAddr.ranges()) { auto slice=cellIDs.slice(range);slice=identity(range);} } writer.beginCellData(4);writer.writeProcIDs();writer.write("cellID", cellIDs);writer.write("area", aMesh.S().field());writer.write("normal", aMesh.faceAreaNormals());writer.beginPointData(1);writer.write("normal", aMesh.pointAreaNormals());Info<< " "<< writer.output().name()<< nl;}{ vtk::lineWriter writer(aMesh.points(), aMesh.edges(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edges")));writer.writeGeometry();writer.beginCellData(4);writer.writeProcIDs();{ Field< scalar > fld(faMeshTools::flattenEdgeField(aMesh.magLe(), true))
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Map from edge (expressed as its endpoints) to value. Hashing (and ==) on an edge is symmetric.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
bool found(const Key &key) const
Same as contains().
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
iterator find(const Key &key)
Find and return an iterator set at the hashed entry.
label size() const noexcept
The number of elements in table.
List of IOobjects with searching and retrieving facilities. Implemented as a HashTable,...
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ READ_IF_PRESENT
Reading is optional [identical to LAZY_READ].
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
static void recv(Type &value, const int fromProcNo, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Receive and deserialize a value. Uses operator>> for de-serialization.
void transfer(List< T > &list)
Transfer the contents of the argument List into this list and annul the argument list.
void append(const T &val)
Append an element at the end of the list.
void setSize(label n)
Alias for resize().
void clear()
Clear the list, i.e. set size to zero.
A HashTable to objects of type <T> with a label key.
static void send(const Type &value, const UPstream::commsTypes commsType, const int toProcNo, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY)
Serialize a value and send (buffered/blocking or standard mode). Uses operator<< for serialization.
static void broadcast(Type &value, const int communicator=UPstream::worldComm)
Broadcast content (contiguous or non-contiguous) to all communicator ranks. Does nothing in non-paral...
static void listReduce(UList< T > &values, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce list elements (list must be equal size on all ranks), applying bop to each list element.
static void broadcasts(const int communicator, Type &value, Args &&... values)
Broadcast multiple items to all communicator ranks. Does nothing in non-parallel.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
label find(const T &val) const
Find index of the first occurrence of the value.
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
static constexpr int masterNo() noexcept
Relative rank for the master process - is always 0.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
static rangeType subProcs(const label communicator=worldComm)
Range of process indices for sub-processes.
label size() const noexcept
The number of entries in the list.
labelList indices(const wordRe &matcher, const bool useGroups=true) const
The (sorted) patch indices for all matches, optionally matching zone groups.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
static void addNote(const string ¬e)
Add extra notes for the usage information.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A collection of cell labels.
An edge is a list of two vertex labels. This can correspond to a directed graph edge or an edge on a ...
static edge sorted(label from, label to)
Create (in ascending order) from two vertex labels.
static tmp< DimensionedField< Type, volMesh > > interpolate(const DimensionedField< Type, volMesh > &, const fvMesh &sMesh, const labelUList &cellMap)
Map volume internal (dimensioned) field.
Mesh data needed to do the Finite Volume discretisation.
static const word & calculatedType() noexcept
The type name for calculated patch fields.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
@ NEARESTPATCHFACE
nearest face on selected patch
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
bool checkParallelSync(const bool report=false) const
Check whether all procs have all patches and in same order.
void updateMesh()
Correct polyBoundaryMesh after topology update.
Mesh consisting of general polyhedral cells.
static word defaultRegion
Return the default region name.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh").
A patch is a list of labels that address the faces in the global face list.
Direct mesh changes based on v1.3 polyTopoChange syntax.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
This class separates the mesh into distinct unconnected regions, each of which is then given a label ...
Given list of cells to remove, insert all the topology changes.
A class for managing temporary objects.
static void removeFiles(const polyMesh &)
Helper: remove all sets files from mesh instance.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
static const word null
An empty word.
label index() const noexcept
The index of this zone in the zone list.
const word & name() const noexcept
The zone name.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelIOList & zoneIDs
return returnReduce(nRefine-oldNRefine, sumOp< label >())
#define WarningInFunction
Report a warning using Foam::Warning.
List< edge > edgeList
List of edge.
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.
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
List< word > wordList
List of word.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
const dimensionSet dimless
Dimensionless.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
IOList< label > labelIOList
IO for a List of label.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with cellZone content on a polyMesh.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
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...
vector point
Point is a vector.
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0).
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.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
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...
labelList findIndices(const ListType &input, typename ListType::const_reference val, label start=0)
Linear search to find all occurrences of given element.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Type gMax(const FieldField< Field, Type > &f)
constexpr char nl
The newline '\n' character (0x0a).
Foam::argList args(argc, argv)
interfaceProperties interface(alpha1, U, thermo->transportPropertiesDict())
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.