54 Foam::decompositionMethod::decompositionMethod
59 decompositionDict_(decompositionDict),
67 if (decompositionDict_.found(
"constraints"))
91 constraintTypes_.
last()
100 decompositionDict_.found(
"preserveBaffles")
104 decompositionConstraints::preserveBafflesConstraint::typeName
116 decompositionDict_.found(
"preservePatches")
120 decompositionConstraints::preservePatchesConstraint::typeName
124 const wordReList pNames(decompositionDict_.lookup(
"preservePatches"));
134 decompositionDict_.found(
"preserveFaceZones")
138 decompositionConstraints::preserveFaceZonesConstraint::typeName
142 const wordReList zNames(decompositionDict_.lookup(
"preserveFaceZones"));
152 decompositionDict_.found(
"singleProcessorFaceSets")
156 decompositionConstraints::preserveFaceZonesConstraint::typeName
162 decompositionDict_.lookup(
"singleProcessorFaceSets")
182 word methodType(decompositionDict.
lookup(
"method"));
184 Info<<
"Selecting decompositionMethod " << methodType <<
endl;
186 dictionaryConstructorTable::iterator cstrIter =
187 dictionaryConstructorTablePtr_->find(methodType);
189 if (cstrIter == dictionaryConstructorTablePtr_->end())
192 <<
"Unknown decompositionMethod " 193 << methodType <<
nl <<
nl 194 <<
"Valid decompositionMethods are : " << endl
195 << dictionaryConstructorTablePtr_->sortedToc()
211 return decompose(mesh, points, weights);
247 forAll(fineDistribution, i)
249 fineDistribution[i] = coarseDistribution[fineToCoarse[i]];
252 return fineDistribution;
283 return decompose(globalCellCells, cc, cWeights);
291 const label nLocalCoarse,
322 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
329 globalNeighbour[bFacei] = globalAgglom.
toGlobal 331 agglom[faceOwner[facei]]
348 labelList nFacesPerCell(nLocalCoarse, 0);
352 label own = agglom[faceOwner[facei]];
353 label nei = agglom[faceNeighbour[facei]];
355 nFacesPerCell[own]++;
356 nFacesPerCell[nei]++;
363 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
370 label own = agglom[faceOwner[facei]];
372 label globalNei = globalNeighbour[bFacei];
375 !globalAgglom.
isLocal(globalNei)
376 || globalAgglom.
toLocal(globalNei) != own
379 nFacesPerCell[own]++;
392 cellCells.
setSize(nFacesPerCell);
402 label own = agglom[faceOwner[facei]];
403 label nei = agglom[faceNeighbour[facei]];
405 m[offsets[own] + nFacesPerCell[own]++] = globalAgglom.
toGlobal(nei);
406 m[offsets[nei] + nFacesPerCell[nei]++] = globalAgglom.
toGlobal(own);
414 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
421 label own = agglom[faceOwner[facei]];
423 label globalNei = globalNeighbour[bFacei];
427 !globalAgglom.
isLocal(globalNei)
428 || globalAgglom.
toLocal(globalNei) != own
431 m[offsets[own] + nFacesPerCell[own]++] = globalNei;
448 if (cellCells.
size() == 0)
462 for (
label i = startIndex; i < endIndex; i++)
464 if (nbrCells.
insert(cellCells.
m()[i]))
466 cellCells.
m()[newIndex++] = cellCells.
m()[i];
469 startIndex = endIndex;
470 cellCells.
offsets()[celli+1] = newIndex;
496 const label nLocalCoarse,
528 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
535 globalNeighbour[bFaceI] = globalAgglom.
toGlobal 537 agglom[faceOwner[faceI]]
554 labelList nFacesPerCell(nLocalCoarse, 0);
558 label own = agglom[faceOwner[faceI]];
559 label nei = agglom[faceNeighbour[faceI]];
561 nFacesPerCell[own]++;
562 nFacesPerCell[nei]++;
569 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
576 label own = agglom[faceOwner[faceI]];
578 label globalNei = globalNeighbour[bFaceI];
581 !globalAgglom.
isLocal(globalNei)
582 || globalAgglom.
toLocal(globalNei) != own
585 nFacesPerCell[own]++;
598 cellCells.
setSize(nFacesPerCell);
599 cellCellWeights.
setSize(nFacesPerCell);
610 label own = agglom[faceOwner[faceI]];
611 label nei = agglom[faceNeighbour[faceI]];
613 label ownIndex = offsets[own] + nFacesPerCell[own]++;
614 label neiIndex = offsets[nei] + nFacesPerCell[nei]++;
616 m[ownIndex] = globalAgglom.
toGlobal(nei);
618 m[neiIndex] = globalAgglom.
toGlobal(own);
627 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
634 label own = agglom[faceOwner[faceI]];
636 label globalNei = globalNeighbour[bFaceI];
640 !globalAgglom.
isLocal(globalNei)
641 || globalAgglom.
toLocal(globalNei) != own
644 label ownIndex = offsets[own] + nFacesPerCell[own]++;
645 m[ownIndex] = globalNei;
663 if (cellCells.
size() == 0)
677 for (
label i = startIndex; i < endIndex; i++)
679 if (nbrCells.
insert(cellCells.
m()[i]))
681 cellCells.
m()[newIndex] = cellCells.
m()[i];
682 cellCellWeights.
m()[newIndex] = cellCellWeights.
m()[i];
686 startIndex = endIndex;
687 cellCells.
offsets()[cellI+1] = newIndex;
688 cellCellWeights.
offsets()[cellI+1] = newIndex;
692 cellCellWeights.
m().
setSize(newIndex);
1092 if (nWeights > 0 && cellWeights.
size() != mesh.
nCells())
1095 <<
"Number of weights " << cellWeights.
size()
1096 <<
" differs from number of cells " << mesh.
nCells()
1102 label nProcSets = 0;
1103 forAll(specifiedProcessorFaces, setI)
1105 nProcSets += specifiedProcessorFaces[setI].
size();
1112 explicitConnections.
size(),
1117 label nUnblocked = 0;
1118 forAll(blockedFace, facei)
1120 if (!blockedFace[facei])
1134 if (nProcSets+nConnections+nUnblocked == 0)
1140 finalDecomp = decompose
1149 finalDecomp = decompose(mesh, mesh.
cellCentres());
1156 Info<<
"Constrained decomposition:" <<
endl 1157 <<
" faces with same owner and neighbour processor : " 1158 << nUnblocked <<
endl 1159 <<
" baffle faces with same owner processor : " 1160 << nConnections <<
endl 1161 <<
" faces all on same processor : " 1166 regionSplit localRegion(mesh, blockedFace, explicitConnections,
false);
1171 Info<<
"Constrained decomposition:" <<
endl 1187 forAll(localRegion, celli)
1189 label regionI = localRegion[celli];
1193 regionCentres[regionI] = mesh.
cellCentres()[celli];
1204 forAll(localRegion, celli)
1206 label regionI = localRegion[celli];
1208 regionWeights[regionI] += cellWeights[celli];
1213 forAll(localRegion, celli)
1215 label regionI = localRegion[celli];
1217 regionWeights[regionI] += 1.0;
1221 finalDecomp = decompose
1233 forAll(explicitConnections, i)
1235 const labelPair& baffle = explicitConnections[i];
1239 if (!blockedFace[f0] && !blockedFace[f1])
1253 else if (blockedFace[f0] != blockedFace[f1])
1256 <<
"On explicit connection between faces " << f0
1258 <<
" the two blockedFace status are not equal : " 1259 << blockedFace[f0] <<
" and " << blockedFace[
f1]
1279 label nUnblocked = 0;
1280 forAll(blockedFace, facei)
1282 if (blockedFace[facei])
1284 faceData[facei] =
minData(-123);
1297 forAll(blockedFace, facei)
1299 if (!blockedFace[facei])
1302 seedFaces[nUnblocked] = facei;
1303 seedData[nUnblocked] =
minData(finalDecomp[own]);
1321 forAll(finalDecomp, celli)
1323 if (cellData[celli].valid(deltaCalc.data()))
1325 finalDecomp[celli] = cellData[celli].
data();
1344 forAll(specifiedProcessorFaces, setI)
1346 const labelList&
set = specifiedProcessorFaces[setI];
1348 label proci = specifiedProcessor[setI];
1353 proci = finalDecomp[mesh.
faceOwner()[
set[0]]];
1364 label facei = pFaces[i];
1366 finalDecomp[mesh.
faceOwner()[facei]] = proci;
1394 if (!blockedFace[facei])
1396 label ownProc = finalDecomp[own];
1397 label nbrProc = nbrDecomp[bFacei];
1398 if (ownProc != nbrProc)
1401 <<
"patch:" << pp.
name()
1402 <<
" face:" << facei
1404 <<
" ownProc:" << ownProc
1405 <<
" nbrProc:" << nbrProc
1431 specifiedProcessorFaces.
clear();
1432 explicitConnections.
clear();
1434 forAll(constraints_, constraintI)
1436 constraints_[constraintI].add
1440 specifiedProcessorFaces,
1458 forAll(constraints_, constraintI)
1460 constraints_[constraintI].apply
1464 specifiedProcessorFaces,
1466 explicitConnections,
1489 specifiedProcessorFaces,
1503 specifiedProcessorFaces,
1515 specifiedProcessorFaces,
1517 explicitConnections,
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
bool isLocal(const label i) const
Is on local processor.
virtual labelList decompose(const pointField &points, const scalarField &pointWeights)
Return for every coordinate the wanted processor number.
This class separates the mesh into distinct unconnected regions, each of which is then given a 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.
const word & name() const
Return name.
label nLocalRegions() const
Return local number of regions.
static const Vector< scalar > max
errorManipArg< error, int > exit(error &err, const int errNo=1)
A face is a list of labels corresponding to mesh vertices.
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.
label nInternalFaces() const
virtual const labelList & faceNeighbour() const
Return face neighbour.
void size(const label)
Override size to be inconsistent with allocated storage.
const List< T > & m() const
Return the packed matrix of data.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Wave propagation of information through grid. Every iteration information goes through one layer of c...
label nTotalCells() const
Return total number of cells in decomposed mesh.
static int & msgType()
Message tag of standard messages.
Constraint to keep/move owner and neighbour of faceZone onto same processor.
static label worldComm
Default communicator (all processors)
bool insert(const Key &key)
Insert a new entry.
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 dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
Detects baffles and keeps owner and neighbour on same processor.
An ordered pair of two objects of type <T> with first() and second() elements.
virtual bool coupled() const
Return true if this patch is geometrically coupled (i.e. faces and.
void clear()
Clear the list, i.e. set size to zero.
A class for handling words, derived from string.
void clear()
Clear all entries from table.
void append(const T &)
Append an element at the end of the list.
void setConstraints(const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections)
Helper: extract constraints:
virtual const labelList & faceOwner() const
Return face owner.
label size() const
Return the primary size, i.e. the number of rows.
const globalMeshData & globalData() const
Return parallel info.
label toLocal(const label i) const
From global to local on current processor.
virtual const faceList & faces() const
Return raw faces.
const vectorField & cellCentres() const
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
label readLabel(Istream &is)
static autoPtr< decompositionMethod > New(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
A packed storage unstructured matrix of objects of type <T> using an offset table for access...
void setSize(const label mRows)
Reset size of CompactListList.
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
static autoPtr< decompositionConstraint > New(const dictionary &constraintsDict, const word &type)
Return a reference to the selected decompositionConstraint.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const Type & second() const
Return second.
Constraint to keep owner and neighbour of (cyclic) patch on same processor.
label size() const
Return the number of elements in the UPtrList.
const vectorField & faceCentres() const
void setSize(const label)
Reset size of List.
label toGlobal(const label i) const
From local to global.
T * data()
Return a pointer to the first data element,.
static bool & parRun()
Is this a parallel run?
void applyConstraints(const polyMesh &mesh, const boolList &blockedFace, const PtrList< labelList > &specifiedProcessorFaces, const labelList &specifiedProcessor, const List< labelPair > &explicitConnections, labelList &finalDecomp)
Helper: apply constraints to a decomposition. This gives.
const List< label > & offsets() const
Return the offset table (= size()+1)
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
const vectorField & faceAreas() const
label start() const
Return start label of this patch in the polyMesh face list.
void clear()
Clear the PtrList, i.e. set size to zero deleting all the.
const labelListList & pointFaces() const
dimensioned< scalar > mag(const dimensioned< Type > &)
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Constraint to keep all cells connected to face or point of faceSet on a single processor.
Mesh consisting of general polyhedral cells.
A patch is a list of labels that address the faces in the global face list.
T & last()
Return the last element of the list.
For use with FaceCellWave. Transports minimum passive data.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=*(cellModeller::lookup("hex"));labelList hexLabels(8);label activeCells=0;labelList pointMap(nPoints);forAll(pointMap, i){ pointMap[i]=i;}for(label i=0;i< nPoints;i++){ if(f[i] > 0.0) { hexLabels[0]=i;hexLabels[1]=i1tab[i];hexLabels[2]=i3tab[i1tab[i]];hexLabels[3]=i3tab[i];hexLabels[4]=i8tab[i];hexLabels[5]=i1tab[i8tab[i]];hexLabels[6]=i3tab[i1tab[i8tab[i]]];hexLabels[7]=i3tab[i8tab[i]];cellShapes[activeCells]=cellShape(hex, hexLabels);edgeList edges=cellShapes[activeCells].edges();forAll(edges, ei) { if(edges[ei].mag(points)< small) { label start=pointMap[edges[ei].start()];while(start !=pointMap[start]) { start=pointMap[start];} label end=pointMap[edges[ei].end()];while(end !=pointMap[end]) { end=pointMap[end];} label minLabel=min(start, end);pointMap[start]=pointMap[end]=minLabel;} } cellZoning[activeCells]=idreg[i];activeCells++;}}cellShapes.setSize(activeCells);cellZoning.setSize(activeCells);forAll(cellShapes, celli){ cellShape &cs=cellShapes[celli];forAll(cs, i) { cs[i]=pointMap[cs[i]];} cs.collapse();}label bcIDs[11]={-1, 0, 2, 4, -1, 5, -1, 6, 7, 8, 9};const label nBCs=12;const word *kivaPatchTypes[nBCs]={ &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &wallPolyPatch::typeName, &symmetryPolyPatch::typeName, &wedgePolyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &polyPatch::typeName, &symmetryPolyPatch::typeName, &oldCyclicPolyPatch::typeName};enum patchTypeNames{ PISTON, VALVE, LINER, CYLINDERHEAD, AXIS, WEDGE, INFLOW, OUTFLOW, PRESIN, PRESOUT, SYMMETRYPLANE, CYCLIC};const char *kivaPatchNames[nBCs]={ "piston", "valve", "liner", "cylinderHead", "axis", "wedge", "inflow", "outflow", "presin", "presout", "symmetryPlane", "cyclic"};List< SLList< face > > pFaces[nBCs]
const Type & first() const
Return first.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.