Go to the documentation of this file.
46 GAMGProcAgglomeration,
47 procFacesGAMGProcAgglomeration,
56 Foam::procFacesGAMGProcAgglomeration::singleCellMesh
58 const label singleCellMeshComm,
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);
87 autoPtr<lduPrimitiveMesh> singleCellMeshPtr;
94 DynamicList<label> l(3*nCells);
95 DynamicList<label> u(3*nCells);
96 DynamicList<scalar> weight(3*nCells);
98 DynamicList<label> nbrs;
99 DynamicList<scalar> weights;
103 const Map<label>& neighbours = procFaces[proci];
110 if (iter.key() > proci)
112 nbrs.append(iter.key());
113 weights.append(iter());
120 weight.append(weights[i]);
125 faceWeights.transfer(weight);
127 PtrList<const lduInterface> primitiveInterfaces(0);
130 singleCellMeshPtr.reset
143 return singleCellMeshPtr;
148 Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
160 autoPtr<lduPrimitiveMesh> singleCellMeshPtr
170 tmp<labelField> tfineToCoarse(
new labelField(0));
171 labelField& fineToCoarse = tfineToCoarse.ref();
173 if (singleCellMeshPtr)
176 const lduPrimitiveMesh& singleCellMesh = *singleCellMeshPtr;
187 forAll(fineToCoarse, celli)
189 label coarseI = fineToCoarse[celli];
190 coarseToMaster[coarseI] =
min(coarseToMaster[coarseI], celli);
203 return tfineToCoarse;
207 bool Foam::procFacesGAMGProcAgglomeration::doProcessorAgglomeration
221 Foam::procFacesGAMGProcAgglomeration::procFacesGAMGProcAgglomeration
228 nAgglomeratingCells_(
controlDict.get<label>(
"nAgglomeratingCells"))
252 Pout<<
nl <<
"Starting mesh overview" <<
endl;
253 printStats(
Pout, agglom_);
256 if (agglom_.size() >= 1)
262 label fineLevelIndex = 2;
263 fineLevelIndex < agglom_.size();
267 if (agglom_.hasMeshLevel(fineLevelIndex))
270 const lduMesh& levelMesh = agglom_.meshLevel(fineLevelIndex);
272 label levelComm = levelMesh.
comm();
275 if (nProcs > 1 && doProcessorAgglomeration(levelMesh))
279 processorAgglomeration(levelMesh)
281 const labelField& procAgglomMap = tprocAgglomMap();
326 Pout<<
nl <<
"Agglomerated mesh overview" <<
endl;
327 printStats(
Pout, agglom_);
int debug
Static debugging option.
addToRunTimeSelectionTable(decompositionMethod, kahipDecomp, dictionary)
List< label > labelList
A List of labels.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
List< lduScheduleEntry > lduSchedule
Geometric agglomerated algebraic multigrid agglomeration class.
A class for managing temporary objects.
static constexpr const zero Zero
Global zero (0)
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
static bool master(const label communicator=worldComm)
Am I the master process.
void agglomerate(const lduMesh &mesh, const scalarField &faceWeights)
Agglomerate all levels starting from the given face weights.
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
Ostream & endl(Ostream &os)
Add newline and flush stream.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
label size() const
Return number of equations.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
#define forAll(list, i)
Loop across all elements in list.
static void calculateRegionMaster(const label comm, const labelList &procAgglomMap, labelList &masterProcs, List< label > &agglomProcIDs)
Given fine to coarse processor map determine:
virtual label comm() const
Return communicator used for parallel communication.
static label allocateCommunicator(const label parent, const labelList &subRanks, const bool doPstream=true)
Allocate a new communicator.
Field< label > labelField
Specialisation of Field<T> for label.
virtual const lduAddressing & lduAddr() const
Return ldu addressing.
virtual bool agglomerate()=0
Modify agglomeration. Return true if modified.
runTime controlDict().readEntry("adjustTimeStep"
virtual bool agglomerate()
Modify agglomeration. Return true if modified.
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
void reduce(T &Value, const BinaryOp &bop) const
Helper: reduce with current communicator.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
static int & msgType() noexcept
Message tag of standard messages.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
forAllConstIters(mixture.phases(), phase)
virtual ~procFacesGAMGProcAgglomeration()
Destructor.
virtual label comm() const =0
Return communicator used for parallel communication.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
labelList sortedOrder(const UList< T > &input)
Return the (stable) sort order for the list.
Processor agglomeration of GAMGAgglomerations.
defineTypeNameAndDebug(combustionModel, 0)
static label nProcs(const label communicator=worldComm)
Number of processes in parallel run, and 1 for serial run.
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
UPtrList< const lduInterface > lduInterfacePtrsList
List of coupled interface fields to be used in coupling.
UIndirectList< label > labelUIndList
UIndirectList of labels.