43 GAMGProcAgglomeration,
44 procFacesGAMGProcAgglomeration,
53 Foam::procFacesGAMGProcAgglomeration::singleCellMesh
55 const label singleCellMeshComm,
68 if (interfaces.set(intI))
70 const processorLduInterface& pp =
71 refCast<const processorLduInterface>
75 label size = interfaces[intI].faceCells().size();
76 myNeighbours.insert(pp.neighbProcNo(), size);
84 autoPtr<lduPrimitiveMesh> singleCellMeshPtr;
91 DynamicList<label> l(3*nCells);
92 DynamicList<label> u(3*nCells);
93 DynamicList<scalar> weight(3*nCells);
95 DynamicList<label> nbrs;
96 DynamicList<scalar> weights;
100 const Map<label>& neighbours = procFaces[proci];
107 if (iter.key() > proci)
109 nbrs.append(iter.key());
110 weights.append(iter());
117 weight.append(weights[i]);
122 faceWeights.transfer(weight);
124 PtrList<const lduInterface> primitiveInterfaces(0);
127 singleCellMeshPtr.reset
140 return singleCellMeshPtr;
145 Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
157 autoPtr<lduPrimitiveMesh> singleCellMeshPtr
167 tmp<labelField> tfineToCoarse(
new labelField(0));
168 labelField& fineToCoarse = tfineToCoarse.ref();
170 if (singleCellMeshPtr.valid())
173 const lduPrimitiveMesh& singleCellMesh = singleCellMeshPtr();
184 forAll(fineToCoarse, celli)
186 label coarseI = fineToCoarse[celli];
187 coarseToMaster[coarseI] =
min(coarseToMaster[coarseI], celli);
195 fineToCoarse = UIndirectList<label>(oldToNew, fineToCoarse)();
201 return tfineToCoarse;
205 bool Foam::procFacesGAMGProcAgglomeration::doProcessorAgglomeration
211 bool doAgg = mesh.lduAddr().size() < nAgglomeratingCells_;
212 mesh.reduce(doAgg, orOp<bool>());
226 nAgglomeratingCells_(controlDict.
lookup<
label>(
"nAgglomeratingCells"))
250 Pout<<
nl <<
"Starting mesh overview" <<
endl;
251 printStats(
Pout, agglom_);
254 if (agglom_.size() >= 1)
260 label fineLevelIndex = 2;
261 fineLevelIndex < agglom_.size();
265 if (agglom_.hasMeshLevel(fineLevelIndex))
268 const lduMesh& levelMesh = agglom_.meshLevel(fineLevelIndex);
273 if (nProcs > 1 && doProcessorAgglomeration(levelMesh))
277 processorAgglomeration(levelMesh)
279 const labelField& procAgglomMap = tprocAgglomMap();
324 Pout<<
nl <<
"Agglomerated mesh overview" <<
endl;
325 printStats(
Pout, agglom_);
static void scatterList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Scatter data. Reverse of gatherList.
Field< label > labelField
Specialisation of Field<T> for label.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
void sortedOrder(const UList< T > &, labelList &order)
Generate the (stable) sort order for the list.
procFacesGAMGProcAgglomeration(GAMGAgglomeration &agglom, const dictionary &controlDict)
Construct given agglomerator and controls.
A list of keyword definitions, which are a keyword followed by any number of values (e...
static int myProcNo(const label communicator=0)
Number of this process (starting from masterNo() = 0)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Abstract base class for meshes which provide LDU addressing for the construction of lduMatrix and LDU...
static bool master(const label communicator=0)
Am I the master process.
#define forAllReverse(list, i)
Reverse loop across all elements in list.
List< lduScheduleEntry > lduSchedule
static int & msgType()
Message tag of standard messages.
virtual label comm() const =0
Return communicator used for parallel communication.
Macros for easy insertion into run-time selection tables.
void agglomerate(const lduMesh &mesh, const scalarField &faceWeights)
Agglomerate all levels starting from the given face weights.
labelList invert(const label len, const labelUList &)
Invert one-to-one map. Unmapped elements will be -1.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
UPtrList< const lduInterface > lduInterfacePtrsList
List of coupled interface fields to be used in coupling.
static const label labelMax
List< label > labelList
A List of labels.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
static void scatter(const List< commsStruct > &comms, T &Value, const int tag, const label comm)
Scatter data. Distribute without modification. Reverse of gather.
virtual ~procFacesGAMGProcAgglomeration()
Destructor.
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
virtual bool agglomerate()
Modify agglomeration. Return true if modified.
virtual bool agglomerate()=0
Modify agglomeration. Return true if modified.
static label nProcs(const label communicator=0)
Number of processes in parallel run.
prefixOSstream Pout(cout, "Pout")
Processor agglomeration of GAMGAgglomerations.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
A class for managing temporary objects.
static label allocateCommunicator(const label parent, const labelList &subRanks, const bool doPstream=true)
Allocate a new communicator.
T & last()
Return the last element of the list.
Geometric agglomerated algebraic multigrid agglomeration class.
static void gatherList(const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm)
Gather data but keep individual values separate.
static void calculateRegionMaster(const label comm, const labelList &procAgglomMap, labelList &masterProcs, List< label > &agglomProcIDs)
Given fine to coarse processor map determine:
static void freeCommunicator(const label communicator, const bool doPstream=true)
Free a previously allocated communicator.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.