58 const label nInternalFaces,
66 nInternalFaces_(nInternalFaces),
84 label& nInternalPoints,
87 const label nInternalFaces,
101 label nBoundaryPoints = 0;
102 for (label facei = nInternalFaces; facei < faces.
size(); ++facei)
104 const face&
f = faces[facei];
106 for (label pointi :
f)
108 if (oldToNew[pointi] == -1)
110 oldToNew[pointi] = nBoundaryPoints++;
117 nInternalPoints =
nPoints - nBoundaryPoints;
122 if (oldToNew[pointi] != -1)
124 oldToNew[pointi] += nInternalPoints;
132 label internalPointi = 0;
136 for (label facei = 0; facei < nInternalFaces; facei++)
138 const face&
f = faces[facei];
140 for (label pointi :
f)
142 if (oldToNew[pointi] == -1)
144 if (pointi >= nInternalPoints)
148 oldToNew[pointi] = internalPointi++;
160 const label nInternalFaces,
169 nInternal0Edges_ = -1;
170 nInternal1Edges_ = -1;
171 nInternalEdges_ = -1;
173 nInternalFaces_ = nInternalFaces;
178 label nInternalPoints;
181 bool isOrdered = calcPointOrder
192 nInternalPoints_ = nInternalPoints;
196 nInternalPoints_ = -1;
201 Pout<<
"primitiveMesh::reset : mesh reset to"
202 <<
" nInternalPoints:" << nInternalPoints_
203 <<
" nPoints:" << nPoints_
204 <<
" nEdges:" << nEdges_
205 <<
" nInternalFaces:" << nInternalFaces_
206 <<
" nFaces:" << nFaces_
207 <<
" nCells:" << nCells_
216 const label nInternalFaces,
230 cfPtr_ = std::make_unique<cellList>(std::move(clst));
244 faceCentres.size() != nFaces_
245 || faceAreas.size() != nFaces_
246 || cellCentres.size() != nCells_
247 || cellVolumes.size() != nCells_
251 <<
"Wrong sizes of passed in face/cell data"
258 faceCentresPtr_ = std::make_unique<pointField>(std::move(faceCentres));
259 faceAreasPtr_ = std::make_unique<pointField>(std::move(faceAreas));
260 cellCentresPtr_ = std::make_unique<pointField>(std::move(cellCentres));
261 cellVolumesPtr_ = std::make_unique<scalarField>(std::move(cellVolumes));
265 Pout<<
"primitiveMesh::resetGeometry : geometry reset for"
266 <<
" nFaces:" << faceCentresPtr_->size()
267 <<
" nCells:" << cellCentresPtr_->size() <<
endl;
293 return *cellShapesPtr_;
299 if (!faceCentresPtr_ || !faceAreasPtr_)
302 calcFaceCentresAndAreas();
305 if (!cellCentresPtr_ || !cellVolumesPtr_)
308 calcCellCentresAndVols();
void resize_nocopy(const label len)
Adjust allocated size of list without necessarily.
void size(const label n)
Older name for setAddressableSize.
A face is a list of labels corresponding to mesh vertices.
Cell-face mesh analysis engine.
static bool calcPointOrder(label &nInternalPoints, labelList &pointMap, const faceList &, const label nInternalFaces, const label nPoints)
Helper function to calculate point ordering. Returns true.
primitiveMesh()
Construct null.
const vectorField & faceCentres() const
virtual const pointField & oldPoints() const =0
Return old points for mesh motion.
const scalarField & cellVolumes() const
virtual const faceList & faces() const =0
Return faces.
void clearGeom()
Clear geometry.
label nInternalFaces() const noexcept
Number of internal faces.
const vectorField & cellCentres() const
virtual ~primitiveMesh()
Destructor.
const cellShapeList & cellShapes() const
Return cell shapes.
void calcCellCentresAndVols() const
Calculate cell centres and volumes.
label nPoints() const noexcept
Number of mesh points.
label nInternalPoints() const noexcept
Points not on boundary.
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
void movePoints(const pointField &p, const pointField &oldP)
Move points.
void reset(const label nPoints, const label nInternalFaces, const label nFaces, const label nCells)
Reset this primitiveMesh given the primitive array sizes.
const vectorField & faceAreas() const
void calcFaceCentresAndAreas() const
Calculate face centres and areas.
void clearOut()
Clear all geometry and addressing unnecessary for CFD.
virtual void updateGeom()
Update all geometric data.
void resetGeometry(pointField &&faceCentres, pointField &&faceAreas, pointField &&cellCentres, scalarField &&cellVolumes)
Reset the local geometry.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
limits reset(1/(limits.max()+VSMALL), 1/(limits.min()+VSMALL))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Namespace for handling debugging switches.
List< label > labelList
A List of labels.
List< face > faceList
List of faces.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< cell > cellList
List of cell.
errorManip< error > abort(error &err)
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.
vectorField pointField
pointField is a vectorField.
List< cellShape > cellShapeList
List of cellShape.
#define forAll(list, i)
Loop across all elements in list.