56Foam::procFacesGAMGProcAgglomeration::singleCellMesh
58 const label singleCellMeshComm,
60 scalarField& faceWeights
71 if (interfaces.set(intI))
73 const processorLduInterface& pp =
74 refCast<const processorLduInterface>
78 label size = interfaces[intI].faceCells().size();
79 myNeighbours.insert(pp.neighbProcNo(), size);
86 autoPtr<lduPrimitiveMesh> singleCellMeshPtr;
93 DynamicList<label> l(3*nCells);
94 DynamicList<label> u(3*nCells);
95 DynamicList<scalar> weight(3*nCells);
97 DynamicList<label> nbrs;
98 DynamicList<scalar> weights;
102 const Map<label>& neighbours = procFaces[proci];
109 if (iter.key() > proci)
111 nbrs.append(iter.key());
112 weights.append(iter());
119 weight.append(weights[i]);
124 faceWeights.transfer(weight);
126 PtrList<const lduInterface> primitiveInterfaces(0);
129 singleCellMeshPtr.reset
142 return singleCellMeshPtr;
147Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
159 autoPtr<lduPrimitiveMesh> singleCellMeshPtr
169 tmp<labelField> tfineToCoarse(
new labelField(0));
170 labelField& fineToCoarse = tfineToCoarse.ref();
172 if (singleCellMeshPtr)
175 const lduPrimitiveMesh& singleCellMesh = *singleCellMeshPtr;
186 forAll(fineToCoarse, celli)
188 label coarseI = fineToCoarse[celli];
189 coarseToMaster[coarseI] =
min(coarseToMaster[coarseI], celli);
202 return tfineToCoarse;
206bool Foam::procFacesGAMGProcAgglomeration::doProcessorAgglomeration
227 nAgglomeratingCells_(
controlDict.get<label>(
"nAgglomeratingCells"))
251 Pout<<
nl <<
"Starting mesh overview" <<
endl;
252 printStats(
Pout, agglom_);
255 if (agglom_.size() >= 1)
261 label fineLevelIndex = 2;
262 fineLevelIndex < agglom_.size();
266 if (agglom_.hasMeshLevel(fineLevelIndex))
269 const lduMesh& levelMesh = agglom_.meshLevel(fineLevelIndex);
271 label levelComm = levelMesh.
comm();
274 if (nProcs > 1 && doProcessorAgglomeration(levelMesh))
278 processorAgglomeration(levelMesh)
280 const labelField& procAgglomMap = tprocAgglomMap();
325 Pout<<
nl <<
"Agglomerated mesh overview" <<
endl;
326 printStats(
Pout, agglom_);
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.
static void calculateRegionMaster(const label comm, const labelList &procAgglomMap, labelList &masterProcs, List< label > &agglomProcIDs)
Given fine to coarse processor map determine:
Processor agglomeration of GAMGAgglomerations.
virtual bool agglomerate()=0
Modify agglomeration. Return true if modified.
label nProcs() const noexcept
Number of ranks associated with PstreamBuffers.
static void allGatherList(const List< commsStruct > &comms, List< T > &values, const int tag, const label comm)
static void scatter(const List< commsStruct > &comms, T &value, const int tag, const label comm)
Broadcast data: Distribute without modification.
T & last()
Return the last element of the list.
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
static int & msgType() noexcept
Message tag of standard messages.
static label allocateCommunicator(const label parent, const labelList &subRanks, const bool doPstream=true)
Allocate a new communicator.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
virtual lduInterfacePtrsList interfaces() const
Return a list of pointers for each patch.
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
virtual label comm() const
Return communicator used for parallel communication.
label size() const
Return number of equations.
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
virtual label comm() const =0
Return communicator used for parallel communication.
void reduce(T &Value, const BinaryOp &bop) const
Helper: reduce with current communicator.
Processor agglomeration of GAMGAgglomerations. Needs nAgglomeratingCells which is when to start agglo...
virtual bool agglomerate()
Modify agglomeration. Return true if modified.
virtual ~procFacesGAMGProcAgglomeration()
Destructor.
int myProcNo() const noexcept
Return processor number.
splitCell * master() const
A class for managing temporary objects.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
runTime controlDict().readEntry("adjustTimeStep"
List< label > labelList
A List of labels.
List< lduScheduleEntry > lduSchedule
A List of lduSchedule entries.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
UPtrList< const lduInterface > lduInterfacePtrsList
Store lists of lduInterface as a UPtrList.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
void sort(UList< T > &list)
Sort the list.
Field< label > labelField
Specialisation of Field<T> for label.
static constexpr const zero Zero
Global zero (0)
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
UIndirectList< label > labelUIndList
UIndirectList of labels.
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.