PrimitivePatch: Removed virtualisation and unused constructors

PrimitivePatch is a geometry engine. Is not used, and is not designed to
be used, as an abstract interface. That function is left to
PrimitivePatch's immediate derivations, such as polyPatch and
MeshedSurface.
This commit is contained in:
Will Bainbridge
2022-04-22 11:52:53 +01:00
parent 681e58bbda
commit 929c69340f
13 changed files with 35 additions and 153 deletions

View File

@ -54,9 +54,15 @@ namespace Foam
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::polyPatch::movePoints(const pointField& p)
{
primitivePatch::clearGeom();
}
void Foam::polyPatch::movePoints(PstreamBuffers&, const pointField& p)
{
primitivePatch::movePoints(p);
primitivePatch::clearGeom();
}

View File

@ -91,9 +91,6 @@ protected:
// Protected Member Functions
//- Inherit movePoints from primitivePatch
using primitivePatch::movePoints;
// The polyPatch geometry initialisation is called by polyBoundaryMesh
friend class polyBoundaryMesh;
@ -105,6 +102,9 @@ protected:
virtual void calcGeometry(PstreamBuffers&)
{}
//- Correct patches after moving points
virtual void movePoints(const pointField& p);
//- Initialise the patches for moving points
virtual void initMovePoints(PstreamBuffers&, const pointField&)
{}
@ -222,9 +222,6 @@ public:
//- Copy constructor
polyPatch(const polyPatch&);
// To avoid irritating warnings from clang
using primitivePatch::clone;
//- Construct and return a clone, resetting the boundary mesh
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
{

View File

@ -522,7 +522,7 @@ void Foam::faceZone::movePoints(const pointField& p)
{
if (patchPtr_)
{
patchPtr_->movePoints(p);
patchPtr_->clearGeom();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,6 +23,7 @@ License
\*---------------------------------------------------------------------------*/
#include "PrimitivePatch.H"
#include "Map.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -87,36 +88,6 @@ Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch
{}
template<class FaceList, class PointField>
Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch
(
FaceList&& faces,
List<PointType>&& points
)
:
FaceList(move(faces)),
points_(move(points)),
edgesPtr_(nullptr),
nInternalEdges_(-1),
boundaryPointsPtr_(nullptr),
faceFacesPtr_(nullptr),
edgeFacesPtr_(nullptr),
faceEdgesPtr_(nullptr),
pointEdgesPtr_(nullptr),
pointFacesPtr_(nullptr),
localFacesPtr_(nullptr),
meshPointsPtr_(nullptr),
meshPointMapPtr_(nullptr),
edgeLoopsPtr_(nullptr),
localPointsPtr_(nullptr),
localPointOrderPtr_(nullptr),
faceCentresPtr_(nullptr),
faceAreasPtr_(nullptr),
faceNormalsPtr_(nullptr),
pointNormalsPtr_(nullptr)
{}
template<class FaceList, class PointField>
Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch
(
@ -208,36 +179,6 @@ Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch
{}
template<class FaceList, class PointField>
Foam::PrimitivePatch<FaceList, PointField>::PrimitivePatch
(
Istream& is,
const Field<PointType>& points
)
:
FaceList(is),
points_(points),
edgesPtr_(nullptr),
nInternalEdges_(-1),
boundaryPointsPtr_(nullptr),
faceFacesPtr_(nullptr),
edgeFacesPtr_(nullptr),
faceEdgesPtr_(nullptr),
pointEdgesPtr_(nullptr),
pointFacesPtr_(nullptr),
localFacesPtr_(nullptr),
meshPointsPtr_(nullptr),
meshPointMapPtr_(nullptr),
edgeLoopsPtr_(nullptr),
localPointsPtr_(nullptr),
localPointOrderPtr_(nullptr),
faceCentresPtr_(nullptr),
faceAreasPtr_(nullptr),
faceNormalsPtr_(nullptr),
pointNormalsPtr_(nullptr)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class FaceList, class PointField>
@ -249,24 +190,6 @@ Foam::PrimitivePatch<FaceList, PointField>::~PrimitivePatch()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class FaceList, class PointField>
void Foam::PrimitivePatch<FaceList, PointField>::movePoints
(
const Field<PointType>&
)
{
if (debug)
{
Pout<< "PrimitivePatch<FaceList, PointField>::"
<< "movePoints() : "
<< "recalculating PrimitivePatch geometry following mesh motion"
<< endl;
}
clearGeom();
}
template<class FaceList, class PointField>
const Foam::edgeList& Foam::PrimitivePatch<FaceList, PointField>::edges() const
{

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -256,13 +256,6 @@ public:
Field<PointType>&& points
);
//- Move constructor from components
PrimitivePatch
(
FaceList&& faces,
List<PointType>&& points
);
//- Construct from components, reuse storage
PrimitivePatch
(
@ -284,7 +277,7 @@ public:
);
//- Construct and return a clone
virtual autoPtr<PrimitivePatch<FaceList, PointField>> clone() const
autoPtr<PrimitivePatch<FaceList, PointField>> clone() const
{
return autoPtr<PrimitivePatch<FaceList, PointField>>
(
@ -292,39 +285,9 @@ public:
);
}
//- Construct from Istream
PrimitivePatch
(
Istream&,
const Field<PointType>& points
);
class iNew
{
const Field<PointType>& points_;
public:
iNew(const Field<PointType>& points)
:
points_(points)
{}
autoPtr<PrimitivePatch<FaceList, PointField>> operator()
(
Istream& is
) const
{
return autoPtr<PrimitivePatch<FaceList, PointField>>
(
new PrimitivePatch<FaceList, PointField>(is, points_)
);
}
};
//- Destructor
virtual ~PrimitivePatch();
~PrimitivePatch();
// Member Functions
@ -515,9 +478,6 @@ public:
void clearPatchMeshAddr();
//- Correct patch after moving points
virtual void movePoints(const Field<PointType>&);
// Member Operators

View File

@ -698,7 +698,7 @@ void Foam::motionSmootherAlgo::movePoints()
// Make sure to clear out tetPtIs since used in checks (sometimes, should
// really check)
mesh_.clearTetBasePtIs();
pp_.movePoints(mesh_.points());
pp_.clearGeom();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -2172,7 +2172,7 @@ void Foam::medialAxisMeshMover::movePoints(const pointField& p)
externalDisplacementMeshMover::movePoints(p);
// Update local data for new geometry
adaptPatchPtr_().movePoints(p);
adaptPatchPtr_().clearGeom();
// Update motionSmoother for new geometry
meshMover_.movePoints();

View File

@ -3224,7 +3224,7 @@ void Foam::snappyLayerDriver::addLayers
checkFaces
);
pp().movePoints(mesh.points());
pp().clearGeom();
// Update patchDisp (since not all might have been honoured)
patchDisp = oldPatchPos - pp().localPoints();
@ -3489,7 +3489,7 @@ void Foam::snappyLayerDriver::addLayers
// Reset mesh points and start again
mesh.movePoints(oldPoints);
pp().movePoints(mesh.points());
pp().clearGeom();
// Grow out region of non-extrusion
for (label i = 0; i < layerParams.nGrow(); i++)

View File

@ -175,9 +175,6 @@ void Foam::cyclicAMIPolyPatch::initMovePoints
AMITransforms_.clear();
polyPatch::initMovePoints(pBufs, p);
// See below. Clear out any local geometry
primitivePatch::movePoints(p);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2018-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -206,7 +206,7 @@ void Foam::cyclicRepeatAMIPolyPatch::resetAMI() const
// Do the three bounding AMI interpolations
thisPoints = TLeft.transformPosition(localPoints());
thisPatch.movePoints(thisPoints);
thisPatch.clearGeom();
autoPtr<AMIInterpolation> AMILeftPtr
(
new AMIInterpolation
@ -226,7 +226,7 @@ void Foam::cyclicRepeatAMIPolyPatch::resetAMI() const
/gSum(AMILeftPtr->srcMagSf());
thisPoints = T.transformPosition(localPoints());
thisPatch.movePoints(thisPoints);
thisPatch.clearGeom();
autoPtr<AMIInterpolation> AMIPtr
(
new AMIInterpolation
@ -246,7 +246,7 @@ void Foam::cyclicRepeatAMIPolyPatch::resetAMI() const
/gSum(AMIPtr->srcMagSf());
thisPoints = TRight.transformPosition(localPoints());
thisPatch.movePoints(thisPoints);
thisPatch.clearGeom();
autoPtr<AMIInterpolation> AMIRightPtr
(
new AMIInterpolation

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -461,7 +461,7 @@ template<class Face>
void Foam::MeshedSurface<Face>::movePoints(const pointField& newPoints)
{
// Adapt for new point position
ParentType::movePoints(newPoints);
ParentType::clearGeom();
// Copy new points
storedPoints() = newPoints;
@ -477,7 +477,7 @@ void Foam::MeshedSurface<Face>::scalePoints(const scalar scaleFactor)
pointField newPoints(scaleFactor*this->points());
// Adapt for new point position
ParentType::movePoints(newPoints);
ParentType::clearGeom();
storedPoints() = newPoints;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -540,7 +540,6 @@ Foam::triSurface::triSurface()
{}
Foam::triSurface::triSurface
(
const List<labelledTri>& triangles,
@ -574,7 +573,7 @@ Foam::triSurface::triSurface
(
List<labelledTri>&& triangles,
const geometricSurfacePatchList& patches,
List<point>&& points
pointField&& points
)
:
ParentType(move(triangles), move(points)),
@ -740,7 +739,7 @@ void Foam::triSurface::movePoints(const pointField& newPoints)
deleteDemandDrivenData(sortedEdgeFacesPtr_);
// Adapt for new point position
ParentType::movePoints(newPoints);
ParentType::clearGeom();
// Copy new points
storedPoints() = newPoints;
@ -756,7 +755,7 @@ void Foam::triSurface::scalePoints(const scalar scaleFactor)
clearTopology();
// Adapt for new point position
ParentType::movePoints(pointField());
ParentType::clearGeom();
storedPoints() *= scaleFactor;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -280,7 +280,7 @@ public:
(
List<labelledTri>&&,
const geometricSurfacePatchList&,
List<point>&&
pointField&&
);
//- Construct from triangles, points. Set patchnames to default.
@ -307,7 +307,7 @@ public:
//- Destructor
~triSurface();
virtual ~triSurface();
void clearOut();