123 using namespace Foam;
137 forAll(patchesToRename, i)
139 label patchi = patchesToRename[i];
142 if (isA<coupledPolyPatch>(
pp))
145 <<
"Encountered coupled patch " <<
pp.name()
146 <<
". Will only rename the patch itself," 147 <<
" not any referred patches." 148 <<
" This might have to be done by hand." 152 pp.name() = prefix +
'_' +
pp.name();
159 template<
class GeoField>
171 for (
const GeoField&
fld :
mesh.objectRegistry::csorted<GeoField>())
189 forAll(tSubFld().boundaryField(), patchi)
191 if (addedPatches.
found(patchi))
193 tSubFld.ref().boundaryFieldRef()[patchi] ==
Zero;
198 GeoField* subFld = tSubFld.ptr();
199 subFld->rename(
fld.name());
206 template<
class GeoField>
207 void subsetSurfaceFields
218 for (
const GeoField&
fld :
mesh.objectRegistry::csorted<GeoField>())
236 forAll(tSubFld().boundaryField(), patchi)
238 if (addedPatches.
found(patchi))
240 tSubFld.ref().boundaryFieldRef()[patchi] ==
Zero;
245 GeoField* subFld = tSubFld.ptr();
246 subFld->rename(
fld.name());
258 if (cellRegion[celli] != regionI)
260 nonRegionCells.append(celli);
263 return labelList(std::move(nonRegionCells));
271 const label ownRegion,
272 const label neiRegion,
283 auto zoneIter = iter().find(zoneID);
292 iter().insert(zoneID, 1);
303 inline label getZoneID
307 const bool useFaceZones,
311 const bool useSelectedFaceZones = !selectedFaceZoneIDs.
empty();
314 if (!useFaceZones && !useSelectedFaceZones)
322 if ( zoneID != -1 && useSelectedFaceZones && !selectedFaceZoneIDs.
found(zoneID) )
332 void getInterfaceSizes
335 const bool useFaceZones,
358 if (ownRegion != neiRegion)
363 getZoneID(
mesh, facei, useFaceZones, selectedFaceZoneIDs),
380 coupledRegion[i] = cellRegion[celli];
388 label neiRegion = coupledRegion[i];
390 if (ownRegion != neiRegion)
395 getZoneID(
mesh, facei, useFaceZones, selectedFaceZoneIDs),
418 auto masterIter = regionsToSize.
find(slaveIter.key());
420 if (masterIter.good())
427 const label zoneID = iter.key();
428 const label slaveSize = iter.val();
430 auto zoneIter = masterInfo.
find(zoneID);
433 *zoneIter += slaveSize;
437 masterInfo.
insert(zoneID, slaveSize);
443 regionsToSize.
insert(slaveIter.key(), slaveInfo);
462 label nInterfaces = 0;
466 nInterfaces += info.
size();
469 interfaces.
setSize(nInterfaces);
470 interfaceNames.
setSize(nInterfaces);
471 interfaceSizes.
setSize(nInterfaces);
477 const edge&
e = iter.key();
485 interfaces[nInterfaces] = iter.key();
486 label zoneID = infoIter.key();
491 name0 +
"_to_" + name1,
492 name1 +
"_to_" + name0
500 zoneName +
"_" + name0 +
"_to_" + name1,
501 zoneName +
"_" + name1 +
"_to_" + name0
505 interfaceSizes[nInterfaces] = infoIter();
506 regionsToInterface(
e).insert(zoneID, nInterfaces);
531 if (ownRegion != neiRegion)
536 getZoneID(
mesh, facei, useFaceZones, selectedFaceZoneIDs);
538 faceToInterface[facei] = regionsToInterface[
interface][zoneID];
545 label neiRegion = coupledRegion[i];
547 if (ownRegion != neiRegion)
552 getZoneID(
mesh, facei, useFaceZones, selectedFaceZoneIDs);
554 faceToInterface[facei] = regionsToInterface[
interface][zoneID];
584 coupledRegion[i] = cellRegion[celli];
596 labelList cellsToRemove(getNonRegionCells(cellRegion, regionI));
601 labelList exposedFaces = cellRemover.getExposedFaces(cellsToRemove);
606 label facei = exposedFaces[i];
607 label interfacei = faceToInterface[facei];
610 label neiRegion = -1;
625 label otherRegion = -1;
627 if (ownRegion == regionI && neiRegion != regionI)
629 otherRegion = neiRegion;
631 else if (ownRegion != regionI && neiRegion == regionI)
633 otherRegion = ownRegion;
638 <<
"Exposed face:" << facei
640 <<
" has owner region " << ownRegion
641 <<
" and neighbour region " << neiRegion
642 <<
" when handling region:" << regionI
647 if (regionI < otherRegion)
649 exposedPatchIDs[i] = interfacePatches[interfacei];
653 exposedPatchIDs[i] = interfacePatches[interfacei]+1;
658 cellRemover.setRefinement
684 void createAndWriteRegion
689 const bool prefixRegion,
693 const word& newMeshInstance
696 Info<<
"Creating mesh for region " << regionI
714 forAll(interfacePatches, interfacei)
716 addedPatches.
insert(interfacePatches[interfacei]);
717 addedPatches.
insert(interfacePatches[interfacei]+1);
724 newMesh().updateMesh(map());
727 subsetVolFields<volScalarField>
735 subsetVolFields<volVectorField>
743 subsetVolFields<volSphericalTensorField>
751 subsetVolFields<volSymmTensorField>
759 subsetVolFields<volTensorField>
768 subsetSurfaceFields<surfaceScalarField>
776 subsetSurfaceFields<surfaceVectorField>
784 subsetSurfaceFields<surfaceSphericalTensorField>
792 subsetSurfaceFields<surfaceSymmTensorField>
800 subsetSurfaceFields<surfaceTensorField>
811 newPatches.checkParallelSync(
true);
817 labelList oldToNew(newPatches.size(), -1);
821 Info<<
"Deleting empty patches" <<
endl;
824 forAll(newPatches, patchi)
828 if (!isA<processorPolyPatch>(
pp))
832 oldToNew[patchi] = newI;
833 if (!addedPatches.
found(patchi))
835 sharedPatches.append(newI);
843 forAll(newPatches, patchi)
847 if (isA<processorPolyPatch>(
pp) &&
pp.size())
849 oldToNew[patchi] = newI++;
853 const label nNewPatches = newI;
858 if (oldToNew[patchi] == -1)
860 oldToNew[patchi] = newI++;
870 Info<<
"Prefixing patches with region name" <<
endl;
872 renamePatches(newMesh(),
regionNames[regionI], sharedPatches);
878 newMesh().setInstance(newMeshInstance);
884 Info<<
"Writing addressing to base mesh" <<
endl;
890 "pointRegionAddressing",
891 newMesh().facesInstance(),
900 Info<<
"Writing map " << pointProcAddressing.name()
901 <<
" from region" << regionI
902 <<
" points back to base mesh." <<
endl;
903 pointProcAddressing.
write();
909 "faceRegionAddressing",
910 newMesh().facesInstance(),
919 forAll(faceProcAddressing, facei)
923 label oldFacei = map().faceMap()[facei];
927 map().cellMap()[newMesh().faceOwner()[facei]]
931 faceProcAddressing[facei] = oldFacei+1;
935 faceProcAddressing[facei] = -(oldFacei+1);
938 Info<<
"Writing map " << faceProcAddressing.name()
939 <<
" from region" << regionI
940 <<
" faces back to base mesh." <<
endl;
941 faceProcAddressing.
write();
947 "cellRegionAddressing",
948 newMesh().facesInstance(),
957 Info<<
"Writing map " <<cellProcAddressing.name()
958 <<
" from region" << regionI
959 <<
" cells back to base mesh." <<
endl;
960 cellProcAddressing.
write();
966 "boundaryRegionAddressing",
967 newMesh().facesInstance(),
978 if (!addedPatches.
found(i))
980 label newI = oldToNew[i];
981 if (newI >= 0 && newI < nNewPatches)
983 boundaryProcAddressing[oldToNew[i]] = i;
987 Info<<
"Writing map " << boundaryProcAddressing.name()
988 <<
" from region" << regionI
989 <<
" boundary back to base mesh." <<
endl;
990 boundaryProcAddressing.
write();
1010 forAll(interfaces, interI)
1012 const edge&
e = interfaces[interI];
1065 <<
" " << interfacePatches[interI]
1068 <<
" " << interfacePatches[interI]+1
1072 return interfacePatches;
1077 label findCorrespondingRegion
1081 const label nCellRegions,
1083 const label minOverlapSize
1089 forAll(cellRegion, celli)
1091 if (existingZoneID[celli] == zoneI)
1093 cellsInZone[cellRegion[celli]]++;
1100 label regionI =
findMax(cellsInZone);
1103 if (cellsInZone[regionI] < minOverlapSize)
1111 forAll(cellRegion, celli)
1113 if (cellRegion[celli] == regionI && existingZoneID[celli] != zoneI)
1143 forAll(clusterToZones, clusterI)
1145 for (
const label zoneI : clusterToZones[clusterI])
1147 const cellZone& cz = cellZones[zoneI];
1151 label celli = cz[i];
1152 if (clusterID[celli] == -1)
1154 clusterID[celli] = clusterI;
1159 <<
"Cell " << celli <<
" with cell centre " 1161 <<
" is multiple zones. This is not allowed." <<
endl 1162 <<
"It is in zone " << clusterNames[clusterID[celli]]
1163 <<
" and in zone " << clusterNames[clusterI]
1178 const label regioni,
1217 clusterNames.
clear();
1218 clusterToZones.
clear();
1222 if (zoneClusters.
size())
1224 forAll(zoneClusters, clusteri)
1230 zoneClusterNames[clusteri].size()
1231 ? zoneClusterNames[clusteri]
1243 forAll(zoneToCluster, zonei)
1245 if (zoneToCluster[zonei] == -1)
1247 clusterNames.
append(cellZones[zonei].
name());
1249 zoneToCluster[zonei] = clusterToZones.
size();
1255 for (
const auto&
cellZone : cellZones)
1257 const label nClusters = clusterToZones.
size();
1268 const bool sloppyCellZones,
1275 const label nCellRegions,
1285 regionToZones.
setSize(nCellRegions);
1294 forAll(clusterToZones, clusterI)
1296 for (
const label zoneI : clusterToZones[clusterI])
1298 clusterSizes[clusterI] += cellZones[zoneI].
size();
1303 if (sloppyCellZones)
1305 Info<<
"Trying to match regions to existing cell zones;" 1306 <<
" region can be subset of cell zone." <<
nl <<
endl;
1308 forAll(clusterToZones, clusterI)
1310 label regionI = findCorrespondingRegion
1316 label(0.5*clusterSizes[clusterI])
1321 Info<<
"Sloppily matched region " << regionI
1323 <<
" to cluster " << clusterI
1324 <<
" size " << clusterSizes[clusterI]
1329 clusterToZones[clusterI]
1331 regionToZones[regionI] = clusterToZones[clusterI];
1338 Info<<
"Trying to match regions to existing cell zones." <<
nl <<
endl;
1340 forAll(clusterToZones, clusterI)
1342 label regionI = findCorrespondingRegion
1348 clusterSizes[clusterI]
1356 clusterToZones[clusterI]
1358 regionToZones[regionI] = clusterToZones[clusterI];
1372 regionToZones[regionI]
1396 cellToRegion.write();
1398 Info<<
"Writing region per cell file (for manual decomposition) to " 1399 << cellToRegion.objectPath() <<
nl <<
endl;
1418 forAll(cellRegion, celli)
1420 cellToRegion[celli] = cellRegion[celli];
1422 cellToRegion.write();
1424 Info<<
"Writing region per cell as volScalarField to " 1425 << cellToRegion.objectPath() <<
nl <<
endl;
1432 int main(
int argc,
char *argv[])
1436 "Split mesh into multiple regions (detected by walking across faces)" 1443 "Additionally split cellZones off into separate regions" 1448 "Use cellZones only to split mesh into regions; do not use walking" 1452 "cellZonesFileOnly",
1454 "Like -cellZonesOnly, but use specified file" 1459 "lists of cellZones",
1460 "Combine zones in follow-on analysis. Synthesises the region name by " 1461 "concatenation of zone names, e.g., zoneA_zoneB." 1465 "customRegionNames",
1467 "list of custom region names to be used with combineZones option. " 1468 "Without this option, combineZones results in region names, which are " 1469 "a concatenation of different cellZone names." 1474 "lists of cellZones",
1475 "Combine zones in follow-on analysis. Supplies the destination region " 1476 "name as the first cellZone name in the list." 1482 "Specify additional region boundaries that walking does not cross" 1487 "Place cells into cellZones instead of splitting mesh" 1492 "Only write largest region" 1498 "Only write region containing point" 1508 "Try to match heuristically regions to existing cell zones" 1513 "Use all faceZones to patch inter-region faces instead of single patch" 1517 "useSelectedFaceZones",
1519 "Use only the specified faceZones to patch inter-region faces instead " 1525 "Prefix region name to all patches, not just coupling patches" 1536 word blockedFacesName;
1539 Info<<
"Reading blocked internal faces from faceSet " 1540 << blockedFacesName <<
nl <<
endl;
1543 const bool makeCellZones =
args.
found(
"makeCellZones");
1544 const bool largestOnly =
args.
found(
"largestOnly");
1545 const bool insidePoint =
args.
found(
"insidePoint");
1546 const bool useCellZones =
args.
found(
"cellZones");
1547 const bool useCellZonesOnly =
args.
found(
"cellZonesOnly");
1548 const bool useCellZonesFile =
args.
found(
"cellZonesFileOnly");
1549 const bool combineZones =
args.
found(
"combineZones");
1550 const bool addZones =
args.
found(
"addZones");
1551 const bool overwrite =
args.
found(
"overwrite");
1552 const bool detectOnly =
args.
found(
"detectOnly");
1553 const bool sloppyCellZones =
args.
found(
"sloppyCellZones");
1554 const bool useFaceZones =
args.
found(
"useFaceZones");
1555 const bool prefixRegion =
args.
found(
"prefixRegion");
1560 (useCellZonesOnly || useCellZonesFile)
1561 && (useCellZones || blockedFacesName.size())
1565 <<
"You cannot specify both -cellZonesOnly or -cellZonesFileOnly" 1566 <<
" (which specify complete split)" 1567 <<
" in combination with -blockedFaces or -cellZones" 1568 <<
" (which imply a split based on topology)" 1575 const bool useSelectedFaceZones
1578 if (useFaceZones && useSelectedFaceZones)
1581 <<
"You cannot specify both useFaceZones and useSelectedFaceZones" 1587 Info<<
"Using current faceZones to divide inter-region interfaces" 1588 <<
" into multiple patches." 1591 else if (useSelectedFaceZones)
1593 Info<<
"Using specified faceZones to divide inter-region interfaces" 1594 <<
" into multiple patches." 1597 forAll(selectedFaceZoneNames, i)
1604 selectedFaceZoneIDs.
insert(zoneID);
1609 <<
"faceZone - " << selectedFaceZoneNames[i]
1610 <<
" not found in mesh." <<
endl;
1616 Info<<
"Creating single patch per inter-region interface." 1622 if (insidePoint && largestOnly)
1625 <<
"You cannot specify both -largestOnly" 1626 <<
" (keep region with most cells)" 1627 <<
" and -insidePoint (keep region containing point)" 1642 <<
"Cannot specify both combineZones and addZones" 1651 if (zoneClusterNames.
size() != zoneClusters.
size())
1654 <<
"Size of -customRegionNames (" 1655 << zoneClusterNames.
size()
1656 <<
") must match size of -combineZones (" 1672 forAll(zoneClusters, clusteri)
1676 wordRes& wrs = zoneClusters[clusteri];
1678 zoneClusterNames[clusteri] = wrs[0];
1680 for (label i = 1; i < wrs.
size(); i++)
1701 label nCellRegions = 0;
1702 if (useCellZonesOnly)
1704 Info<<
"Using current cellZones to split mesh into regions." 1705 <<
" This requires all" 1706 <<
" cells to be in one and only one cellZone." <<
nl <<
endl;
1737 label unzonedCelli = clusterID.
find(-1);
1738 if (unzonedCelli != -1)
1741 <<
"For the cellZonesOnly option all cells " 1742 <<
"have to be in a cellZone." <<
endl 1743 <<
"Cell " << unzonedCelli
1745 <<
" is not in a cellZone. There might be more unzoned cells." 1748 cellRegion = clusterID;
1749 nCellRegions =
gMax(cellRegion)+1;
1750 zoneToRegion = zoneToCluster;
1751 regionToZones = clusterToZones;
1754 else if (useCellZonesFile)
1756 const word zoneFile(
args[
"cellZonesFileOnly"]);
1757 Info<<
"Reading split from cellZones file " << zoneFile <<
endl 1758 <<
"This requires all" 1759 <<
" cells to be in one and only one cellZone." <<
nl <<
endl;
1805 label unzonedCelli = clusterID.find(-1);
1806 if (unzonedCelli != -1)
1809 <<
"For the cellZonesFileOnly option all cells " 1810 <<
"have to be in a cellZone." <<
endl 1811 <<
"Cell " << unzonedCelli
1813 <<
" is not in a cellZone. There might be more unzoned cells." 1816 cellRegion = clusterID;
1817 nCellRegions =
gMax(cellRegion)+1;
1818 zoneToRegion = zoneToCluster;
1819 regionToZones = clusterToZones;
1831 if (blockedFacesName.size())
1836 <<
" blocked faces from set " << blockedFacesName <<
nl <<
endl;
1840 for (
const label facei : blockedFaceSet)
1842 blockedFace[facei] =
true;
1886 if (ownCluster != neiCluster)
1888 blockedFace[facei] =
true;
1897 label neiCluster = neiClusterID[i];
1899 if (ownCluster != neiCluster)
1901 blockedFace[facei] =
true;
1908 nCellRegions = regions.nRegions();
1933 if (largestOnly || insidePoint)
1935 forAll(regionToZones, regionI)
1937 if (regionToZones[regionI].empty())
1943 else if (insidePoint)
1947 else if (largestOnly)
1956 Info<<
endl <<
"Number of regions:" << nCellRegions <<
nl <<
endl;
1960 writeCellToRegion(
mesh, cellRegion);
1969 forAll(cellRegion, celli)
1971 regionSizes[cellRegion[celli]]++;
1973 forAll(regionSizes, regionI)
1978 Info<<
"Region\tCells" <<
nl 1979 <<
"------\t-----" <<
endl;
1981 forAll(regionSizes, regionI)
1983 Info<< regionI <<
'\t' << regionSizes[regionI] <<
nl;
1990 Info<<
"Region\tZone\tName" <<
nl 1991 <<
"------\t----\t----" <<
endl;
1992 forAll(regionToZones, regionI)
2024 selectedFaceZoneIDs,
2033 Info<<
"Sizes of interfaces between regions:" <<
nl <<
nl 2034 <<
"Interface\tRegion\tRegion\tFaces" <<
nl 2035 <<
"---------\t------\t------\t-----" <<
endl;
2037 forAll(interfaces, interI)
2039 const edge&
e = interfaces[interI];
2042 <<
"\t\t" <<
e[0] <<
"\t" <<
e[1]
2043 <<
"\t" << interfaceSizes[interI] <<
nl;
2102 if (nCellRegions == 1)
2104 Info<<
"Only one region. Doing nothing." <<
endl;
2106 else if (makeCellZones)
2108 Info<<
"Putting cells into cellZones instead of splitting mesh." 2113 for (label regionI = 0; regionI < nCellRegions; regionI++)
2115 const labelList& zones = regionToZones[regionI];
2117 if (zones.
size() == 1 && zones[0] != -1)
2120 const label zoneI = zones[0];
2121 Info<<
" Region " << regionI <<
" : corresponds to existing" 2144 std::move(regionCells),
2155 Info<<
" Region " << regionI <<
" : created new cellZone " 2180 Info<<
"Writing cellSets corresponding to cellZones." <<
nl <<
endl;
2226 Info<<
nl <<
"Found point " << insidePoint <<
" in cell " << celli
2231 regionI = cellRegion[celli];
2237 <<
"Subsetting region " << regionI
2238 <<
" containing point " << insidePoint <<
endl;
2243 <<
"Point " << insidePoint
2244 <<
" is not inside the mesh." <<
nl 2245 <<
"Bounding box of the mesh:" <<
mesh.
bounds()
2249 createAndWriteRegion
2261 else if (largestOnly)
2263 label regionI =
findMax(regionSizes);
2266 <<
"Subsetting region " << regionI
2267 <<
" of size " << regionSizes[regionI]
2270 createAndWriteRegion
2285 for (label regionI = 0; regionI < nCellRegions; regionI++)
2288 <<
"Region " << regionI <<
nl 2289 <<
"-------- " <<
endl;
2291 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 ...
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.
const labelIOList & zoneIDs
void clearAddressing()
Clear addressing.
nearest face on selected patch
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...
static void broadcasts(const int communicator, Type &value, Args &&... values)
Broadcast multiple items to all communicator ranks. Does nothing in non-parallel. ...
#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.
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")
void setSize(const label n)
Same as resize()
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool & parRun() noexcept
Test if this a parallel run.
void clearOut(const bool isMeshUpdate=false)
Clear all geometry and addressing.
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.
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...
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.
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)
void reduce(T &value, [[maybe_unused]] BinaryOp bop, [[maybe_unused]] const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce)
#define forAll(list, i)
Loop across all elements in list.
bool insert(const edge &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
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.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
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.
labelList indices(const wordRe &matcher, const bool useGroups=true) const
The (sorted) patch indices for all matches, optionally matching zone groups.
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 ...
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.
T returnReduce(const T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
label nInternalFaces() const noexcept
Number of internal faces.
const vectorField & cellCentres() const
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
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 registered IO, a reference to the associated polyMesh...
bool empty() const noexcept
True if the hash table is empty.
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.
bool readListIfPresent(const word &optName, List< T > &list) const
If named option is present, get a List of values treating a single entry like a list of size 1...
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.
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.
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)
static bool master(label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
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.
static edge sorted(label from, label to)
Create (in ascending order) from two vertex labels.
List< label > labelList
A List of labels.
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)
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
bool send()
Send buffer contents now and not in destructor [advanced usage]. Returns true on success.
Defines the attributes of an object for which implicit objectRegistry management is supported...
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...
void setSize(label n)
Alias for resize()
Do not request registration (bool: false)
bool found(const word &optName) const
Return true if the named option is found.
static rangeType subProcs(label communicator=worldComm)
Range of process indices for sub-processes.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
forAllConstIters(mixture.phases(), phase)
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...
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)