38 namespace decompositionConstraints
44 decompositionConstraint,
45 singleProcessorFaceSets,
53 void Foam::decompositionConstraints::singleProcessorFaceSets::printInfo()
const 55 for (
const auto& nameAndProc : setNameAndProcs_)
57 Info<<
" all cells connected to faceSet " 58 << nameAndProc.first()
59 <<
" on processor " << nameAndProc.second() <<
endl;
75 coeffDict_.lookupCompat(
"sets", {{
"singleProcessorFaceSets", 1806}})
81 <<
" : adding constraints to keep" <<
endl;
95 setNameAndProcs_(setNameAndProcs)
100 <<
" : adding constraints to keep" <<
endl;
119 <<
" : adding constraints to keep" <<
endl;
141 forAll(specifiedProcessorFaces, setI)
146 if (faceToSet[facei] == -1)
148 faceToSet[facei] = setI;
150 else if (faceToSet[facei] != setI)
153 <<
" at " <<
mesh.faceCentres()[facei]
154 <<
" is already in existing constraint " 161 forAll(setNameAndProcs_, setI)
167 const label destProcI = setNameAndProcs_[setI].second();
170 const faceSet fz(
mesh, setNameAndProcs_[setI].first());
174 for (
const label facei : fz)
176 const label seti = faceToSet[facei];
190 if (nMatch[setI] == fz.size())
196 else if (nMatch[setI] > 0)
207 specifiedProcessor.
append(destProcI);
215 forAll(specifiedProcessorFaces, setI)
220 const face&
f =
mesh.faces()[facei];
222 for (
const label pointi :
f)
224 procFacePoint[pointi] =
true;
232 label nUnblocked = 0;
234 forAll(procFacePoint, pointi)
236 if (procFacePoint[pointi])
241 if (blockedFace[
pFaces[i]])
243 blockedFace[
pFaces[i]] =
false;
285 forAll(specifiedProcessorFaces, setI)
287 const labelList&
set = specifiedProcessorFaces[setI];
290 label procI = specifiedProcessor[setI];
297 procI = decomposition[
mesh.faceOwner()[
set[0]]];
299 reduce(procI, maxOp<label>());
306 const face&
f =
mesh.faces()[
set[fI]];
309 procFacePoint[
f[fp]] =
true;
315 forAll(procFacePoint, pointi)
317 if (procFacePoint[pointi])
320 for (
const label faceI :
pFaces)
322 const label own =
mesh.faceOwner()[faceI];
324 if (decomposition[own] != procI)
326 decomposition[own] = procI;
330 if (
mesh.isInternalFace(faceI))
332 const label nei =
mesh.faceNeighbour()[faceI];
333 if (decomposition[nei] != procI)
335 decomposition[nei] = procI;
346 Info<<
type() <<
" : changed decomposition on "
Abstract class for handling decomposition constraints.
void resize(const label len)
Adjust allocated size of list.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
void append(const T &val)
Append an element at the end of the list.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Ostream & endl(Ostream &os)
Add newline and flush stream.
labelList faceLabels(nFaceLabels)
T returnReduce(const T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Perform reduction on a copy, using specified binary operation.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
virtual void add(const polyMesh &mesh, boolList &blockedFace, PtrList< labelList > &specifiedProcessorFaces, labelList &specifiedProcessor, List< labelPair > &explicitConnections) const
Add this constraint to list of constraints.
label size() const noexcept
The number of entries in the list.
singleProcessorFaceSets(const dictionary &dict)
Construct with constraint dictionary.
virtual void apply(const polyMesh &mesh, const boolList &blockedFace, const PtrList< labelList > &specifiedProcessorFaces, const labelList &specifiedProcessor, const List< labelPair > &explicitConnections, labelList &decomposition) const
Add this constraint post-decomposition.
int debug
Static debugging option.
Info<< "Finished reading KIVA file"<< endl;cellShapeList cellShapes(nPoints);labelList cellZoning(nPoints, -1);const cellModel &hex=cellModel::ref(cellModel::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].reset(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]
void append(autoPtr< T > &ptr)
Move append an element to the end of the list.
#define WarningInFunction
Report a warning using Foam::Warning.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
addToRunTimeSelectionTable(decompositionConstraint, geometric, dictionary)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Mesh consisting of general polyhedral cells.
List< label > labelList
A List of labels.
bool returnReduceOr(const bool value, const label comm=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
defineTypeName(geometric)
List< bool > boolList
A List of bools.
void reduce(T &value, const BinaryOp &bop, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce) using linear/tree communication schedule.
static constexpr const zero Zero
Global zero (0)