59 decompositionDict_(decompositionDict),
62 decompositionDict.
lookup<
label>(
"numberOfSubdomains")
68 if (decompositionDict_.found(
"constraints"))
85 constraintTypes_.
last()
101 const word methodType
105 {
"decomposer",
"method"}
109 Info<<
"Selecting decomposer " << methodType <<
endl;
115 decomposerConstructorTablePtr_
118 decomposerConstructorTable::iterator cstrIter =
119 decomposerConstructorTablePtr_->find(methodType);
121 if (cstrIter == decomposerConstructorTablePtr_->end())
124 <<
"Unknown decomposer " 125 << methodType <<
nl <<
nl 126 <<
"Valid decomposers are : " << endl
127 << decomposerConstructorTablePtr_->sortedToc()
141 const word methodType
145 {
"distributor",
"method"}
149 Info<<
"Selecting distributor " << methodType <<
endl;
155 distributorConstructorTablePtr_
158 distributorConstructorTable::iterator cstrIter =
159 distributorConstructorTablePtr_->find(methodType);
161 if (cstrIter == distributorConstructorTablePtr_->end())
164 <<
"Unknown distributor " 165 << methodType <<
nl <<
nl 166 <<
"Valid distributors are : " << endl
167 << distributorConstructorTablePtr_->sortedToc()
200 return decompose(mesh, points, weights);
227 coarseCellCells.
list(),
236 forAll(fineDistribution, i)
238 fineDistribution[i] = coarseDistribution[fineToCoarse[i]];
241 return fineDistribution;
272 return decompose(globalCellCells, cc, cWeights);
280 const label nLocalCoarse,
311 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
318 globalNeighbour[bFacei] = globalAgglom.
toGlobal 320 agglom[faceOwner[facei]]
337 labelList nFacesPerCell(nLocalCoarse, 0);
341 label own = agglom[faceOwner[facei]];
342 label nei = agglom[faceNeighbour[facei]];
344 nFacesPerCell[own]++;
345 nFacesPerCell[nei]++;
352 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
359 label own = agglom[faceOwner[facei]];
361 label globalNei = globalNeighbour[bFacei];
364 !globalAgglom.
isLocal(globalNei)
365 || globalAgglom.
toLocal(globalNei) != own
368 nFacesPerCell[own]++;
381 cellCells.
setSize(nFacesPerCell);
391 label own = agglom[faceOwner[facei]];
392 label nei = agglom[faceNeighbour[facei]];
394 m[offsets[own] + nFacesPerCell[own]++] = globalAgglom.
toGlobal(nei);
395 m[offsets[nei] + nFacesPerCell[nei]++] = globalAgglom.
toGlobal(own);
403 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
410 label own = agglom[faceOwner[facei]];
412 label globalNei = globalNeighbour[bFacei];
416 !globalAgglom.
isLocal(globalNei)
417 || globalAgglom.
toLocal(globalNei) != own
420 m[offsets[own] + nFacesPerCell[own]++] = globalNei;
437 if (cellCells.
size() == 0)
451 for (
label i = startIndex; i < endIndex; i++)
453 if (nbrCells.
insert(cellCells.
m()[i]))
455 cellCells.
m()[newIndex++] = cellCells.
m()[i];
458 startIndex = endIndex;
459 cellCells.
offsets()[celli+1] = newIndex;
470 const label nLocalCoarse,
502 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
509 globalNeighbour[bFaceI] = globalAgglom.
toGlobal 511 agglom[faceOwner[faceI]]
528 labelList nFacesPerCell(nLocalCoarse, 0);
532 label own = agglom[faceOwner[faceI]];
533 label nei = agglom[faceNeighbour[faceI]];
535 nFacesPerCell[own]++;
536 nFacesPerCell[nei]++;
543 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
550 label own = agglom[faceOwner[faceI]];
552 label globalNei = globalNeighbour[bFaceI];
555 !globalAgglom.
isLocal(globalNei)
556 || globalAgglom.
toLocal(globalNei) != own
559 nFacesPerCell[own]++;
572 cellCells.
setSize(nFacesPerCell);
573 cellCellWeights.
setSize(nFacesPerCell);
584 label own = agglom[faceOwner[faceI]];
585 label nei = agglom[faceNeighbour[faceI]];
587 label ownIndex = offsets[own] + nFacesPerCell[own]++;
588 label neiIndex = offsets[nei] + nFacesPerCell[nei]++;
590 m[ownIndex] = globalAgglom.
toGlobal(nei);
592 m[neiIndex] = globalAgglom.
toGlobal(own);
601 if (pp.
coupled() && (parallel || !isA<processorPolyPatch>(pp)))
608 label own = agglom[faceOwner[faceI]];
610 label globalNei = globalNeighbour[bFaceI];
614 !globalAgglom.
isLocal(globalNei)
615 || globalAgglom.
toLocal(globalNei) != own
618 label ownIndex = offsets[own] + nFacesPerCell[own]++;
619 m[ownIndex] = globalNei;
637 if (cellCells.
size() == 0)
651 for (
label i = startIndex; i < endIndex; i++)
653 if (nbrCells.
insert(cellCells.
m()[i]))
655 cellCells.
m()[newIndex] = cellCells.
m()[i];
656 cellCellWeights.
m()[newIndex] = cellCellWeights.
m()[i];
660 startIndex = endIndex;
661 cellCells.
offsets()[cellI+1] = newIndex;
662 cellCellWeights.
offsets()[cellI+1] = newIndex;
666 cellCellWeights.
setSize(cellCells.
size(), newIndex);
693 forAll(specifiedProcessorFaces, setI)
695 nProcSets += specifiedProcessorFaces[setI].
size();
702 explicitConnections.
size(),
707 label nUnblocked = 0;
708 forAll(blockedFace, facei)
710 if (!blockedFace[facei])
723 if (nProcSets+nConnections+nUnblocked == 0)
729 finalDecomp = decompose
745 Info<<
"Constrained decomposition:" <<
endl 746 <<
" faces with same owner and neighbour processor : " 747 << nUnblocked <<
endl 748 <<
" baffle faces with same owner processor : " 749 << nConnections <<
endl 750 <<
" faces all on same processor : " 755 regionSplit localRegion(mesh, blockedFace, explicitConnections,
false);
760 Info<<
"Constrained decomposition:" <<
endl 776 forAll(localRegion, celli)
778 label regionI = localRegion[celli];
782 regionCentres[regionI] = mesh.
cellCentres()[celli];
793 forAll(localRegion, celli)
795 label regionI = localRegion[celli];
797 regionWeights[regionI] += cellWeights[celli];
802 forAll(localRegion, celli)
804 label regionI = localRegion[celli];
806 regionWeights[regionI] += 1.0;
810 finalDecomp = decompose
822 forAll(explicitConnections, i)
824 const labelPair& baffle = explicitConnections[i];
828 if (!blockedFace[f0] && !blockedFace[f1])
842 else if (blockedFace[f0] != blockedFace[f1])
845 <<
"On explicit connection between faces " << f0
847 <<
" the two blockedFace status are not equal : " 848 << blockedFace[f0] <<
" and " << blockedFace[
f1]
868 label nUnblocked = 0;
869 forAll(blockedFace, facei)
871 if (blockedFace[facei])
873 faceData[facei] =
minData(-123);
886 forAll(blockedFace, facei)
888 if (!blockedFace[facei])
891 seedFaces[nUnblocked] = facei;
892 seedData[nUnblocked] =
minData(finalDecomp[own]);
910 forAll(finalDecomp, celli)
912 if (cellData[celli].valid(deltaCalc.data()))
914 finalDecomp[celli] = cellData[celli].
data();
933 forAll(specifiedProcessorFaces, setI)
935 const labelList&
set = specifiedProcessorFaces[setI];
937 label proci = specifiedProcessor[setI];
942 proci = finalDecomp[mesh.
faceOwner()[
set[0]]];
953 label facei = pFaces[i];
955 finalDecomp[mesh.
faceOwner()[facei]] = proci;
983 if (!blockedFace[facei])
985 label ownProc = finalDecomp[own];
986 label nbrProc = nbrDecomp[bFacei];
987 if (ownProc != nbrProc)
990 <<
"patch:" << pp.
name()
993 <<
" ownProc:" << ownProc
994 <<
" nbrProc:" << nbrProc
1020 specifiedProcessorFaces.
clear();
1021 explicitConnections.
clear();
1023 forAll(constraints_, constraintI)
1025 constraints_[constraintI].add
1029 specifiedProcessorFaces,
1047 forAll(constraints_, constraintI)
1049 constraints_[constraintI].apply
1053 specifiedProcessorFaces,
1055 explicitConnections,
1078 specifiedProcessorFaces,
1092 specifiedProcessorFaces,
1104 specifiedProcessorFaces,
1106 explicitConnections,
const fvPatchList & patches
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.
const UList< T > & m() const
Return the packed matrix of data.
const word & name() const
Return name.
label nLocalRegions() const
Return local number of regions.
label size() const
Return the primary size, i.e. the number of rows.
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.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
label nInternalFaces() const
virtual const labelList & faceNeighbour() const
Return face neighbour.
void size(const label)
Override size to be inconsistent with allocated storage.
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.
static label worldComm
Default communicator (all processors)
bool insert(const Key &key)
Insert a new entry.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
dlLibraryTable libs
Table of loaded dynamic libraries.
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.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
const scalarField & magFaceAreas() const
Calculates a unique integer (label so might not have enough room - 2G max) for processor + local inde...
List< Container > list() const
Convert to List<Container>
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:
static autoPtr< decompositionMethod > NewDistributor(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
virtual const labelList & faceOwner() const
Return face owner.
static autoPtr< decompositionMethod > NewDecomposer(const dictionary &decompositionDict)
Return a reference to the selected decomposition method.
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
static dictionary decomposeParDict(const Time &time)
Read and return the decomposeParDict.
decompositionMethod(const dictionary &decompositionDict)
Construct given the decomposition dictionary.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
const word & system() const
Return system name.
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, &mergedCyclicPolyPatch::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]
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.
bool open(const fileName &libName, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
const Type & second() const
Return second.
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.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
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
T returnReduce(const T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm)
Mesh consisting of general polyhedral cells.
const UList< label > & offsets() const
Return the offset table (= size()+1)
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.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
const Type & first() const
Return first.
ITstream & lookupBackwardsCompatible(const wordList &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream, trying a list of keywords.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.