78 Info<<
"GAMGAgglomeration:" <<
nl
79 <<
" local agglomerator : " <<
type() <<
nl;
82 Info<<
" processor agglomerator : "
88 <<
setw(20) <<
"nFaces/nCells"
89 <<
setw(20) <<
"nInterfaces"
90 <<
setw(20) <<
"nIntFaces/nCells"
91 <<
setw(12) <<
"profile"
94 <<
setw(8) <<
"nProcs"
110 <<
setw(8) <<
"-----"
111 <<
setw(8) <<
"------"
129 for (
label levelI = 0; levelI <=
size(); levelI++)
133 scalar faceCellRatio = 0;
134 label nInterfaces = 0;
137 scalar profile = 0.0;
152 if (interfaces.
set(i))
155 nIntFaces += interfaces[i].faceCells().
size();
158 ratio = scalar(nIntFaces)/
nCells;
168 scalar maxFaceCellRatio =
170 scalar totFaceCellRatio =
181 int oldPrecision =
Info().precision(4);
184 <<
setw(8) << totNprocs
186 <<
setw(8) << totNCells/totNprocs
187 <<
setw(8) << maxNCells
189 <<
setw(8) << totFaceCellRatio/totNprocs
190 <<
setw(8) << maxFaceCellRatio
192 <<
setw(8) << scalar(totNInt)/totNprocs
193 <<
setw(8) << maxNInt
195 <<
setw(8) << totRatio/totNprocs
196 <<
setw(8) << maxRatio
197 <<
setw(12) << totProfile/totNprocs
200 Info().precision(oldPrecision);
209 const label nFineCells,
210 const label nCoarseCells
221 return nTotalCoarseCells < nTotalFineCells;
243 nCellsInCoarsestLevel_
247 meshInterfaces_(mesh.interfaces()),
264 restrictAddressing_(maxLevels_),
266 faceRestrictAddressing_(maxLevels_),
267 faceFlipMap_(maxLevels_),
268 nPatchFaces_(maxLevels_),
269 patchFaceRestrictAddressing_(maxLevels_),
271 meshLevels_(maxLevels_)
296 GAMGAgglomeration::typeName
300 const word agglomeratorType
308 "geometricGAMGAgglomerationLibs",
309 lduMeshConstructorTablePtr_
312 lduMeshConstructorTable::iterator cstrIter =
313 lduMeshConstructorTablePtr_->find(agglomeratorType);
315 if (cstrIter == lduMeshConstructorTablePtr_->end())
318 <<
"Unknown GAMGAgglomeration type "
319 << agglomeratorType <<
".\n"
320 <<
"Valid matrix GAMGAgglomeration types are :"
321 << lduMatrixConstructorTablePtr_->sortedToc() <<
endl
322 <<
"Valid geometric GAMGAgglomeration types are :"
323 << lduMeshConstructorTablePtr_->sortedToc()
333 GAMGAgglomeration::typeName
351 GAMGAgglomeration::typeName
355 const word agglomeratorType
363 "algebraicGAMGAgglomerationLibs",
364 lduMatrixConstructorTablePtr_
369 !lduMatrixConstructorTablePtr_
370 || !lduMatrixConstructorTablePtr_->found(agglomeratorType)
377 lduMatrixConstructorTable::iterator cstrIter =
378 lduMatrixConstructorTablePtr_->find(agglomeratorType);
380 return store(cstrIter()(matrix,
controlDict).ptr());
387 GAMGAgglomeration::typeName
401 const word agglomeratorType
409 "geometricGAMGAgglomerationLibs",
410 geometryConstructorTablePtr_
413 geometryConstructorTable::iterator cstrIter =
414 geometryConstructorTablePtr_->find(agglomeratorType);
416 if (cstrIter == geometryConstructorTablePtr_->end())
419 <<
"Unknown GAMGAgglomeration type "
420 << agglomeratorType <<
".\n"
421 <<
"Valid geometric GAMGAgglomeration types are :"
422 << geometryConstructorTablePtr_->sortedToc()
458 return meshLevels_[i - 1];
471 return meshLevels_.set(i - 1);
483 return meshInterfaces_;
487 return meshLevels_[i - 1].rawInterfaces();
496 meshLevels_.set(i - 1,
nullptr);
498 if (i < nCells_.size())
501 restrictAddressing_.set(i,
nullptr);
503 faceRestrictAddressing_.set(i,
nullptr);
504 faceFlipMap_.set(i,
nullptr);
505 nPatchFaces_.set(i,
nullptr);
506 patchFaceRestrictAddressing_.set(i,
nullptr);
517 return procAgglomMap_[leveli];
526 return agglomProcIDs_[leveli];
532 return procCommunicator_[leveli] != -1;
538 return procCommunicator_[leveli];
547 return procCellOffsets_[leveli];
556 return procFaceMap_[leveli];
565 return procBoundaryMap_[leveli];
574 return procBoundaryFaceMap_[leveli];
587 if (fineAddressing.
size() != restrict.
size())
590 <<
"nCells:" << fineAddressing.
size()
591 <<
" agglom:" << restrict.
size()
608 label own = lower[facei];
609 label nei = upper[facei];
611 if (restrict[own] == restrict[nei])
615 if (master[own] < master[nei])
617 master[nei] = master[own];
620 else if (master[own] > master[nei])
622 master[own] = master[nei];
642 labelList& masters = coarseToMasters[restrict[celli]];
644 if (
findIndex(masters, master[celli]) == -1)
646 masters.
append(master[celli]);
651 if (nNewCoarse > nCoarse)
662 nNewCoarse = nCoarse;
664 forAll(coarseToMasters, coarseI)
666 const labelList& masters = coarseToMasters[coarseI];
668 labelList& newCoarse = coarseToNewCoarse[coarseI];
670 newCoarse[0] = coarseI;
673 newCoarse[i] = nNewCoarse++;
680 label coarseI = restrict[celli];
683 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...
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.
const label maxLevels_
Max number of levels.
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 > agglomProcIDs_
Per level the set of processors to agglomerate. Element 0 is.
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.
Processor agglomeration of GAMGAgglomerations.
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.
Inter-processor communications stream.
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 keyword definitions, which are a keyword followed by any number of values (e....
bool open(const fileName &libName, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
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 const objectRegistry & thisDb() const
Return the object registry.
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.
#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.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
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)
errorManip< error > abort(error &err)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
defineTypeNameAndDebug(combustionModel, 0)
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
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.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
runTime controlDict().lookup("adjustTimeStep") >> adjustTimeStep