37 void Foam::primitiveMesh::calcPointCells()
const 41 Pout<<
"primitiveMesh::calcPointCells() : " 42 <<
"calculating pointCells" 59 <<
"pointCells already calculated" 77 bitSet usedCells(
nCells());
80 DynamicList<label> currCells(256);
82 const label loopLen =
nPoints();
85 auto& pointCellAddr = *pcPtr_;
87 for (label pointi = 0; pointi < loopLen; ++pointi)
90 usedCells.
unset(currCells);
93 for (
const label facei :
pFaces[pointi])
96 if (usedCells.set(own[facei]))
98 currCells.push_back(own[facei]);
104 if (usedCells.set(nei[facei]))
106 currCells.push_back(nei[facei]);
111 pointCellAddr[pointi] = currCells;
125 DynamicList<label> currPoints(256);
127 const label loopLen =
nCells();
133 for (label celli = 0; celli < loopLen; ++celli)
136 usedPoints.unset(currPoints);
139 for (
const label facei : cellLst[celli])
141 for (
const label pointi : faceLst[facei])
144 if (usedPoints.set(pointi))
146 currPoints.push_back(pointi);
147 ++pointCount[pointi];
157 auto& pointCellAddr = *pcPtr_;
159 forAll(pointCellAddr, pointi)
161 pointCellAddr[pointi].resize_nocopy(pointCount[pointi]);
162 pointCount[pointi] = 0;
167 for (label celli = 0; celli < loopLen; ++celli)
170 usedPoints.unset(currPoints);
173 for (
const label facei : cellLst[celli])
175 for (
const label pointi : faceLst[facei])
178 if (usedPoints.set(pointi))
180 currPoints.push_back(pointi);
181 pointCellAddr[pointi][pointCount[pointi]++] = celli;
206 DynamicList<label>& storage
211 return pointCells()[pointi];
221 for (
const label facei :
pFaces)
224 storage.push_back(own[facei]);
227 if (facei < nInternalFaces())
229 storage.push_back(nei[facei]);
234 if (storage.size() > 1)
236 std::sort(storage.begin(), storage.end());
237 auto last = std::unique(storage.begin(), storage.end());
238 storage.resize(label(last - storage.begin()));
248 return pointCells(pointi, labels_);
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type unset(const label i)
Unset the bool entry at specified position, always false for out-of-range access. ...
List< cell > cellList
List of cell.
label nPoints() const noexcept
Number of mesh points.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Ostream & endl(Ostream &os)
Add newline and flush stream.
const cellList & cells() const
List< labelList > labelListList
List of labelList.
Various functions to operate on Lists.
#define forAll(list, i)
Loop across all elements in list.
List< face > faceList
List of faces.
virtual const labelList & faceNeighbour() const =0
Face face-neighbour addressing.
void sort(UList< T > &list)
Sort the list.
label nInternalFaces() const noexcept
Number of internal faces.
errorManip< error > abort(error &err)
const labelListList & pointCells() const
bool hasCellPoints() const noexcept
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]
bool hasPointFaces() const noexcept
label nCells() const noexcept
Number of mesh cells.
virtual const faceList & faces() const =0
Return faces.
const labelListList & pointFaces() const
virtual const labelList & faceOwner() const =0
Face face-owner addressing.
List< label > labelList
A List of labels.
void invertManyToMany(const label len, const UList< InputIntListType > &input, List< OutputIntListType > &output)
Invert many-to-many.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
const labelListList & cellPoints() const
static constexpr const zero Zero
Global zero (0)