150 using namespace Foam;
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];
336 for (
const label facei : cFaces)
344 if (nbrCelli == newCelli)
350 if (nbrCelli <= newCelli)
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];
419 for (
const label facei : cFaces)
427 if (nbrCelli == newCelli)
433 if (nbrCelli <= newCelli)
440 label ownRegion = cellToRegion[oldCelli];
441 label neiRegion = cellToRegion[cellOrder[nbrCelli]];
443 if (ownRegion != neiRegion)
455 for (
const label index : order)
459 oldToNewFace[cFaces[index]] = newFacei++;
468 const label nRegions =
Foam::max(cellToRegion)+1;
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);
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();
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;
806 int 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;
886 <<
"Available renumber methods:" <<
nl 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;
912 <<
"Cannot use -decompose option in parallel ... giving up" <<
nl 923 && !decompDictFile.empty() && !decompDictFile.
isAbsolute()
948 timings[TimingType::READ_MESH] +=
timer.timeIncrement();
963 scalar sumSqrIntersect;
980 <<
"Before renumbering" <<
nl 981 <<
" band : " << band <<
nl 982 <<
" profile : " << profile <<
nl;
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." 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",
1123 "faceProcAddressing",
1136 "pointProcAddressing",
1149 "boundaryProcAddressing",
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();
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);
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++;
1480 faceOrder = getFaceOrder(
mesh, cellOrder);
1510 pointOrderMap().pointMap()
1515 pointOrderMap().reversePointMap(),
1516 const_cast<labelList&>(map().reversePointMap())
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())
1627 Info<<
"Not writing inconsistent processor patch decomposition" 1628 <<
" map " << boundaryProcAddressing.filePath() <<
endl;
1641 if (map().hasMotionPoints())
1650 scalar sumSqrIntersect;
1664 Info<<
"After renumbering";
1667 Info<<
" [values are misleading with -decompose option]";
1671 <<
" band : " << band <<
nl 1672 <<
" profile : " << profile <<
nl;
1682 Info<<
" rms frontwidth : " << rmsFrontwidth <<
nl;
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 1777 const label cellOffset =
1783 map().cellMap().cbegin(),
1784 map().cellMap().cend(),
1786 [=](
const label id) {
return (
id + cellOffset); }
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())
1833 Info<<
"Wrote renumbered mesh to " 1835 <<
" for visualization." 1842 timer.resetTimeIncrement();
1883 timings[TimingType::WRITING] +=
timer.timeIncrement();
1903 <<
"Wrote current cellID and origCellID as volScalarField" 1904 <<
" for use in postprocessing." <<
nl <<
endl;
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 static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
const polyBoundaryMesh & pbm
CompactListList< label > subsetAdjacency(const bitSet &select, const CompactListList< label > &input, labelList &subMap)
const Type & value() const noexcept
Return const reference to value.
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 labelList & offsets() const noexcept
Return the offset table (= size()+1)
void clearAddressing()
Clear addressing.
A class for handling file names.
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)
label size() const noexcept
The primary size (the number of rows/sublists)
const fileName & facesInstance() const
Return the current instance directory for faces.
A 1D vector of objects of type <T> with a fixed length <N>.
void resize(const label len)
Adjust allocated size of list.
label nPoints() const noexcept
Number of mesh points.
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.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
virtual const labelList & faceNeighbour() const
Return face neighbour.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
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))
const word & name() const noexcept
Return the object name.
A list that is sorted upon construction or when explicitly requested with the sort() method...
Cell-face mesh analysis engine.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
static FOAM_NO_DANGLING_REFERENCE const pointMesh & New(const polyMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
constexpr char nl
The newline '\n' character (0x0a)
Implements a timeout mechanism via sigalarm.
label start() const noexcept
The start label of boundary faces in the polyMesh face list.
virtual bool no_topology() const
Renumbering method without mesh or cell-cell topology (very special case)
UIndirectList< label > labelUIndList
UIndirectList of labels.
const word dictName("faMeshDefinition")
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
virtual void movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
static bool & parRun() noexcept
Test if this a parallel run.
fileName relativePath(const fileName &input, const bool caseTag=false) const
Return the input relative to the globalPath by stripping off a leading value of the globalPath...
virtual const meshState & data() const noexcept
Const reference to the mesh and solver state data.
bool writeProcIDs()
Write processor ids for each line as CellData or for each point as PointData, depending on isPointDat...
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
void resetPrimitives(autoPtr< pointField > &&points, autoPtr< faceList > &&faces, autoPtr< labelList > &&owner, autoPtr< labelList > &&neighbour, const labelUList &patchSizes, const labelUList &patchStarts, const bool validBoundary=true)
Reset mesh primitive data. Assumes all patch info correct.
static const word canonicalName
The canonical name ("decomposeParDict") under which the MeshObject is registered. ...
fileName globalPath() const
The global path for the case = rootPath/globalCaseName.
static bool setTimeIfPresent(Time &runTime, const argList &args, const bool forceInitial=false)
Set the runTime based on -constant (if present), -time (value), or -latestTime.
const cellList & cells() const
Field reading functions for post-processing utilities.
static bool isAbsolute(const std::string &str)
Return true if filename starts with a '/' or '\' or (windows-only) with a filesystem-root.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
Smooth ATC in cells next to a set of patches supplied by type.
static void writeContents(const IOobject &io, const UList< T > &content)
Write contents. The IOobject is never registered.
const Time & time() const
Return the top-level database.
const globalIndex & globalMeshCellAddr() const noexcept
Global numbering for mesh cells.
label nFaces() const noexcept
Number of mesh faces.
void push_back(const T &val)
Append an element at the end of the list.
List< labelList > labelListList
List of labelList.
#define doLocalCode(FieldType, Variable)
static dictionary readContents(const IOobject &io)
Read and return contents, testing for "dictionary" type. The IOobject will not be registered...
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
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)
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Mesh representing a set of points created from polyMesh.
#define forAll(list, i)
Loop across all elements in list.
const labelList & offsets() const noexcept
Const-access to the offsets.
label nInternal1Edges() const
Internal edges using 0 or 1 boundary point.
void writeCellData(const word &fieldName, const UList< Type > &field)
Write primitive field of CellData.
void reset(T *p=nullptr) noexcept
Delete managed object and set to new given pointer.
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...
static void removeFiles(const polyMesh &mesh)
Helper: remove all procAddressing files from mesh instance.
Abstract base class for renumbering.
Unary and binary predicates that always return true, useful for templating.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
CompactListList< label > invertOneToManyCompact(const label len, const labelUList &map)
Invert one-to-many compact map. Unmapped elements will be size 0.
UPtrList< const labelUList > faceCells() const
Return a list of faceCells for each patch.
label totalSize() const noexcept
The total addressed size, which corresponds to the end offset and also the sum of all localSizes...
vectorField pointField
pointField is a vectorField.
const fileName & pointsInstance() const
Return the current instance directory for points.
labelRange range(label proci) const noexcept
Return start/size range of proci data.
virtual void updateMesh(const mapPolyMesh &mpm)
Update mesh corresponding to the given map.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
SubList< T > slice(const label pos, label len=-1)
Return SubList slice (non-const access) - no range checking.
vtk::lineWriter writer(edgeCentres, edgeList::null(), fileName(aMesh.time().globalPath()/(vtkBaseFileName+"-edgesCentres")))
virtual bool writeGeometry()
Write patch topology.
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.
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
const Time & time() const noexcept
Return time registry.
const word & executable() const noexcept
Name of executable without the path.
virtual bool beginCellData(label nFields=0)
Begin CellData output section for specified number of fields.
int dryRun() const noexcept
Return the dry-run flag.
void sort(UList< T > &list)
Sort the list.
Cuthill-McKee renumbering (CM or RCM)
static void addOptions_singleTime()
Add single-time timeSelector options to argList::validOptions()
bool returnReduceAnd(const bool value, const int communicator=UPstream::worldComm)
Perform logical (and) MPI Allreduce on a copy. Uses UPstream::reduceAnd.
label nInternalPoints() const noexcept
Points not on boundary.
label size() const noexcept
The number of entries in the list.
const word & system() const noexcept
Return system name.
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
virtual const labelList & faceOwner() const
Return face owner.
Reading is optional [identical to LAZY_READ].
static const word null
An empty word.
virtual void resetAddressing(faceZone &&zn)
Move reset addressing and flip map from another zone.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
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.
const globalMeshData & globalData() const
Return parallel info (demand-driven)
virtual void setTime(const Time &t)
Reset the time and time-index to those of the given time.
label nInternalFaces() const noexcept
Number of internal faces.
label timeIndex() const noexcept
Return the current time index.
virtual const faceList & faces() const
Return raw faces.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
const vectorField & cellCentres() const
void updateMesh(const mapPolyMesh &)
Update local numbering for changed mesh.
errorManip< error > abort(error &err)
label nEdges() const
Number of mesh edges.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
ITstream lookup(const word &optName) const
Return an input stream from the named option.
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
virtual bool needs_mesh() const
Renumbering method requires a polyMesh for its topology.
label nInternalEdges() const
Internal edges using 0,1 or 2 boundary points.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh...
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())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
A packed storage of objects of type <T> using an offset table for access.
static wordList supportedMethods()
Return a list of the known methods.
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
refinementData transform(const tensor &, const refinementData val)
No-op rotational transform for base types.
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.
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...
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
Ostream & printExecutionTime(OSstream &os) const
Print the elapsed ExecutionTime (cpu-time), ClockTime.
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
label nTotalCells() const noexcept
Total global number of mesh cells.
labelRange allProcs() const noexcept
Range of process indices for all addressed offsets (processes)
constexpr auto key(const Type &t) noexcept
Helper function to return the enum value.
Write an OpenFOAM volume (internal) geometry and internal fields as a vtu file or a legacy vtk file...
const edgeList & edges() const
Return mesh edges. Uses calcEdges.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name...
static autoPtr< renumberMethod > New(const dictionary &dict)
Construct/select a renumbering method.
static autoPtr< decompositionMethod > New(const dictionary &decompDict, const word ®ionName="")
Return a reference to the selected decomposition method, optionally region-specific.
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Inplace renumber the values within a list.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
#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 cell is defined as a list of faces with extra functionality.
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.
void reserve(label numEntries)
Reserve space for at least the specified number of elements (not the number of buckets) and regenerat...
const polyBoundaryMesh & patches
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Automatically write from objectRegistry::writeObject()
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
const boolList & flipMap() const noexcept
Return face flip map.
messageStream Info
Information stream (stdout output on master, null elsewhere)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
label localStart(const label proci) const
Start of proci data.
bool empty() const noexcept
Check for default constructed or total-size == 0.
const List< T > & values() const noexcept
Return the packed values.
Various for reading/decomposing/reconstructing/distributing refinement data.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Mesh consisting of general polyhedral cells.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
A subset of mesh faces organised as a primitive patch.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
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.
bool readIfPresent(const word &optName, T &val) const
Read a value from the named option if present.
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...
List< label > labelList
A List of labels.
A class for managing temporary objects.
const fileName & output() const noexcept
The current output file name.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Foam::argList args(argc, argv)
void resetHeader(const word &newName=word::null)
Clear various bits (headerClassName, note, sizeof...) that would be obtained when reading from a file...
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.
Defines the attributes of an object for which implicit objectRegistry management is supported...
virtual void updateMesh(const mapPolyMesh &morphMap)
Update any stored data for new labels. Not implemented.
label nInternal0Edges() const
Internal edges (i.e. not on boundary face) using no boundary point.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
static void writeMaps(Ostream &os, const word &key, const labelListList &maps)
static const word & regionName(const word ®ion)
The mesh region name or word::null if polyMesh::defaultRegion.
Do not request registration (bool: false)
A deep-copy description of an OpenFOAM volume mesh in data structures suitable for VTK UnstructuredGr...
void clear()
Reset to be empty (no offsets)
UIndirectList< bool > boolUIndList
UIndirectList of bools.
bool found(const word &optName) const
Return true if the named option is found.
An input stream of tokens.
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...
static IOobject selectIO(const IOobject &io, const fileName &altFile, const word &ioName="")
Return the IOobject, but also consider an alternative file name.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Starts timing and returns elapsed time from start. Uses std::chrono::high_resolution_clock for better...