mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: additional cellModel edge() method to return a single edge
STYLE: update cell methods - avoid shadow variable names, range-for, etc - simplify coding STYLE: relocate cellModeller (compatibility) from namespace to a struct - avoids misleading namespace clutter in doxygen
This commit is contained in:
@ -36,130 +36,116 @@ const char* const Foam::cell::typeName = "cell";
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::labelList Foam::cell::labels(const faceUList& f) const
|
Foam::labelList Foam::cell::labels(const faceUList& meshFaces) const
|
||||||
{
|
{
|
||||||
const labelList& faces = *this;
|
const labelList& cFaces = *this;
|
||||||
|
|
||||||
// Count the maximum size of all vertices
|
label nVerts = 0;
|
||||||
label maxVert = 0;
|
for (const label facei : cFaces)
|
||||||
forAll(faces, facei)
|
|
||||||
{
|
{
|
||||||
maxVert += f[faces[facei]].size();
|
nVerts += meshFaces[facei].size();
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the fill-in list
|
labelList pointLabels(nVerts);
|
||||||
labelList p(maxVert);
|
|
||||||
|
|
||||||
// in the first face there is no duplicates
|
// The first face has no duplicates, can copy in values
|
||||||
const labelList& first = f[faces[0]];
|
const labelList& firstFace = meshFaces[cFaces[0]];
|
||||||
|
|
||||||
forAll(first, pointi)
|
std::copy(firstFace.cbegin(), firstFace.cend(), pointLabels.begin());
|
||||||
{
|
|
||||||
p[pointi] = first[pointi];
|
|
||||||
}
|
|
||||||
|
|
||||||
// re-use maxVert to count the real vertices
|
// Now already contains some vertices
|
||||||
maxVert = first.size();
|
nVerts = firstFace.size();
|
||||||
|
|
||||||
// go through the rest of the faces. For each vertex, check if the point is
|
// For the rest of the faces. For each vertex, check if the point is
|
||||||
// already inserted (up to maxVert, which now carries the number of real
|
// already inserted (up to nVerts, which now carries the number of real
|
||||||
// points. If not, add it at the end of the list.
|
// points. If not, add it at the end of the list.
|
||||||
|
|
||||||
for (label facei = 1; facei < faces.size(); facei++)
|
for (label facei = 1; facei < cFaces.size(); ++facei)
|
||||||
{
|
{
|
||||||
const labelList& curFace = f[faces[facei]];
|
for (const label curPoint : meshFaces[cFaces[facei]])
|
||||||
|
|
||||||
forAll(curFace, pointi)
|
|
||||||
{
|
{
|
||||||
const label curPoint = curFace[pointi];
|
bool pointFound = false;
|
||||||
|
|
||||||
bool found = false;
|
for (label checki = 0; checki < nVerts; ++checki)
|
||||||
|
|
||||||
for (label checkI = 0; checkI < maxVert; checkI++)
|
|
||||||
{
|
{
|
||||||
if (curPoint == p[checkI])
|
if (curPoint == pointLabels[checki])
|
||||||
{
|
{
|
||||||
found = true;
|
pointFound = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!pointFound)
|
||||||
{
|
{
|
||||||
p[maxVert] = curPoint;
|
pointLabels[nVerts] = curPoint;
|
||||||
++maxVert;
|
++nVerts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset the size of the list
|
pointLabels.resize(nVerts);
|
||||||
p.setSize(maxVert);
|
|
||||||
|
|
||||||
return p;
|
return pointLabels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::pointField Foam::cell::points
|
Foam::pointField Foam::cell::points
|
||||||
(
|
(
|
||||||
const faceUList& f,
|
const faceUList& meshFaces,
|
||||||
const UList<point>& meshPoints
|
const UList<point>& meshPoints
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const labelList pointLabels = labels(f);
|
const labelList pointLabels = labels(meshFaces);
|
||||||
|
|
||||||
pointField p(pointLabels.size());
|
pointField allPoints(pointLabels.size());
|
||||||
|
|
||||||
forAll(p, i)
|
forAll(allPoints, i)
|
||||||
{
|
{
|
||||||
p[i] = meshPoints[pointLabels[i]];
|
allPoints[i] = meshPoints[pointLabels[i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return allPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::edgeList Foam::cell::edges(const faceUList& f) const
|
Foam::edgeList Foam::cell::edges(const faceUList& meshFaces) const
|
||||||
{
|
{
|
||||||
const labelList& curFaces = *this;
|
const labelList& cFaces = *this;
|
||||||
|
|
||||||
label maxNoEdges = 0;
|
label nEdges = 0;
|
||||||
|
for (const label facei : cFaces)
|
||||||
forAll(curFaces, facei)
|
|
||||||
{
|
{
|
||||||
maxNoEdges += f[curFaces[facei]].nEdges();
|
nEdges += meshFaces[facei].nEdges();
|
||||||
}
|
}
|
||||||
|
|
||||||
edgeList allEdges(maxNoEdges);
|
edgeList allEdges(nEdges);
|
||||||
label nEdges = 0;
|
|
||||||
|
|
||||||
forAll(curFaces, facei)
|
nEdges = 0;
|
||||||
|
|
||||||
|
forAll(cFaces, facei)
|
||||||
{
|
{
|
||||||
const edgeList curFaceEdges = f[curFaces[facei]].edges();
|
for (const edge& curEdge : meshFaces[cFaces[facei]].edges())
|
||||||
|
|
||||||
for (const edge& curEdge : curFaceEdges)
|
|
||||||
{
|
{
|
||||||
bool edgeFound = false;
|
bool edgeFound = false;
|
||||||
|
|
||||||
for (label addedEdgeI = 0; addedEdgeI < nEdges; addedEdgeI++)
|
for (label checki = 0; checki < nEdges; ++checki)
|
||||||
{
|
{
|
||||||
if (allEdges[addedEdgeI] == curEdge)
|
if (curEdge == allEdges[checki])
|
||||||
{
|
{
|
||||||
edgeFound = true;
|
edgeFound = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!edgeFound)
|
if (!edgeFound)
|
||||||
{
|
{
|
||||||
// Add the new edge onto the list
|
|
||||||
allEdges[nEdges] = curEdge;
|
allEdges[nEdges] = curEdge;
|
||||||
++nEdges;
|
++nEdges;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allEdges.setSize(nEdges);
|
allEdges.resize(nEdges);
|
||||||
|
|
||||||
return allEdges;
|
return allEdges;
|
||||||
}
|
}
|
||||||
@ -167,8 +153,8 @@ Foam::edgeList Foam::cell::edges(const faceUList& f) const
|
|||||||
|
|
||||||
Foam::point Foam::cell::centre
|
Foam::point Foam::cell::centre
|
||||||
(
|
(
|
||||||
const UList<point>& p,
|
const UList<point>& meshPoints,
|
||||||
const faceUList& f
|
const faceUList& meshFaces
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// When one wants to access the cell centre and magnitude, the
|
// When one wants to access the cell centre and magnitude, the
|
||||||
@ -186,36 +172,33 @@ Foam::point Foam::cell::centre
|
|||||||
// relationship, which is not available on this level. Thus, all the
|
// relationship, which is not available on this level. Thus, all the
|
||||||
// pyramids are believed to be positive with no checking.
|
// pyramids are believed to be positive with no checking.
|
||||||
|
|
||||||
// first calculate the approximate cell centre as the average of all
|
// Approximate cell centre as the area average of all face centres
|
||||||
// face centres
|
|
||||||
|
|
||||||
vector cEst = Zero;
|
vector ctr = Zero;
|
||||||
scalar sumArea = 0;
|
scalar sumArea = 0;
|
||||||
|
|
||||||
const labelList& faces = *this;
|
const labelList& cFaces = *this;
|
||||||
|
|
||||||
forAll(faces, facei)
|
for (const label facei : cFaces)
|
||||||
{
|
{
|
||||||
scalar a = f[faces[facei]].mag(p);
|
const scalar magArea = meshFaces[facei].mag(meshPoints);
|
||||||
cEst += f[faces[facei]].centre(p)*a;
|
ctr += meshFaces[facei].centre(meshPoints)*magArea;
|
||||||
sumArea += a;
|
sumArea += magArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
cEst /= sumArea + VSMALL;
|
ctr /= sumArea + VSMALL;
|
||||||
|
|
||||||
// Calculate the centre by breaking the cell into pyramids and
|
// Calculate the centre by breaking the cell into pyramids and
|
||||||
// volume-weighted averaging their centres
|
// volume-weighted averaging their centres
|
||||||
vector sumVc = Zero;
|
|
||||||
|
|
||||||
scalar sumV = 0;
|
scalar sumV = 0;
|
||||||
|
vector sumVc = Zero;
|
||||||
|
|
||||||
forAll(faces, facei)
|
for (const label facei : cFaces)
|
||||||
{
|
{
|
||||||
// calculate pyramid volume. If it is greater than zero, OK.
|
const face& f = meshFaces[facei];
|
||||||
// If not, the pyramid is inside-out. Create a face with the opposite
|
|
||||||
// order and recalculate pyramid centre!
|
scalar pyrVol = pyramidPointFaceRef(f, ctr).mag(meshPoints);
|
||||||
scalar pyrVol = pyramidPointFaceRef(f[faces[facei]], cEst).mag(p);
|
|
||||||
vector pyrCentre = pyramidPointFaceRef(f[faces[facei]], cEst).centre(p);
|
|
||||||
|
|
||||||
// if pyramid inside-out because face points inwards invert
|
// if pyramid inside-out because face points inwards invert
|
||||||
// N.B. pyramid remains unchanged
|
// N.B. pyramid remains unchanged
|
||||||
@ -224,8 +207,8 @@ Foam::point Foam::cell::centre
|
|||||||
pyrVol = -pyrVol;
|
pyrVol = -pyrVol;
|
||||||
}
|
}
|
||||||
|
|
||||||
sumVc += pyrVol*pyrCentre;
|
|
||||||
sumV += pyrVol;
|
sumV += pyrVol;
|
||||||
|
sumVc += pyrVol * pyramidPointFaceRef(f, ctr).centre(meshPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sumVc/(sumV + VSMALL);
|
return sumVc/(sumV + VSMALL);
|
||||||
@ -234,8 +217,8 @@ Foam::point Foam::cell::centre
|
|||||||
|
|
||||||
Foam::scalar Foam::cell::mag
|
Foam::scalar Foam::cell::mag
|
||||||
(
|
(
|
||||||
const UList<point>& p,
|
const UList<point>& meshPoints,
|
||||||
const faceUList& f
|
const faceUList& meshFaces
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// When one wants to access the cell centre and magnitude, the
|
// When one wants to access the cell centre and magnitude, the
|
||||||
@ -246,30 +229,28 @@ Foam::scalar Foam::cell::mag
|
|||||||
|
|
||||||
// WARNING! See cell::centre
|
// WARNING! See cell::centre
|
||||||
|
|
||||||
// first calculate the approximate cell centre as the average of all
|
const labelList& cFaces = *this;
|
||||||
// face centres
|
|
||||||
vector cEst = Zero;
|
|
||||||
scalar nCellFaces = 0;
|
|
||||||
|
|
||||||
const labelList& faces = *this;
|
// Approximate cell centre as the average of all face centres
|
||||||
|
|
||||||
forAll(faces, facei)
|
vector ctr = Zero;
|
||||||
|
for (const label facei : cFaces)
|
||||||
{
|
{
|
||||||
cEst += f[faces[facei]].centre(p);
|
ctr += meshFaces[facei].centre(meshPoints);
|
||||||
nCellFaces += 1;
|
|
||||||
}
|
}
|
||||||
|
ctr /= cFaces.size();
|
||||||
cEst /= nCellFaces;
|
|
||||||
|
|
||||||
// Calculate the magnitude by summing the mags of the pyramids
|
// Calculate the magnitude by summing the mags of the pyramids
|
||||||
scalar v = 0;
|
scalar sumV = 0;
|
||||||
|
|
||||||
forAll(faces, facei)
|
for (const label facei : cFaces)
|
||||||
{
|
{
|
||||||
v += ::Foam::mag(pyramidPointFaceRef(f[faces[facei]], cEst).mag(p));
|
const face& f = meshFaces[facei];
|
||||||
|
|
||||||
|
sumV += ::Foam::mag(pyramidPointFaceRef(f, ctr).mag(meshPoints));
|
||||||
}
|
}
|
||||||
|
|
||||||
return v;
|
return sumV;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -89,13 +89,13 @@ public:
|
|||||||
inline cell(const labelUList& list, const FixedList<label, N>& indices);
|
inline cell(const labelUList& list, const FixedList<label, N>& indices);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
inline cell(Istream& is);
|
inline explicit cell(Istream& is);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return number of faces
|
//- Return number of faces
|
||||||
inline label nFaces() const;
|
inline label nFaces() const noexcept;
|
||||||
|
|
||||||
//- Return unordered list of cell vertices given the list of faces
|
//- Return unordered list of cell vertices given the list of faces
|
||||||
labelList labels(const faceUList& meshFaces) const;
|
labelList labels(const faceUList& meshFaces) const;
|
||||||
|
|||||||
@ -78,7 +78,7 @@ inline Foam::cell::cell(Istream& is)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline Foam::label Foam::cell::nFaces() const
|
inline Foam::label Foam::cell::nFaces() const noexcept
|
||||||
{
|
{
|
||||||
return size();
|
return size();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -173,25 +173,25 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return model name
|
//- Return model name
|
||||||
inline const word& name() const;
|
inline const word& name() const noexcept;
|
||||||
|
|
||||||
//- Return index of model in the model list
|
//- Return index of model in the model list
|
||||||
inline label index() const;
|
inline label index() const noexcept;
|
||||||
|
|
||||||
//- Return number of points
|
//- Return number of points
|
||||||
inline label nPoints() const;
|
inline label nPoints() const noexcept;
|
||||||
|
|
||||||
//- Return number of edges
|
//- Return number of edges
|
||||||
inline label nEdges() const;
|
inline label nEdges() const noexcept;
|
||||||
|
|
||||||
//- Return number of faces
|
//- Return number of faces
|
||||||
inline label nFaces() const;
|
inline label nFaces() const noexcept;
|
||||||
|
|
||||||
//- Return a raw list of model edges
|
//- Return a raw list of model edges
|
||||||
inline const edgeList& modelEdges() const;
|
inline const edgeList& modelEdges() const noexcept;
|
||||||
|
|
||||||
//- Return a raw list of model faces
|
//- Return a raw list of model faces
|
||||||
inline const faceList& modelFaces() const;
|
inline const faceList& modelFaces() const noexcept;
|
||||||
|
|
||||||
//- Return list of cell edges
|
//- Return list of cell edges
|
||||||
inline edgeList edges(const labelUList& pointLabels) const;
|
inline edgeList edges(const labelUList& pointLabels) const;
|
||||||
@ -199,6 +199,13 @@ public:
|
|||||||
//- Return list of cell faces
|
//- Return list of cell faces
|
||||||
inline faceList faces(const labelUList& pointLabels) const;
|
inline faceList faces(const labelUList& pointLabels) const;
|
||||||
|
|
||||||
|
//- Return the cell edge for specified model edge
|
||||||
|
inline Foam::edge edge
|
||||||
|
(
|
||||||
|
const label modelEdgei,
|
||||||
|
const labelUList& pointLabels
|
||||||
|
) const;
|
||||||
|
|
||||||
//- Return the cell face for specified model face
|
//- Return the cell face for specified model face
|
||||||
inline Foam::face face
|
inline Foam::face face
|
||||||
(
|
(
|
||||||
@ -251,10 +258,10 @@ Ostream& operator<<(Ostream& os, const InfoProxy<cellModel>& ip);
|
|||||||
// Global Operators
|
// Global Operators
|
||||||
|
|
||||||
//- Equality: true when model pointers are identical
|
//- Equality: true when model pointers are identical
|
||||||
inline bool operator==(const cellModel& lhs, const cellModel& rhs);
|
inline bool operator==(const cellModel& lhs, const cellModel& rhs) noexcept;
|
||||||
|
|
||||||
//- Inequality: true when model pointers are not identical
|
//- Inequality: true when model pointers are not identical
|
||||||
inline bool operator!=(const cellModel& lhs, const cellModel& rhs);
|
inline bool operator!=(const cellModel& lhs, const cellModel& rhs) noexcept;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -28,43 +28,43 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline const Foam::word& Foam::cellModel::name() const
|
inline const Foam::word& Foam::cellModel::name() const noexcept
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::cellModel::index() const
|
inline Foam::label Foam::cellModel::index() const noexcept
|
||||||
{
|
{
|
||||||
return index_;
|
return index_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::cellModel::nPoints() const
|
inline Foam::label Foam::cellModel::nPoints() const noexcept
|
||||||
{
|
{
|
||||||
return nPoints_;
|
return nPoints_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::cellModel::nEdges() const
|
inline Foam::label Foam::cellModel::nEdges() const noexcept
|
||||||
{
|
{
|
||||||
return edges_.size();
|
return edges_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::label Foam::cellModel::nFaces() const
|
inline Foam::label Foam::cellModel::nFaces() const noexcept
|
||||||
{
|
{
|
||||||
return faces_.size();
|
return faces_.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::edgeList& Foam::cellModel::modelEdges() const
|
inline const Foam::edgeList& Foam::cellModel::modelEdges() const noexcept
|
||||||
{
|
{
|
||||||
return edges_;
|
return edges_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::faceList& Foam::cellModel::modelFaces() const
|
inline const Foam::faceList& Foam::cellModel::modelFaces() const noexcept
|
||||||
{
|
{
|
||||||
return faces_;
|
return faces_;
|
||||||
}
|
}
|
||||||
@ -80,18 +80,24 @@ inline Foam::edgeList Foam::cellModel::edges
|
|||||||
forAll(edges_, edgei)
|
forAll(edges_, edgei)
|
||||||
{
|
{
|
||||||
// From model labels to global labels
|
// From model labels to global labels
|
||||||
theEdges[edgei] =
|
theEdges[edgei] = Foam::edge(pointLabels, edges_[edgei]);
|
||||||
edge
|
|
||||||
(
|
|
||||||
pointLabels[edges_[edgei].first()],
|
|
||||||
pointLabels[edges_[edgei].second()]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return theEdges;
|
return theEdges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline Foam::edge Foam::cellModel::edge
|
||||||
|
(
|
||||||
|
const label modelEdgei,
|
||||||
|
const labelUList& pointLabels
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
// From model labels to global labels
|
||||||
|
return Foam::edge(pointLabels, edges_[modelEdgei]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::faceList Foam::cellModel::faces
|
inline Foam::faceList Foam::cellModel::faces
|
||||||
(
|
(
|
||||||
const labelUList& pointLabels
|
const labelUList& pointLabels
|
||||||
@ -122,13 +128,21 @@ inline Foam::face Foam::cellModel::face
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Global Operators * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline bool Foam::operator==(const cellModel& lhs, const cellModel& rhs)
|
inline bool Foam::operator==
|
||||||
|
(
|
||||||
|
const cellModel& lhs,
|
||||||
|
const cellModel& rhs
|
||||||
|
) noexcept
|
||||||
{
|
{
|
||||||
return (&lhs == &rhs);
|
return (&lhs == &rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::operator!=(const cellModel& lhs, const cellModel& rhs)
|
inline bool Foam::operator!=
|
||||||
|
(
|
||||||
|
const cellModel& lhs,
|
||||||
|
const cellModel& rhs
|
||||||
|
) noexcept
|
||||||
{
|
{
|
||||||
return (&lhs != &rhs);
|
return (&lhs != &rhs);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
License
|
License
|
||||||
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
|
|
||||||
Namespace
|
Class
|
||||||
Foam::cellModeller
|
Foam::cellModeller
|
||||||
|
|
||||||
Description
|
Description
|
||||||
@ -18,6 +18,9 @@ Description
|
|||||||
|
|
||||||
Superseded (NOV-2017) by cellModel methods.
|
Superseded (NOV-2017) by cellModel methods.
|
||||||
|
|
||||||
|
See Also
|
||||||
|
Foam::cellModel
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef cellModeller_H
|
#ifndef cellModeller_H
|
||||||
@ -28,10 +31,10 @@ Description
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
|
||||||
namespace cellModeller
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
struct cellModeller
|
||||||
|
{
|
||||||
//- Deprecated(2017-11) equivalent to cellModel::ptr static method.
|
//- Deprecated(2017-11) equivalent to cellModel::ptr static method.
|
||||||
// \deprecated(2017-11) use cellModel::ptr instead
|
// \deprecated(2017-11) use cellModel::ptr instead
|
||||||
FOAM_DEPRECATED_FOR(2017-11, "cellModel::ptr() static method")
|
FOAM_DEPRECATED_FOR(2017-11, "cellModel::ptr() static method")
|
||||||
@ -47,8 +50,8 @@ namespace cellModeller
|
|||||||
{
|
{
|
||||||
return cellModel::ptr(modelIndex);
|
return cellModel::ptr(modelIndex);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // End namespace cellModeller
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -91,6 +92,15 @@ public:
|
|||||||
const bool doCollapse = false
|
const bool doCollapse = false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Copy construct from components
|
||||||
|
template<unsigned N>
|
||||||
|
inline cellShape
|
||||||
|
(
|
||||||
|
const cellModel& model,
|
||||||
|
const FixedList<label, N>& labels,
|
||||||
|
const bool doCollapse = false
|
||||||
|
);
|
||||||
|
|
||||||
//- Move construct from components
|
//- Move construct from components
|
||||||
inline cellShape
|
inline cellShape
|
||||||
(
|
(
|
||||||
@ -99,7 +109,7 @@ public:
|
|||||||
const bool doCollapse = false
|
const bool doCollapse = false
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Copy construct from components
|
//- Copy construct from components, using lookup cellModel by name
|
||||||
inline cellShape
|
inline cellShape
|
||||||
(
|
(
|
||||||
const word& modelName,
|
const word& modelName,
|
||||||
@ -108,7 +118,7 @@ public:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from Istream
|
//- Construct from Istream
|
||||||
inline cellShape(Istream& is);
|
inline explicit cellShape(Istream& is);
|
||||||
|
|
||||||
//- Clone
|
//- Clone
|
||||||
inline autoPtr<cellShape> clone() const;
|
inline autoPtr<cellShape> clone() const;
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Copyright (C) 2011-2016 OpenFOAM Foundation
|
Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
|
Copyright (C) 2020 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -55,6 +56,24 @@ inline Foam::cellShape::cellShape
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<unsigned N>
|
||||||
|
inline Foam::cellShape::cellShape
|
||||||
|
(
|
||||||
|
const cellModel& model,
|
||||||
|
const FixedList<label, N>& labels,
|
||||||
|
const bool doCollapse
|
||||||
|
)
|
||||||
|
:
|
||||||
|
labelList(labels),
|
||||||
|
m(&model)
|
||||||
|
{
|
||||||
|
if (doCollapse)
|
||||||
|
{
|
||||||
|
collapse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::cellShape::cellShape
|
inline Foam::cellShape::cellShape
|
||||||
(
|
(
|
||||||
const cellModel& model,
|
const cellModel& model,
|
||||||
|
|||||||
Reference in New Issue
Block a user