52Foam::structuredRenumber::structuredRenumber
59 patches_(coeffsDict_.get<
wordRes>(
"patches")),
60 nLayers_(coeffsDict_.getOrDefault<label>(
"nLayers",
labelMax)),
61 depthFirst_(coeffsDict_.get<bool>(
"depthFirst")),
62 reverse_(coeffsDict_.getOrDefault(
"reverse", false)),
69bool Foam::structuredRenumber::layerLess::operator()
75 const auto& ta = distance_[a];
76 const auto& tb = distance_[
b];
86 if (ta.data() < tb.data())
91 else if (ta.data() > tb.data())
98 return ta.distance() < tb.distance();
103 if (ta.distance() < tb.distance())
107 else if (ta.distance() > tb.distance())
114 return ta.data() < tb.data();
132 return order_[a] < order_[
b];
143 const polyBoundaryMesh&
pbm =
mesh.boundaryMesh();
149 nFaces +=
pbm[patchi].size();
160 label nTotalSeeds =
returnReduce(patchCells.size(), sumOp<label>());
162 label nTotalCells =
mesh.globalData().nTotalCells();
163 const label nLayers = nTotalCells/nTotalSeeds;
165 Info<<
type() <<
" : seeding " << nTotalSeeds
166 <<
" cells on (estimated) " << nLayers <<
" layers" <<
nl
176 fvMeshSubset subsetter
178 dynamic_cast<const fvMesh&
>(
mesh),
182 const labelList& cellMap = subsetter.cellMap();
185 labelList subOrder = method_().renumber(subsetter.subMesh());
189 const globalIndex globalSubCells(subOrder.size());
194 orderedToOld[cellMap[i]] =
195 globalSubCells.toGlobal(subOrigToOrdered[i]);
202 List<topoDistanceData<label>> patchData(nFaces);
206 const polyPatch&
pp =
pbm[patchi];
210 patchFaces[nFaces] =
pp.start()+i;
211 patchData[nFaces] = topoDistanceData<label>
221 List<topoDistanceData<label>> cellData(
mesh.nCells());
222 List<topoDistanceData<label>> faceData(
mesh.nFaces());
225 OppositeFaceCellWave<topoDistanceData<label>> deltaCalc
235 deltaCalc.iterate(nLayers_);
237 Info<<
type() <<
" : did not visit "
238 << deltaCalc.nUnvisitedCells()
239 <<
" cells out of " << nTotalCells
240 <<
"; using " << method_().type() <<
" renumbering for these" <<
endl;
256 layerLess(depthFirst_, oldToOrdered, cellData)
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
const polyBoundaryMesh & pbm
label nUnvisitedCells() const noexcept
Get number of unvisited cells, i.e. cells that were not (yet) reached from walking across mesh.
virtual label iterate(const label maxIter)
Iterate until no changes or maxIter reached.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Version of FaceCellWave that walks through prismatic cells only.
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Smooth ATC in cells next to a set of patches supplied by type.
Holds a reference to the original mesh (the baseMesh) and optionally to a subset of that mesh (the su...
const labelList & cellMap() const
Return cell map.
const fvMesh & subMesh() const
Return reference to subset mesh.
Mesh data needed to do the Finite Volume discretisation.
Calculates a non-overlapping list of offsets based on an input size (eg, number of cells) from differ...
label toGlobal(const label proci, const label i) const
From local to global on proci.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
Abstract base class for renumbering.
static autoPtr< renumberMethod > New(const dictionary &dict)
Construct/select a renumbering method.
renumberMethod()
Default construct.
Function class for sorting according to column and layer.
Renumbering according to mesh layers. depthFirst = true: first column gets ids 0.....
virtual labelList renumber(const polyMesh &mesh) const
Return the cell visit order (from ordered back to original cell id).
For use with FaceCellWave. Determines topological distance to starting faces. Templated on passive tr...
A List of wordRe with additional matching capabilities.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
void reverse(UList< T > &list, const label n)
Reverse the first n elements of the list.
messageStream Info
Information stream (stdout output on master, null elsewhere).
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
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 word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
UList< label > labelUList
A UList of labels.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.