51void Foam::MGridGenGAMGAgglomeration::swap
53 const lduInterfacePtrsList& interfaces,
54 const labelUList& cellValues,
55 PtrList<labelList>& nbrValues
63 if (interfaces.set(inti))
65 interfaces[inti].initInternalFieldTransfer
79 nbrValues.setSize(interfaces.size());
82 if (interfaces.set(inti))
89 interfaces[inti].internalFieldTransfer
101void Foam::MGridGenGAMGAgglomeration::getNbrAgglom
103 const lduAddressing& addr,
105 const PtrList<labelList>& nbrGlobalAgglom,
109 cellToNbrAgglom.setSize(addr.size());
110 cellToNbrAgglom = -1;
114 if (interfaces.set(inti))
116 if (isA<processorLduInterface>(interfaces[inti]))
118 const processorLduInterface& pldui =
119 refCast<const processorLduInterface>(interfaces[inti]);
121 if (pldui.myProcNo() > pldui.neighbProcNo())
124 interfaces[inti].faceCells();
125 const labelList& nbrData = nbrGlobalAgglom[inti];
129 cellToNbrAgglom[faceCells[i]] = nbrData[i];
138void Foam::MGridGenGAMGAgglomeration::detectSharedFaces
150 sharedFaces.resize(addr.lowerAddr().size()/100);
155 label lowerData = value[
lower[facei]];
156 label upperData = value[
upper[facei]];
158 if (lowerData != -1 && lowerData == upperData)
160 sharedFaces.insert(facei);
183 label nProcConsistencyIter
212 magSb[own[facei]] +=
mag(Sf[facei]);
220 label nCreatedLevels = 0;
224 label nCoarseCells = -1;
238 for (
int i=0; i<nProcConsistencyIter; i++)
252 globalAgglom[celli] = globalNumbering.
toGlobal(agglom[celli]);
257 swap(interfaces, globalAgglom, nbrGlobalAgglom);
263 getNbrAgglom(addr, interfaces, nbrGlobalAgglom, cellToNbrAgglom);
268 detectSharedFaces(
mesh, cellToNbrAgglom, sharedFaces);
275 for (
const label facei : sharedFaces)
277 weights[facei] *= 2.0;
281 finalAgglomPtr = agglomerate
295 nCells_[nCreatedLevels] = nCoarseCells;
341 magSfPtr = aggMagSfPtr;
352 restrictField(*aggMagSbPtr, *magSbPtr, nCreatedLevels,
false);
355 magSbPtr = aggMagSbPtr;
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Geometric agglomerated algebraic multigrid agglomeration class.
void restrictField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex, const bool procAgglom) const
Restrict (integrate by summation) cell field.
void agglomerateLduAddressing(const label fineLevelIndex)
Assemble coarse mesh addressing.
const label maxLevels_
Max number of levels.
void compactLevels(const label nCreatedLevels)
Shrink the number of levels to that specified.
PtrList< lduPrimitiveMesh > meshLevels_
Hierarchy of mesh addressing.
bool continueAgglomerating(const label nCells, const label nCoarseCells) const
Check the need for further agglomeration.
labelList nCells_
The number of cells in each level.
void restrictFaceField(Field< Type > &cf, const Field< Type > &ff, const label fineLevelIndex) const
Restrict (integrate by summation) face field.
PtrList< labelField > restrictAddressing_
Cell restriction addressing array.
const lduMesh & meshLevel(const label leveli) const
Return LDU mesh of given level.
Agglomerate using the MGridGen algorithm.
const lduMesh & mesh() const
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
SubField is a Field obtained as a section of another Field, without its own allocation....
@ nonBlocking
"nonBlocking"
static label nRequests()
Get number of outstanding requests.
static void waitRequests(const label start=0)
Wait until all requests (from start onwards) have finished.
static bool & parRun() noexcept
Test if this a parallel run.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
label toGlobal(const label i) const
From local to global index.
The class contains the addressing required by the lduMatrix: upper, lower and losort.
label size() const
Return number of equations.
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
virtual const lduAddressing & lduAddr() const =0
Return ldu addressing.
virtual lduInterfacePtrsList interfaces() const =0
virtual const labelList & faceOwner() const
Return face owner.
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
const scalarField & cellVolumes() const
label nInternalFaces() const noexcept
Number of internal faces.
label nCells() const noexcept
Number of mesh cells.
const vectorField & faceAreas() const
A class for managing temporary objects.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
runTime controlDict().readEntry("adjustTimeStep"
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
To & refCast(From &r)
Reference type cast template function.
List< label > labelList
A List of labels.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
static constexpr const zero Zero
Global zero (0)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.