76 Info<<
"GAMGAgglomeration:" <<
nl
77 <<
" cell agglomerator : " <<
type() <<
nl;
80 Info<<
" processor agglomerator : "
86 <<
setw(20) <<
"nFaces/nCells"
87 <<
setw(20) <<
"nInterfaces"
88 <<
setw(20) <<
"nIntFaces/nCells"
89 <<
setw(12) <<
"profile"
92 <<
setw(8) <<
"nProcs"
108 <<
setw(8) <<
"-----"
109 <<
setw(8) <<
"------"
127 for (
label levelI = 0; levelI <=
size(); levelI++)
131 scalar faceCellRatio = 0;
132 label nInterfaces = 0;
135 scalar profile = 0.0;
150 if (interfaces.
set(i))
153 nIntFaces += interfaces[i].faceCells().
size();
156 ratio = scalar(nIntFaces)/
nCells;
166 scalar maxFaceCellRatio =
168 scalar totFaceCellRatio =
179 int oldPrecision =
Info().precision(4);
182 <<
setw(8) << totNprocs
184 <<
setw(8) << totNCells/totNprocs
185 <<
setw(8) << maxNCells
187 <<
setw(8) << totFaceCellRatio/totNprocs
188 <<
setw(8) << maxFaceCellRatio
190 <<
setw(8) << scalar(totNInt)/totNprocs
191 <<
setw(8) << maxNInt
193 <<
setw(8) << totRatio/totNprocs
194 <<
setw(8) << maxRatio
195 <<
setw(12) << totProfile/totNprocs
198 Info().precision(oldPrecision);
207 const label nFineCells,
208 const label nCoarseCells
217 processorAgglomerate()
218 ? minCellsPerProcessor_
228 return nTotalCoarseCells < nTotalFineCells;
250 minCellsPerProcessor_
254 {
"minCellsPerProcessor",
"nCellsInCoarsestLevel"},
274 restrictAddressing_(maxLevels_),
276 faceRestrictAddressing_(maxLevels_),
277 faceFlipMap_(maxLevels_),
278 nPatchFaces_(maxLevels_),
279 patchFaceRestrictAddressing_(maxLevels_),
281 meshLevels_(maxLevels_)
283 procCommunicator_.setSize(maxLevels_ + 1, -1);
284 if (processorAgglomerate())
286 procAgglomMap_.setSize(maxLevels_);
287 agglomProcIndices_.setSize(maxLevels_);
288 procCellOffsets_.setSize(maxLevels_);
289 procFaceMap_.setSize(maxLevels_);
290 procBoundaryMap_.setSize(maxLevels_);
291 procBoundaryFaceMap_.setSize(maxLevels_);
310 const word agglomeratorType
318 "geometricGAMGAgglomerationLibs",
319 lduMeshConstructorTablePtr_
322 lduMeshConstructorTable::iterator cstrIter =
323 lduMeshConstructorTablePtr_->find(agglomeratorType);
325 if (cstrIter == lduMeshConstructorTablePtr_->end())
328 <<
"Unknown GAMGAgglomeration type "
329 << agglomeratorType <<
".\n"
330 <<
"Valid matrix GAMGAgglomeration types are :"
331 << lduMatrixConstructorTablePtr_->sortedToc() <<
endl
332 <<
"Valid geometric GAMGAgglomeration types are :"
333 << lduMeshConstructorTablePtr_->sortedToc()
365 const word agglomeratorType
373 "algebraicGAMGAgglomerationLibs",
374 lduMatrixConstructorTablePtr_
379 !lduMatrixConstructorTablePtr_
380 || !lduMatrixConstructorTablePtr_->found(agglomeratorType)
387 lduMatrixConstructorTable::iterator cstrIter =
388 lduMatrixConstructorTablePtr_->find(agglomeratorType);
390 return store(cstrIter()(matrix,
controlDict).ptr());
411 const word agglomeratorType
419 "geometricGAMGAgglomerationLibs",
420 geometryConstructorTablePtr_
423 geometryConstructorTable::iterator cstrIter =
424 geometryConstructorTablePtr_->find(agglomeratorType);
426 if (cstrIter == geometryConstructorTablePtr_->end())
429 <<
"Unknown GAMGAgglomeration type "
430 << agglomeratorType <<
".\n"
431 <<
"Valid geometric GAMGAgglomeration types are :"
432 << geometryConstructorTablePtr_->sortedToc()
468 return meshLevels_[i - 1];
481 return meshLevels_.set(i - 1);
493 return meshInterfaces_;
497 return meshLevels_[i - 1].rawInterfaces();
506 meshLevels_.set(i - 1,
nullptr);
508 if (i < nCells_.size())
511 restrictAddressing_.set(i,
nullptr);
513 faceRestrictAddressing_.set(i,
nullptr);
514 faceFlipMap_.set(i,
nullptr);
515 nPatchFaces_.set(i,
nullptr);
516 patchFaceRestrictAddressing_.set(i,
nullptr);
527 return procAgglomMap_[leveli];
536 return agglomProcIndices_[leveli];
542 return procCommunicator_[leveli] != -1;
548 return procCommunicator_[leveli];
557 return procCellOffsets_[leveli];
566 return procFaceMap_[leveli];
575 return procBoundaryMap_[leveli];
584 return procBoundaryFaceMap_[leveli];
597 if (fineAddressing.
size() != restrict.
size())
600 <<
"nCells:" << fineAddressing.
size()
601 <<
" agglom:" << restrict.
size()
618 label own = lower[facei];
619 label nei = upper[facei];
621 if (restrict[own] == restrict[nei])
625 if (master[own] < master[nei])
627 master[nei] = master[own];
630 else if (master[own] > master[nei])
632 master[own] = master[nei];
652 labelList& masters = coarseToMasters[restrict[celli]];
654 if (
findIndex(masters, master[celli]) == -1)
656 masters.
append(master[celli]);
661 if (nNewCoarse > nCoarse)
672 nNewCoarse = nCoarse;
674 forAll(coarseToMasters, coarseI)
676 const labelList& masters = coarseToMasters[coarseI];
678 labelList& newCoarse = coarseToNewCoarse[coarseI];
680 newCoarse[0] = coarseI;
683 newCoarse[i] = nNewCoarse++;
690 label coarseI = restrict[celli];
693 newRestrict[celli] = coarseToNewCoarse[coarseI][index];
Istream and Ostream manipulators taking arguments.
#define forAll(list, i)
Loop across all elements in list.
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
virtual const word & type() const
Runtime type information.
Geometric agglomerated algebraic multigrid agglomeration class.
bool processorAgglomerate() const
Whether to agglomerate across processors.
void clearLevel(const label leveli)
const labelListListList & boundaryFaceMap(const label fineLeveli) const
Mapping from processor to procMesh boundary face.
static const GAMGAgglomeration & New(const lduMesh &mesh, const dictionary &controlDict)
Return the selected geometric agglomerator.
~GAMGAgglomeration()
Destructor.
PtrList< labelListList > patchFaceRestrictAddressing_
Patch-local face restriction addressing array.
PtrList< boolList > faceFlipMap_
Face flip: for faces mapped to internal faces stores whether.
PtrList< labelList > nPatchFaces_
The number of (coarse) patch faces in each level.
PtrList< labelList > agglomProcIndices_
Per level the set of processors to agglomerate. Element 0 is.
const labelList & procAgglomMap(const label fineLeveli) const
Mapping from processor to agglomerated processor (global, all.
autoPtr< GAMGProcAgglomeration > procAgglomeratorPtr_
void compactLevels(const label nCreatedLevels)
Shrink the number of levels to that specified.
labelList nFaces_
The number of (coarse) faces in each level.
PtrList< lduPrimitiveMesh > meshLevels_
Hierarchy of mesh addressing.
const labelList & cellOffsets(const label fineLeveli) const
Mapping from processor to procMesh cells.
bool continueAgglomerating(const label nCells, const label nCoarseCells) const
Check the need for further agglomeration.
labelList nCells_
The number of cells in each level.
bool hasProcMesh(const label fineLeveli) const
Check that level has combined mesh.
const labelListList & faceMap(const label fineLeveli) const
Mapping from processor to procMesh face.
GAMGAgglomeration(const lduMesh &mesh, const dictionary &controlDict)
Construct given mesh and controls.
labelList procCommunicator_
Communicator for given level.
PtrList< labelList > procAgglomMap_
Per level, per processor the processor it agglomerates into.
PtrList< labelListList > procBoundaryMap_
Mapping from processor to procMeshLevel boundary.
const labelListList & boundaryMap(const label fineLeveli) const
Mapping from processor to procMesh boundary.
const labelList & agglomProcIDs(const label fineLeveli) const
Set of processors to agglomerate. Element 0 is the.
PtrList< labelList > procCellOffsets_
Mapping from processor to procMeshLevel cells.
PtrList< labelField > restrictAddressing_
Cell restriction addressing array.
PtrList< labelListList > procFaceMap_
Mapping from processor to procMeshLevel face.
PtrList< labelList > faceRestrictAddressing_
Face restriction addressing array.
static bool checkRestriction(labelList &newRestrict, label &nNewCoarse, const lduAddressing &fineAddressing, const labelUList &restrict, const label nCoarse)
Given restriction determines if coarse cells are connected.
const lduInterfacePtrsList & interfaceLevel(const label leveli) const
Return LDU interface addressing of given level.
bool hasMeshLevel(const label leveli) const
Do we have mesh for given level?
label nCells(const label leveli) const
Return number of coarse cells (before processor agglomeration)
label procCommunicator(const label fineLeveli) const
Communicator for current level or -1.
const lduMesh & meshLevel(const label leveli) const
Return LDU mesh of given level.
PtrList< labelListListList > procBoundaryFaceMap_
Mapping from processor to procMeshLevel boundary face.
static autoPtr< GAMGProcAgglomeration > New(GAMGAgglomeration &agglom, const dictionary &dict)
Return the selected agglomerator.
void append(const T &)
Append an element at the end of the list.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
label size() const
Return the number of elements in the UList.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
bool set(const label) const
Is element set.
label size() const
Return the number of elements in the UPtrList.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
bool open(const fileName &libName, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
virtual const objectRegistry & db() const
Return the object registry - resolve conflict polyMesh/lduMesh.
virtual label comm() const
Return communicator used for parallel communication.
virtual lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
Tuple2< label, scalar > band() const
Calculate bandwidth and profile of addressing.
label size() const
Return number of equations.
virtual const labelUList & upperAddr() const =0
Return upper addressing.
virtual const labelUList & lowerAddr() const =0
Return lower addressing.
lduMatrix is a general matrix class in which the coefficients are stored as three arrays,...
const lduMesh & mesh() const
Return the LDU mesh from which the addressing is obtained.
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
virtual lduInterfacePtrsList interfaces() const =0
Return a list of pointers for each patch.
virtual const lduAddressing & lduAddr() const =0
Return ldu addressing.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
bool foundObject(const word &name) const
Is the named Type in registry.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dlLibraryTable libs
Table of loaded dynamic libraries.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Omanip< int > setw(const int i)
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
errorManip< error > abort(error &err)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
defineRunTimeSelectionTable(fvConstraint, dictionary)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
labelList identityMap(const label len)
Create identity map (map[i] == i) of given length.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
tmp< DimensionedField< TypeR, GeoMesh, Field > > New(const tmp< DimensionedField< TypeR, GeoMesh, Field >> &tdf1, const word &name, const dimensionSet &dimensions)
runTime controlDict().lookup("adjustTimeStep") >> adjustTimeStep