38namespace decompositionConstraints
53void 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;
66Foam::decompositionConstraints::singleProcessorFaceSets::
67singleProcessorFaceSets
75 coeffDict_.lookupCompat(
"sets", {{
"singleProcessorFaceSets", 1806}})
78 if (decompositionConstraint::debug)
81 <<
" : adding constraints to keep" <<
endl;
88Foam::decompositionConstraints::singleProcessorFaceSets::
89singleProcessorFaceSets
95 setNameAndProcs_(setNameAndProcs)
97 if (decompositionConstraint::debug)
100 <<
" : adding constraints to keep" <<
endl;
107Foam::decompositionConstraints::singleProcessorFaceSets::
108singleProcessorFaceSets
116 if (decompositionConstraint::debug)
119 <<
" : adding constraints to keep" <<
endl;
141 forAll(specifiedProcessorFaces, setI)
143 const labelList& faceLabels = specifiedProcessorFaces[setI];
144 for (
const label facei : faceLabels)
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)
209 specifiedProcessor.
append(destProcI);
217 forAll(specifiedProcessorFaces, setI)
219 const labelList& faceLabels = specifiedProcessorFaces[setI];
220 for (
const label facei : faceLabels)
224 for (
const label pointi :
f)
226 procFacePoint[pointi] =
true;
234 label nUnblocked = 0;
236 forAll(procFacePoint, pointi)
238 if (procFacePoint[pointi])
243 if (blockedFace[
pFaces[i]])
245 blockedFace[
pFaces[i]] =
false;
252 if (decompositionConstraint::debug & 2)
255 Info<<
type() <<
" : unblocked " << nUnblocked <<
" faces" <<
endl;
287 forAll(specifiedProcessorFaces, setI)
289 const labelList& set = specifiedProcessorFaces[setI];
292 label procI = specifiedProcessor[setI];
299 procI = decomposition[
mesh.faceOwner()[set[0]]];
311 procFacePoint[
f[fp]] =
true;
317 forAll(procFacePoint, pointi)
319 if (procFacePoint[pointi])
322 for (
const label faceI :
pFaces)
324 const label own =
mesh.faceOwner()[faceI];
326 if (decomposition[own] != procI)
328 decomposition[own] = procI;
332 if (
mesh.isInternalFace(faceI))
334 const label nei =
mesh.faceNeighbour()[faceI];
335 if (decomposition[nei] != procI)
337 decomposition[nei] = procI;
346 if (decompositionConstraint::debug & 2)
349 Info<<
type() <<
" : changed decomposition on " << nChanged
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
label size() const noexcept
The number of elements in table.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &val)
Append an element at the end of the list.
void resize(const label len)
Adjust allocated size of list.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void append(T *ptr)
Append an element to the end of the list.
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
label size() const noexcept
The number of elements in the list.
virtual void apply()=0
Apply bins.
Abstract class for handling decomposition constraints.
Constraint to keep all cells connected to face or point of faceSet on a single processor.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
A face is a list of labels corresponding to mesh vertices.
Sums a given list of (at least two or more) fields and outputs the result into a new field,...
Mesh consisting of general polyhedral cells.
#define defineTypeName(Type)
Define the typeName.
#define WarningInFunction
Report a warning using Foam::Warning.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
static constexpr const zero Zero
Global zero (0)
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]
#define forAll(list, i)
Loop across all elements in list.