51 void Foam::multiLevelDecomp::subsetGlobalCellCells
66 globalIndex globalCells(cellCells.size());
69 subCellCells = UIndirectList<labelList>(cellCells,
set);
72 List<Map<label>> compactMap;
73 mapDistribute map(globalCells, subCellCells, compactMap);
74 map.distribute(oldToNew);
76 map.distribute(allDist);
85 globalIndex globalSubCells(
set.size());
90 cutConnections.setSize(nDomains);
93 forAll(subCellCells, subCelli)
95 labelList& cCells = subCellCells[subCelli];
102 label nbrCelli = oldToNew[cCells[i]];
105 cutConnections[allDist[cCells[i]]]++;
112 label celli =
set[subCelli];
113 label oldNbrCelli = cellCells[celli][i];
115 label proci = globalCells.whichProcID(oldNbrCelli);
117 cCells[newI++] = globalSubCells.toGlobal(proci, nbrCelli);
120 cCells.setSize(newI);
125 void Foam::multiLevelDecomp::decompose
138 methods_[levelI].decompose
148 label orig = pointMap[i];
149 finalDecomp[orig] += dist[i];
152 if (levelI != methods_.size()-1)
157 label n = methods_[levelI].nDomains();
161 finalDecomp *= methods_[levelI+1].nDomains();
166 Pout<<
"Decomposition at level " << levelI <<
" :" <<
endl;
169 for (
label domainI = 0; domainI <
n; domainI++)
176 scalarField subWeights(pointWeights, domainPoints);
177 labelList subPointMap(UIndirectList<label>(pointMap, domainPoints));
181 subsetGlobalCellCells
199 forAll(nOutsideConnections, i)
201 if (nOutsideConnections[i] > 0)
204 nFaces += nOutsideConnections[i];
211 Pout<<
" Domain " << domainI <<
nl 212 <<
" Number of cells = " << nPoints <<
nl 213 <<
" Number of inter-domain patches = " << nPatches
215 <<
" Number of inter-domain faces = " << nFaces <<
nl 241 label nNext = methods_[levelI+1].nDomains();
242 label nTotal = n*nNext;
246 decompositionDict_.optionalSubDict(typeName +
"Coeffs").begin();
247 dictionary myDict = iter().dict();
248 myDict.set(
"numberOfSubdomains", nTotal);
252 Pout<<
"Reference decomposition with " << myDict <<
" :" 270 for (
label blockI = 0; blockI <
n; blockI++)
276 forAll(pointPoints, pointi)
278 if ((dist[pointi] / nNext) == blockI)
282 const labelList& pPoints = pointPoints[pointi];
286 label distBlockI = dist[pPoints[i]] / nNext;
287 if (distBlockI != blockI)
289 nOutsideConnections[distBlockI]++;
295 reduce(nPoints, plusOp<label>());
304 forAll(nOutsideConnections, i)
306 if (nOutsideConnections[i] > 0)
309 nFaces += nOutsideConnections[i];
315 Pout<<
" Domain " << blockI <<
nl 316 <<
" Number of cells = " << nPoints <<
nl 317 <<
" Number of inter-domain patches = " 319 <<
" Number of inter-domain faces = " << nFaces
330 Foam::multiLevelDecomp::multiLevelDecomp(
const dictionary& decompositionDict)
333 methodsDict_(decompositionDict_.optionalSubDict(typeName +
"Coeffs"))
335 methods_.setSize(methodsDict_.size());
343 Info<<
"decompositionMethod " <<
type() <<
" :" <<
endl;
346 Info<<
" level " << i <<
" decomposing with " << methods_[i].type()
347 <<
" into " << methods_[i].nDomains() <<
" subdomains." <<
endl;
349 n *= methods_[i].nDomains();
355 <<
"Top level decomposition specifies " <<
nDomains()
356 <<
" domains which is not equal to the product of" 357 <<
" all sub domains " << n
List< labelList > labelListList
A List of labelList.
Field< label > labelField
Specialisation of Field<T> for label.
static void listCombineScatter(const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm)
Scatter data. Reverse of combineGather.
#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.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
labelListList invertOneToMany(const label len, const labelUList &)
Invert one-to-many map. Unmapped elements will be size 0.
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
labelList identity(const label len)
Create identity map (map[i] == i) of given length.
labelList findIndices(const ListType &, typename ListType::const_reference, const label start=0)
Find all occurrences of given element. Linear search.
static void listCombineGather(const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm)
Macros for easy insertion into run-time selection tables.
static void calcCellCells(const polyMesh &mesh, const labelList &agglom, const label nLocalCoarse, const bool global, CompactListList< label > &cellCells)
Helper: determine (local or global) cellCells from mesh.
const string & prefix() const
Return the prefix of the stream.
vectorField pointField
pointField is a vectorField.
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.
List< label > labelList
A List of labels.
Abstract base class for decomposition.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
static autoPtr< decompositionMethod > New(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
A packed storage unstructured matrix of objects of type <T> using an offset table for access...
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
defineTypeNameAndDebug(combustionModel, 0)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
prefixOSstream Pout(cout, "Pout")
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.
virtual bool parallelAware() const
Is method parallel aware (i.e. does it synchronize domains across.
friend class const_iterator