186 auto&
fld = tfld.ref();
190 fld[celli] = elems[celli];
193 fld.correctBoundaryConditions();
224 auto& bandwidth = metrics.first();
225 auto& profile = metrics.second();
229 const auto& neighbours = mat[celli];
231 const label nNbr = neighbours.
size();
236 const label width = (neighbours[nNbr-1] - celli);
238 if (bandwidth < width)
243 profile += scalar(width);
254 const bool calculateIntersect,
260 scalar& sumSqrIntersect
269 const label own = owner[facei];
270 const label nei = neighbour[facei];
273 const label width = nei - own;
275 if (cellBandwidth[nei] < width)
277 cellBandwidth[nei] = width;
279 if (bandwidth < width)
288 for (
const label width : cellBandwidth)
290 profile += scalar(width);
294 if (calculateIntersect)
300 for (label colI = celli-cellBandwidth[celli]; colI <= celli; colI++)
302 nIntersect[colI] += scalar(1);
327 forAll(cellOrder, newCelli)
329 const label oldCelli = cellOrder[newCelli];
331 const cell& cFaces =
mesh.cells()[oldCelli];
336 for (
const label facei : cFaces)
340 if (
mesh.isInternalFace(facei))
343 nbrCelli = reverseCellOrder[
mesh.faceNeighbour()[facei]];
344 if (nbrCelli == newCelli)
346 nbrCelli = reverseCellOrder[
mesh.faceOwner()[facei]];
350 if (nbrCelli <= newCelli)
356 nbr.push_back(nbrCelli);
361 for (
const label index : order)
365 oldToNewFace[cFaces[index]] = newFacei++;
371 for (label facei = newFacei; facei <
mesh.nFaces(); facei++)
373 oldToNewFace[facei] = facei;
378 forAll(oldToNewFace, facei)
380 if (oldToNewFace[facei] == -1)
383 <<
"Did not determine new position" <<
" for face " << facei
410 forAll(cellOrder, newCelli)
412 const label oldCelli = cellOrder[newCelli];
414 const cell& cFaces =
mesh.cells()[oldCelli];
419 for (
const label facei : cFaces)
423 if (
mesh.isInternalFace(facei))
426 nbrCelli = reverseCellOrder[
mesh.faceNeighbour()[facei]];
427 if (nbrCelli == newCelli)
429 nbrCelli = reverseCellOrder[
mesh.faceOwner()[facei]];
433 if (nbrCelli <= newCelli)
440 label ownRegion = cellToRegion[oldCelli];
441 label neiRegion = cellToRegion[cellOrder[nbrCelli]];
443 if (ownRegion != neiRegion)
450 nbr.push_back(nbrCelli);
455 for (
const label index : order)
459 oldToNewFace[cFaces[index]] = newFacei++;
468 const label nRegions =
Foam::max(cellToRegion)+1;
473 for (label facei = 0; facei <
mesh.nInternalFaces(); facei++)
475 label ownRegion = cellToRegion[
mesh.faceOwner()[facei]];
476 label neiRegion = cellToRegion[
mesh.faceNeighbour()[facei]];
478 if (ownRegion != neiRegion)
493 label
key = sortKey[i];
500 oldToNewFace[sortKey.indices()[i]] = newFacei++;
505 for (label facei = newFacei; facei <
mesh.nFaces(); facei++)
507 oldToNewFace[facei] = facei;
512 forAll(oldToNewFace, facei)
514 if (oldToNewFace[facei] == -1)
517 <<
"Did not determine new position for face " << facei
559 forAll(newNeighbour, facei)
561 if (newOwner[facei] > newNeighbour[facei])
563 std::swap(newOwner[facei], newNeighbour[facei]);
564 newFaces[facei].flip();
565 flipFaceFlux.insert(facei);
577 patchSizes[patchi] =
patches[patchi].size();
578 patchStarts[patchi] =
patches[patchi].start();
579 oldPatchNMeshPoints[patchi] =
patches[patchi].nPoints();
606 label oldFacei = fZone[i];
607 newAddressing[i] = reverseFaceOrder[oldFacei];
608 if (flipFaceFlux.found(newAddressing[i]))
610 newFlipMap[i] = !fZone.
flipMap()[i];
614 newFlipMap[i] = fZone.
flipMap()[i];
703 timer.resetTimeIncrement();
705 forAll(regionCellOrder, regioni)
711 method.
renumber(regionCellOrder[regioni].size());
714 regionCellOrder[regioni] =
718 timings[TimingType::RENUMBER] +=
timer.timeIncrement();
722 timer.resetTimeIncrement();
724 forAll(regionCellOrder, regioni)
737 const labelList& cellMap = subsetter.cellMap();
744 regionCellOrder[regioni] =
labelUIndList(cellMap, subCellOrder);
747 timings[TimingType::RENUMBER] +=
timer.timeIncrement();
751 timer.resetTimeIncrement();
765 timings[TimingType::CELL_CELLS] +=
timer.timeIncrement();
768 bitSet subsetCells(
mesh.nCells());
770 forAll(regionCellOrder, regioni)
776 subsetCells.set(regionCellOrder[regioni]);
783 timings[TimingType::CELL_CELLS] +=
timer.timeIncrement();
793 regionCellOrder[regioni] =
labelUIndList(cellMap, subCellOrder);
795 timings[TimingType::RENUMBER] +=
timer.timeIncrement();
800 return regionCellOrder;
806int main(
int argc,
char *argv[])
814 "Renumber mesh cells to reduce the bandwidth. Use the -lib option or"
815 " dictionary 'libs' entry to load additional libraries"
820 "Test without writing. "
821 "Changes -write-maps to write VTK output."
830 "Calculate the RMS of the front-width"
836 "Aggregate initially with a decomposition method (serial only)"
842 "Write renumber mappings"
848 "Suppress renumbering of fields (eg, when they are only uniform)"
854 "List available renumbering methods"
861 "Specify renumber method (default: CuthillMcKee) without dictionary"
868 "Specify renumber coefficients (dictionary content) as string. "
869 "eg, 'reverse true;'"
880 bool listOptions =
false;
882 if (
args.found(
"list-renumber"))
886 <<
"Available renumber methods:" <<
nl
898 const bool dryrun =
args.dryRun();
900 const bool readDict =
args.found(
"dict");
901 const bool doDecompose =
args.found(
"decompose");
902 const bool overwrite =
args.found(
"overwrite");
903 const bool doFields = !
args.found(
"no-fields");
904 const bool doFrontWidth =
args.found(
"frontWidth") && !doDecompose;
906 word renumberMethodName;
907 args.readIfPresent(
"renumber-method", renumberMethodName);
912 <<
"Cannot use -decompose option in parallel ... giving up" <<
nl
922 args.readIfPresent(
"decomposeParDict", decompDictFile)
923 && !decompDictFile.empty() && !decompDictFile.
isAbsolute()
926 decompDictFile =
runTime.globalPath()/decompDictFile;
948 timings[TimingType::READ_MESH] +=
timer.timeIncrement();
959 const word oldInstance =
mesh.pointsInstance();
963 scalar sumSqrIntersect;
969 mesh.faceNeighbour(),
979 <<
" size: " <<
mesh.globalData().nTotalCells() <<
nl
980 <<
"Before renumbering" <<
nl
981 <<
" band : " << band <<
nl
982 <<
" profile : " << profile <<
nl;
989 sumSqrIntersect/
mesh.globalData().nTotalCells()
992 Info<<
" rms frontwidth : " << rmsFrontwidth <<
nl;
997 bool sortCoupledFaceCells =
false;
999 bool orderPoints =
false;
1000 bool useRegionFaceOrder =
false;
1001 label blockSize = 0;
1021 sortCoupledFaceCells =
1022 renumberDict.
getOrDefault(
"sortCoupledFaceCells",
false);
1024 if (sortCoupledFaceCells)
1026 Info<<
"Sorting cells on coupled boundaries to be last."
1030 blockSize = renumberDict.
getOrDefault<label>(
"blockSize", 0);
1034 Info<<
"Ordering cells into regions of size " << blockSize
1035 <<
" (using decomposition);"
1036 <<
" ordering faces into region-internal"
1037 <<
" and region-external."
1043 useRegionFaceOrder =
1048 orderPoints = renumberDict.
getOrDefault(
"orderPoints",
false);
1051 Info<<
"Ordering points into internal and boundary points."
1061 Info<<
"Writing renumber maps (new to old) to polyMesh."
1067 if (
args.found(
"renumber-coeffs"))
1073 Info<<
"Specified renumber coefficients:" <<
nl
1074 << renumberDict <<
nl;
1077 if (!renumberMethodName.empty())
1080 renumberDict.
set(
"method", renumberMethodName);
1083 else if (renumberDict.
found(
"method"))
1094 Info<<
"Using renumber-method: " << renumberPtr().type()
1095 <<
" [default]" <<
endl;
1099 Info<<
"Using renumber-method: " << renumberPtr().type()
1109 "cellProcAddressing",
1110 mesh.facesInstance(),
1123 "faceProcAddressing",
1124 mesh.facesInstance(),
1136 "pointProcAddressing",
1137 mesh.pointsInstance(),
1149 "boundaryProcAddressing",
1150 mesh.pointsInstance(),
1163 if (!dryrun && doFields)
1165 Info<<
nl <<
"Reading fields" <<
nl;
1167 timer.resetTimeIncrement();
1170 storedObjects.
reserve(objects.size());
1177 #define doLocalCode(FieldType) \
1178 readFields<FieldType>(mesh, objects, nameMatcher, storedObjects);
1205 #define doLocalCode(FieldType) \
1206 readFields<FieldType>(pMesh, objects, nameMatcher, storedObjects);
1216 timings[TimingType::READ_FIELDS] +=
timer.timeIncrement();
1219 for (
auto* fldptr : storedObjects)
1248 if (blockSize > 0 && !doDecompose)
1250 timer.resetTimeIncrement();
1255 label nBlocks =
mesh.nCells()/blockSize;
1256 Info<<
"nBlocks = " << nBlocks <<
endl;
1260 decomposeDict.set(
"numberOfSubdomains", nBlocks);
1270 decomposePtr().decompose
1279 timings[TimingType::DECOMPOSE] +=
timer.timeIncrement();
1289 Info<<
nl <<
"Written decomposition as volScalarField to "
1290 <<
"cellDist for use in postprocessing."
1300 decomposePtr().nDomains()
1303 cellOrder = regionCellOrder.
values();
1306 if (useRegionFaceOrder)
1308 faceOrder = getRegionFaceOrder(
mesh, cellOrder, cellToRegion);
1312 faceOrder = getFaceOrder(
mesh, cellOrder);
1323 timer.resetTimeIncrement();
1352 decomposePtr().decompose
1359 timings[TimingType::DECOMPOSE] +=
timer.timeIncrement();
1369 decomposePtr().nDomains()
1372 cellOrder = regionCellOrder.
values();
1378 "requested.partition-offsets",
1386 const auto& method = renumberPtr();
1388 timer.resetTimeIncrement();
1399 timings[TimingType::RENUMBER] +=
timer.timeIncrement();
1403 if (sortCoupledFaceCells)
1409 label nBndCells = 0;
1414 nBndCells +=
pbm[patchi].size();
1432 if (reverseCellOrder[celli] != -1)
1434 bndCells[nBndCells] = celli;
1435 bndCellMap[nBndCells++] =
1436 reverseCellOrder[celli];
1437 reverseCellOrder[celli] = -1;
1442 bndCells.resize(nBndCells);
1443 bndCellMap.resize(nBndCells);
1451 label sortedI =
mesh.nCells();
1454 label origCelli = bndCells[order[i]];
1455 newReverseCellOrder[origCelli] = --sortedI;
1458 Info<<
"Ordered all " << nBndCells
1459 <<
" cells with a coupled face"
1460 <<
" to the end of the cell list, starting at " << sortedI
1465 forAll(cellOrder, newCelli)
1467 label origCelli = cellOrder[newCelli];
1468 if (newReverseCellOrder[origCelli] == -1)
1470 newReverseCellOrder[origCelli] = sortedI++;
1475 cellOrder =
invert(
mesh.nCells(), newReverseCellOrder);
1480 faceOrder = getFaceOrder(
mesh, cellOrder);
1510 pointOrderMap().pointMap()
1515 pointOrderMap().reversePointMap(),
1516 const_cast<labelList&
>(map().reversePointMap())
1522 mesh.updateMesh(map());
1525 if (cellProcAddressing.headerOk())
1529 Info<<
"Renumbering processor cell decomposition map "
1530 << cellProcAddressing.name() <<
endl;
1539 Info<<
"Not writing inconsistent processor cell decomposition"
1540 <<
" map " << cellProcAddressing.filePath() <<
endl;
1549 if (faceProcAddressing.headerOk())
1553 Info<<
"Renumbering processor face decomposition map "
1554 << faceProcAddressing.name() <<
endl;
1563 for (
const label facei : fff)
1565 label masterFacei = faceProcAddressing[facei];
1567 faceProcAddressing[facei] = -masterFacei;
1569 if (masterFacei == 0)
1572 <<
" masterFacei:" << masterFacei
1579 Info<<
"Not writing inconsistent processor face decomposition"
1580 <<
" map " << faceProcAddressing.filePath() <<
endl;
1589 if (pointProcAddressing.headerOk())
1593 Info<<
"Renumbering processor point decomposition map "
1594 << pointProcAddressing.name() <<
endl;
1603 Info<<
"Not writing inconsistent processor point decomposition"
1604 <<
" map " << pointProcAddressing.filePath() <<
endl;
1613 if (boundaryProcAddressing.headerOk())
1619 boundaryProcAddressing.size() ==
mesh.boundaryMesh().size()
1627 Info<<
"Not writing inconsistent processor patch decomposition"
1628 <<
" map " << boundaryProcAddressing.filePath() <<
endl;
1641 if (map().hasMotionPoints())
1643 mesh.movePoints(map().preMotionPoints());
1650 scalar sumSqrIntersect;
1656 mesh.faceNeighbour(),
1664 Info<<
"After renumbering";
1667 Info<<
" [values are misleading with -decompose option]";
1671 <<
" band : " << band <<
nl
1672 <<
" profile : " << profile <<
nl;
1679 sumSqrIntersect/
mesh.globalData().nTotalCells()
1682 Info<<
" rms frontwidth : " << rmsFrontwidth <<
nl;
1701 mesh.nInternalPoints(),
1712 mesh.nInternalEdges(),
1717 mesh.nInternal0Edges(),
1722 mesh.nInternal1Edges(),
1727 <<
" total : " << nTotPoints <<
nl
1728 <<
" internal: " << nTotIntPoints <<
nl
1729 <<
" boundary: " << nTotPoints-nTotIntPoints <<
nl
1731 <<
" total : " << nTotEdges <<
nl
1732 <<
" internal: " << nTotIntEdges <<
nl
1733 <<
" internal using 0 boundary points: "
1734 << nTotInt0Edges <<
nl
1735 <<
" internal using 1 boundary points: "
1736 << nTotInt1Edges-nTotInt0Edges <<
nl
1737 <<
" internal using 2 boundary points: "
1738 << nTotIntEdges-nTotInt1Edges <<
nl
1739 <<
" boundary: " << nTotEdges-nTotIntEdges <<
nl
1748 fileName file =
mesh.time().globalPath()/
"renumberMesh";
1777 const label cellOffset =
1778 mesh.globalData().globalMeshCellAddr().localStart();
1783 map().cellMap().cbegin(),
1784 map().cellMap().cend(),
1786 [=](
const label
id) { return (id + cellOffset); }
1789 writer.writeCellData(
"origCellID", ids);
1794 writer.writeCellData(
"origCellID", map().cellMap());
1800 mesh.data().readIfPresent
1802 "requested.partition-offsets",
1810 <<
"Requested partition total-size: "
1812 <<
" mesh total-size: "
1814 <<
" ... ignoring" <<
endl;
1816 partitionOffsets.
clear();
1822 for (
const label proci : partitionOffsets.
allProcs())
1824 ids.
slice(partitionOffsets.
range(proci)) = proci;
1827 if (!partitionOffsets.
empty())
1829 writer.writeCellData(
"procID", ids);
1833 Info<<
"Wrote renumbered mesh to "
1835 <<
" for visualization."
1842 timer.resetTimeIncrement();
1846 mesh.setInstance(oldInstance);
1853 Info<<
"Writing mesh to " <<
mesh.facesInstance() <<
endl;
1865 mesh.facesInstance(),
1873 refData.updateMesh(map());
1883 timings[TimingType::WRITING] +=
timer.timeIncrement();
1903 <<
"Wrote current cellID and origCellID as volScalarField"
1904 <<
" for use in postprocessing." <<
nl <<
endl;
1909 mesh.facesInstance(),
1917 meshMapIO.resetHeader(
"cellMap");
1920 meshMapIO.resetHeader(
"faceMap");
1923 meshMapIO.resetHeader(
"pointMap");
1929 while (!storedObjects.empty())
1931 storedObjects.back()->checkOut();
1932 storedObjects.pop_back();
1938 <<
" read mesh : " << timings[TimingType::READ_MESH] <<
nl
1939 <<
" read fields : " << timings[TimingType::READ_FIELDS] <<
nl
1940 <<
" decompose : " << timings[TimingType::DECOMPOSE] <<
nl
1941 <<
" cell-cells : " << timings[TimingType::CELL_CELLS] <<
nl
1942 <<
" renumber : " << timings[TimingType::RENUMBER] <<
nl
1943 <<
" write : " << timings[TimingType::WRITING] <<
nl
1944 <<
"TotalTime = " <<
timer.elapsedTime() <<
" s" <<
nl
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))
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edgesCentres")))
const polyBoundaryMesh & pbm
A packed storage of objects of type <T> using an offset table for access.
const labelList & offsets() const noexcept
Return the offset table (= size()+1).
const List< T > & values() const noexcept
Return the packed values.
label size() const noexcept
The primary size (the number of rows/sublists).
Cuthill-McKee renumbering (CM or RCM).
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void reserve(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
A 1D vector of objects of type <T> with a fixed length <N>.
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
DimensionedField< scalar, volMesh > Internal
static void writeContents(const IOobject &io, const UList< T > &content)
Write contents. The IOobject is never registered.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
static dictionary readContents(const IOobject &io)
Read and return contents, testing for "dictionary" type. The IOobject will not be registered.
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,...
static IOobject selectIO(const IOobject &io, const fileName &altFile, const word &ioName="")
Return the IOobject, but also consider an alternative file name.
An input stream of tokens.
void resize(const label len)
Adjust allocated size of list.
static FOAM_NO_DANGLING_REFERENCE const pointMesh & New(const polyMesh &mesh, Args &&... args)
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
A list that is sorted upon construction or when explicitly requested with the sort() method.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
iterator begin() noexcept
Return an iterator to begin traversing the UList.
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
void size(const label n)
Older name for setAddressableSize.
static bool parRun(const bool on) noexcept
Set as parallel run on/off.
void clearAddressing()
Clear addressing.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
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.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
A cell is defined as a list of faces with extra functionality.
Starts timing and returns elapsed time from start. Uses std::chrono::high_resolution_clock for better...
static autoPtr< decompositionMethod > New(const dictionary &decompDict, const word ®ionName="")
Return a reference to the selected decomposition method, optionally region-specific.
static const word canonicalName
The canonical name ("decomposeParDict") under which the MeshObject is registered.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
Smooth ATC in cells next to a set of patches supplied by type.
A subset of mesh faces organised as a primitive patch.
const boolList & flipMap() const noexcept
Return face flip map.
virtual void resetAddressing(faceZone &&zn)
Move reset addressing and flip map from another zone.
A class for handling file names.
static bool isAbsolute(const std::string &str)
Return true if filename starts with a '/' or '\' or (windows-only) with a filesystem-root.
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
Mesh data needed to do the Finite Volume discretisation.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
label totalSize() const noexcept
The total addressed size, which corresponds to the end offset and also the sum of all localSizes.
bool empty() const noexcept
Check for default constructed or total-size == 0.
labelRange range(label proci) const noexcept
Return start/size range of proci data.
labelRange allProcs() const noexcept
Range of process indices for all addressed offsets (processes).
void clear()
Reset to be empty (no offsets).
const labelList & offsets() const noexcept
Const-access to the offsets.
static void calcCellCells(const polyMesh &mesh, const labelUList &agglom, const label nLocalCoarse, const bool parallel, CompactListList< label > &cellCells)
Determine (local or global) cellCells from mesh agglomeration.
Various for reading/decomposing/reconstructing/distributing refinement data.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Mesh representing a set of points created from polyMesh.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh").
Direct mesh changes based on v1.3 polyTopoChange syntax.
Cell-face mesh analysis engine.
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
Abstract base class for renumbering.
virtual bool no_topology() const
Renumbering method without mesh or cell-cell topology (very special case).
virtual labelList renumber(const label nCells) const
Return the cell visit order (from ordered back to original cell id) based solely on the number of cel...
virtual bool needs_mesh() const
Renumbering method requires a polyMesh for its topology.
static autoPtr< renumberMethod > New(const dictionary &dict)
Construct/select a renumbering method.
static wordList supportedMethods()
Return a list of the known methods.
static void addOptions_singleTime()
Add single-time timeSelector options to argList::validOptions().
static bool setTimeIfPresent(Time &runTime, const argList &args, const bool forceInitial=false)
Set the runTime based on -constant (if present), -time (value), or -latestTime.
Implements a timeout mechanism via sigalarm.
A class for managing temporary objects.
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels. Not implemented.
Write an OpenFOAM volume (internal) geometry and internal fields as a vtu file or a legacy vtk file.
A deep-copy description of an OpenFOAM volume mesh in data structures suitable for VTK UnstructuredGr...
A class for handling words, derived from Foam::string.
static const word null
An empty word.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
const polyBoundaryMesh & patches
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word dictName("faMeshDefinition")
#define doLocalCode(FieldType, Variable)
return returnReduce(nRefine-oldNRefine, sumOp< label >())
#define WarningInFunction
Report a warning using Foam::Warning.
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
CompactListList< label > invertOneToManyCompact(const label len, const labelUList &map)
Invert one-to-many compact map. Unmapped elements will be size 0.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
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)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
GeometricField< vector, fvPatchField, volMesh > volVectorField
const dimensionSet dimless
Dimensionless.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
List< labelList > labelListList
List of labelList.
GeometricField< tensor, pointPatchField, pointMesh > pointTensorField
GeometricField< scalar, pointPatchField, pointMesh > pointScalarField
List< label > labelList
A List of labels.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
GeometricField< sphericalTensor, pointPatchField, pointMesh > pointSphericalTensorField
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
UIndirectList< label > labelUIndList
UIndirectList of labels.
IOList< label > labelIOList
IO for a List of label.
CompactListList< label > subsetAdjacency(const bitSet &select, const CompactListList< label > &input, labelList &subMap)
messageStream Info
Information stream (stdout output on master, null elsewhere).
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
ZoneMesh< faceZone, polyMesh > faceZoneMesh
A ZoneMesh with faceZone content on a polyMesh.
List< face > faceList
List of faces.
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
GeometricField< symmTensor, pointPatchField, pointMesh > pointSymmTensorField
Ostream & endl(Ostream &os)
Add newline and flush stream.
static void writeMaps(Ostream &os, const word &key, const labelListList &maps)
GeometricField< tensor, fvPatchField, volMesh > volTensorField
dimensionedScalar sqrt(const dimensionedScalar &ds)
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with cellZone content on a polyMesh.
GeometricField< tensor, fvsPatchField, surfaceMesh > surfaceTensorField
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
GeometricField< sphericalTensor, fvPatchField, volMesh > volSphericalTensorField
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
GeometricField< sphericalTensor, fvsPatchField, surfaceMesh > surfaceSphericalTensorField
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 sort(UList< T > &list)
Sort the list.
errorManip< error > abort(error &err)
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
List< bool > boolList
A List of bools.
UIndirectList< bool > boolUIndList
UIndirectList of bools.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
vectorField pointField
pointField is a vectorField.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
GeometricField< symmTensor, fvsPatchField, surfaceMesh > surfaceSymmTensorField
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.
constexpr char nl
The newline '\n' character (0x0a).
Foam::argList args(argc, argv)
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
Unary and binary predicates that always return true, useful for templating.