Go to the documentation of this file.
94 zeroGradientFvPatchScalarField::typeName
101 fld[celli] = elems[celli];
115 label
diff = neighbour[facei] - owner[facei];
129 const bool calculateIntersect,
135 scalar& sumSqrIntersect
143 label own = owner[facei];
144 label nei = neighbour[facei];
147 label
diff = nei-own;
148 cellBandwidth[nei] =
max(cellBandwidth[nei],
diff);
151 bandwidth =
max(cellBandwidth);
155 forAll(cellBandwidth, celli)
157 profile += 1.0*cellBandwidth[celli];
160 sumSqrIntersect = 0.0;
161 if (calculateIntersect)
165 for (label colI = celli-cellBandwidth[celli]; colI <= celli; colI++)
167 nIntersect[colI] += 1.0;
192 forAll(cellOrder, newCelli)
194 label oldCelli = cellOrder[newCelli];
203 label facei = cFaces[i];
209 if (nbrCelli == newCelli)
214 if (newCelli < nbrCelli)
234 for (
const label index : order)
236 if (nbr[index] != -1)
238 oldToNewFace[cFaces[index]] = newFacei++;
244 for (label facei = newFacei; facei <
mesh.
nFaces(); facei++)
246 oldToNewFace[facei] = facei;
251 forAll(oldToNewFace, facei)
253 if (oldToNewFace[facei] == -1)
256 <<
"Did not determine new position" <<
" for face " << facei
280 label prevRegion = -1;
282 forAll(cellOrder, newCelli)
284 label oldCelli = cellOrder[newCelli];
286 if (cellToRegion[oldCelli] != prevRegion)
288 prevRegion = cellToRegion[oldCelli];
297 label facei = cFaces[i];
303 if (nbrCelli == newCelli)
308 if (cellToRegion[oldCelli] != cellToRegion[cellOrder[nbrCelli]])
313 else if (newCelli < nbrCelli)
337 oldToNewFace[cFaces[nbr.indices()[i]]] = newFacei++;
343 label nRegions =
max(cellToRegion)+1;
353 if (ownRegion != neiRegion)
356 min(ownRegion, neiRegion)*nRegions
357 +
max(ownRegion, neiRegion);
366 label
key = sortKey[i];
378 oldToNewFace[sortKey.indices()[i]] = newFacei++;
383 for (label facei = newFacei; facei <
mesh.
nFaces(); facei++)
385 oldToNewFace[facei] = facei;
390 forAll(oldToNewFace, facei)
392 if (oldToNewFace[facei] == -1)
395 <<
"Did not determine new position"
396 <<
" for face " << facei
438 forAll(newNeighbour, facei)
440 label own = newOwner[facei];
441 label nei = newNeighbour[facei];
445 newFaces[facei].flip();
446 std::swap(newOwner[facei], newNeighbour[facei]);
447 flipFaceFlux.insert(facei);
459 patchSizes[patchi] =
patches[patchi].size();
461 oldPatchNMeshPoints[patchi] =
patches[patchi].nPoints();
488 label oldFacei = fZone[i];
489 newAddressing[i] = reverseFaceOrder[oldFacei];
490 if (flipFaceFlux.found(newAddressing[i]))
492 newFlipMap[i] = !fZone.
flipMap()[i];
496 newFlipMap[i] = fZone.
flipMap()[i];
565 Info<<
"Determining cell order:" <<
endl;
567 labelList cellOrder(cellToRegion.size());
569 label nRegions =
max(cellToRegion)+1;
575 forAll(regionToCells, regioni)
577 Info<<
" region " << regioni <<
" starts at " << celli <<
endl;
585 const fvMesh& subMesh = subsetter.subMesh();
596 const labelList& cellMap = subsetter.cellMap();
600 cellOrder[celli++] = cellMap[subCellOrder[i]];
611 int main(
int argc,
char *argv[])
615 "Renumber mesh cells to reduce the bandwidth"
627 "Calculate the rms of the front-width"
639 Info<<
"renumberMesh built with zoltan support." <<
nl <<
endl;
640 (void)zoltanRenumber::typeName;
653 const bool readDict =
args.
found(
"dict");
654 const bool doFrontWidth =
args.
found(
"frontWidth");
655 const bool overwrite =
args.
found(
"overwrite");
667 scalar sumSqrIntersect;
692 <<
"Before renumbering :" <<
nl
693 <<
" band : " << band <<
nl
694 <<
" profile : " << profile <<
nl;
698 Info<<
" rms frontwidth : " << rmsFrontwidth <<
nl;
703 bool sortCoupledFaceCells =
false;
704 bool writeMaps =
false;
705 bool orderPoints =
false;
726 "sortCoupledFaceCells",
729 if (sortCoupledFaceCells)
731 Info<<
"Sorting cells on coupled boundaries to be last." <<
nl
738 Info<<
"Ordering cells into regions of size " << blockSize
739 <<
" (using decomposition);"
740 <<
" ordering faces into region-internal"
741 <<
" and region-external."
744 if (blockSize < 0 || blockSize >=
mesh.
nCells())
747 <<
"Block size " << blockSize
748 <<
" should be positive integer"
749 <<
" and less than the number of cells in the mesh."
754 orderPoints = renumberDict.
getOrDefault(
"orderPoints",
false);
757 Info<<
"Ordering points into internal and boundary points."
762 renumberDict.
readEntry(
"writeMaps", writeMaps);
765 Info<<
"Writing renumber maps (new to old) to polyMesh." <<
nl
771 Info<<
"Using default renumberMethod." <<
nl <<
endl;
776 Info<<
"Selecting renumberMethod " << renumberPtr().type() <<
nl
786 "cellProcAddressing",
800 "faceProcAddressing",
813 "pointProcAddressing",
826 "boundaryProcAddressing",
921 Info<<
"nBlocks = " << nBlocks <<
endl;
924 dictionary decomposeDict(renumberDictPtr().subDict(
"blockCoeffs"));
925 decomposeDict.set(
"numberOfSubdomains", nBlocks);
936 decomposePtr().decompose
954 Info<<
nl <<
"Written decomposition as volScalarField to "
955 <<
"cellDist for use in postprocessing."
959 cellOrder = regionRenumber(renumberPtr(),
mesh, cellToRegion);
962 faceOrder = getRegionFaceOrder
972 cellOrder = renumberPtr().renumber
978 if (sortCoupledFaceCells)
989 nBndCells += pbm[patchi].size();
1007 if (reverseCellOrder[celli] != -1)
1009 bndCells[nBndCells] = celli;
1010 bndCellMap[nBndCells++] =
1011 reverseCellOrder[celli];
1012 reverseCellOrder[celli] = -1;
1018 bndCellMap.setSize(nBndCells);
1029 label origCelli = bndCells[order[i]];
1030 newReverseCellOrder[origCelli] = --sortedI;
1033 Info<<
"Ordered all " << nBndCells
1034 <<
" cells with a coupled face"
1035 <<
" to the end of the cell list, starting at " << sortedI
1040 forAll(cellOrder, newCelli)
1042 label origCelli = cellOrder[newCelli];
1043 if (newReverseCellOrder[origCelli] == -1)
1045 newReverseCellOrder[origCelli] = sortedI++;
1055 faceOrder = getFaceOrder
1089 pointOrderMap().pointMap()
1094 pointOrderMap().reversePointMap(),
1095 const_cast<labelList&
>(map().reversePointMap())
1104 if (cellProcAddressing.headerOk())
1106 bool localOk = (cellProcAddressing.size() ==
mesh.
nCells());
1110 Info<<
"Renumbering processor cell decomposition map "
1111 << cellProcAddressing.name() <<
endl;
1120 Info<<
"Not writing inconsistent processor cell decomposition"
1121 <<
" map " << cellProcAddressing.filePath() <<
endl;
1136 Info<<
"Renumbering processor face decomposition map "
1146 for (
const label facei : fff)
1152 if (masterFacei == 0)
1155 <<
" masterFacei:" << masterFacei
1162 Info<<
"Not writing inconsistent processor face decomposition"
1172 if (pointProcAddressing.headerOk())
1174 bool localOk = (pointProcAddressing.size() ==
mesh.
nPoints());
1178 Info<<
"Renumbering processor point decomposition map "
1179 << pointProcAddressing.name() <<
endl;
1188 Info<<
"Not writing inconsistent processor point decomposition"
1189 <<
" map " << pointProcAddressing.filePath() <<
endl;
1198 if (boundaryProcAddressing.headerOk())
1202 boundaryProcAddressing.size()
1211 Info<<
"Not writing inconsistent processor patch decomposition"
1212 <<
" map " << boundaryProcAddressing.filePath() <<
endl;
1225 if (map().hasMotionPoints())
1234 scalar sumSqrIntersect;
1256 Info<<
"After renumbering :" <<
nl
1257 <<
" band : " << band <<
nl
1258 <<
" profile : " << profile <<
nl;
1263 Info<<
" rms frontwidth : " << rmsFrontwidth <<
nl;
1308 <<
" total : " << nTotPoints <<
nl
1309 <<
" internal: " << nTotIntPoints <<
nl
1310 <<
" boundary: " << nTotPoints-nTotIntPoints <<
nl
1312 <<
" total : " << nTotEdges <<
nl
1313 <<
" internal: " << nTotIntEdges <<
nl
1314 <<
" internal using 0 boundary points: "
1315 << nTotInt0Edges <<
nl
1316 <<
" internal using 1 boundary points: "
1317 << nTotInt1Edges-nTotInt0Edges <<
nl
1318 <<
" internal using 2 boundary points: "
1319 << nTotIntEdges-nTotInt1Edges <<
nl
1320 <<
" boundary: " << nTotEdges-nTotIntEdges <<
nl
1354 refData.updateMesh(map());
1382 <<
"Written current cellID and origCellID as volScalarField"
1383 <<
" for use in postprocessing." <<
nl <<
endl;
static autoPtr< T > New(Args &&... args)
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
PtrList< labelIOList > & faceProcAddressing
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
A class for handling words, derived from Foam::string.
label nInternal0Edges() const
const boolList & flipMap() const noexcept
virtual bool write(const bool valid=true) const
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
wordList ReadFields(const typename GeoMesh::Mesh &mesh, const IOobjectList &objects, PtrList< GeometricField< Type, PatchField, GeoMesh >> &fields, const bool syncPar=true, const bool readOldTime=false)
A class for managing temporary objects.
Given the original mesh and the list of selected cells, it creates the mesh consisting only of the de...
static constexpr const zero Zero
virtual void resetAddressing(const labelUList &addr, const bool flipMapValue)
const word dictName("faMeshDefinition")
static const pointMesh & New(const polyMesh &mesh, Args &&... args)
static word timeName(const scalar t, const int precision=precision_)
const cellList & cells() const
Direct mesh changes based on v1.3 polyTopoChange syntax.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
static void addNote(const string ¬e)
const fileName & facesInstance() const
label nInternal1Edges() const
virtual tmp< scalarField > movePoints(const pointField &)
const polyBoundaryMesh & boundaryMesh() const
Ostream & endl(Ostream &os)
const edgeList & edges() const
A HashTable with keys but without contents that is similar to std::unordered_set.
IOList< label > labelIOList
Label container classes.
label min(const labelHashSet &set, label minValue=labelMax)
labelList invert(const label len, const labelUList &map)
void inplaceRenumber(const labelUList &oldToNew, IntListType &input)
Mesh consisting of general polyhedral cells.
label nPoints() const noexcept
scalar diff(const triad &A, const triad &B)
const fileName & pointsInstance() const
virtual labelList renumber(const pointField &) const
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
static void noFunctionObjects(bool addWithOption=false)
label nCells() const noexcept
virtual void updateMesh(const mapPolyMesh &morphMap)
UIndirectList< bool > boolUIndList
UIndirectList of bools.
Generic templated field type.
virtual bool write(const bool valid=true) const
label nInternalPoints() const noexcept
A subset of mesh faces organised as a primitive patch.
UPtrList< const labelUList > faceCells() const
label nInternalEdges() const
const cellZoneMesh & cellZones() const noexcept
void setSize(const label n)
Foam::PtrList< Foam::fvMesh > meshes(regionNames.size())
virtual const labelList & faceOwner() const
instantList times() const
virtual void updateMesh(const mapPolyMesh &mpm)
void resetPrimitives(autoPtr< pointField > &&points, autoPtr< faceList > &&faces, autoPtr< labelList > &&owner, autoPtr< labelList > &&neighbour, const labelUList &patchSizes, const labelUList &patchStarts, const bool validBoundary=true)
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
const faceZoneMesh & faceZones() const noexcept
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
label max(const labelHashSet &set, label maxValue=labelMin)
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))
Various for reading/decomposing/reconstructing/distributing refinement data.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A list that is sorted upon construction or when explicitly requested with the sort() method.
Generic dimensioned Type class.
Mesh data needed to do the Finite Volume discretisation.
errorManip< error > abort(error &err)
List of IOobjects with searching and retrieving facilities.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Abstract base class for renumbering.
void reset(autoPtr< T > &&other) noexcept
const word & name() const noexcept
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
List< labelList > labelListList
A List of labelList.
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
const vectorField & cellCentres() const
bool isInternalFace(const label faceIndex) const noexcept
virtual const faceList & faces() const
#define FatalErrorInFunction
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Field reading functions for post-processing utilities.
label nInternalFaces() const noexcept
static bool & parRun() noexcept
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
dimensionedScalar sqrt(const dimensionedScalar &ds)
virtual void setTime(const Time &t)
static void removeFiles(const polyMesh &mesh)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
labelList identity(const label len, label start=0)
static autoPtr< decompositionMethod > New(const dictionary &decompDict, const word ®ionName="")
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
const polyBoundaryMesh & patches
void write(vtk::formatter &fmt, const Type &val, const label n=1)
word name(const expressions::valueTypeCode typeCode)
#define forAllReverse(list, i)
const Time & time() const
A List with indirect addressing.
label nTotalCells() const noexcept
label nFaces() const noexcept
static autoPtr< renumberMethod > New(const dictionary &renumberDict)
labelList sortedOrder(const UList< T > &input)
bool coupled(solutionDict.getOrDefault("coupledEnergyField", false))
const globalMeshData & globalData() const
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Generic GeometricField class.
Cuthill-McKee renumbering.
static void addOption(const word &optName, const string ¶m="", const string &usage="", bool advanced=false)
Foam::argList args(argc, argv)
labelListList invertOneToMany(const label len, const labelUList &map)
A cell is defined as a list of faces with extra functionality.
Smooth ATC in cells next to a set of patches supplied by type.
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
virtual const labelList & faceNeighbour() const
const dimensionSet dimless
bool found(const word &optName) const
const word & name() const
UIndirectList< label > labelUIndList
UIndirectList of labels.
Cell-face mesh analysis engine.