37void Foam::primitiveMesh::calcPointCells()
const
41 Pout<<
"primitiveMesh::calcPointCells() : "
42 <<
"calculating pointCells"
59 <<
"pointCells already calculated"
65 pcPtr_ = std::make_unique<labelListList>(
nPoints());
77 bitSet usedCells(
nCells());
80 DynamicList<label> currCells(256);
82 const label loopLen =
nPoints();
84 pcPtr_ = std::make_unique<labelListList>(
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];
156 pcPtr_ = std::make_unique<labelListList>(
nPoints());
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()));
Various functions to operate on Lists.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void clear() noexcept
Clear the addressed list, i.e. set the size to zero.
void push_back(const T &val)
Copy append an element to the end of this list.
void resize(const label len)
Alter addressable list size, allocating new space if required while recovering old content.
iterator begin() noexcept
Return an iterator to begin traversing the UList.
iterator end() noexcept
Return an iterator to end traversing the UList.
void size(const label n)
Older name for setAddressableSize.
Smooth ATC in cells having a point to a set of patches supplied by type.
bool hasPointCells() const noexcept
virtual const labelList & faceOwner() const =0
Face face-owner addressing.
virtual const labelList & faceNeighbour() const =0
Face face-neighbour addressing.
const labelListList & pointCells() const
virtual const faceList & faces() const =0
Return faces.
label nInternalFaces() const noexcept
Number of internal faces.
bool hasPointFaces() const noexcept
label nPoints() const noexcept
Number of mesh points.
const labelListList & cellPoints() const
label nCells() const noexcept
Number of mesh cells.
const labelListList & pointFaces() const
bool hasCellPoints() const noexcept
const cellList & cells() const
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void invertManyToMany(const label len, const UList< InputIntListType > &input, List< OutputIntListType > &output)
Invert many-to-many.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
List< face > faceList
List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< cell > cellList
List of cell.
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
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];} pointMap[start]=pointMap[end]=Foam::min(start, end);} } 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};constexpr 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< DynamicList< face > > pFaces[nBCs]
#define forAll(list, i)
Loop across all elements in list.