diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C index ff0af6a1ee..45fef8d4e2 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C @@ -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(); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index 105043acc3..600a532158 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -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 clone(const polyBoundaryMesh& bm) const { diff --git a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C index c162ac08b2..9fcf653998 100644 --- a/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C +++ b/src/OpenFOAM/meshes/polyMesh/zones/faceZone/faceZone.C @@ -522,7 +522,7 @@ void Foam::faceZone::movePoints(const pointField& p) { if (patchPtr_) { - patchPtr_->movePoints(p); + patchPtr_->clearGeom(); } } diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C index abe97f9073..35fdc97d79 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C @@ -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::PrimitivePatch {} -template -Foam::PrimitivePatch::PrimitivePatch -( - FaceList&& faces, - List&& 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 Foam::PrimitivePatch::PrimitivePatch ( @@ -208,36 +179,6 @@ Foam::PrimitivePatch::PrimitivePatch {} -template -Foam::PrimitivePatch::PrimitivePatch -( - Istream& is, - const Field& 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 @@ -249,24 +190,6 @@ Foam::PrimitivePatch::~PrimitivePatch() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::PrimitivePatch::movePoints -( - const Field& -) -{ - if (debug) - { - Pout<< "PrimitivePatch::" - << "movePoints() : " - << "recalculating PrimitivePatch geometry following mesh motion" - << endl; - } - - clearGeom(); -} - - template const Foam::edgeList& Foam::PrimitivePatch::edges() const { diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H index 74860b6036..6cae28de95 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.H @@ -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&& points ); - //- Move constructor from components - PrimitivePatch - ( - FaceList&& faces, - List&& points - ); - //- Construct from components, reuse storage PrimitivePatch ( @@ -284,7 +277,7 @@ public: ); //- Construct and return a clone - virtual autoPtr> clone() const + autoPtr> clone() const { return autoPtr> ( @@ -292,39 +285,9 @@ public: ); } - //- Construct from Istream - PrimitivePatch - ( - Istream&, - const Field& points - ); - - class iNew - { - const Field& points_; - - public: - - iNew(const Field& points) - : - points_(points) - {} - - autoPtr> operator() - ( - Istream& is - ) const - { - return autoPtr> - ( - new PrimitivePatch(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&); - // Member Operators diff --git a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C index 1638629eb5..5d9aaa316c 100644 --- a/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C +++ b/src/dynamicMesh/motionSmoother/motionSmootherAlgo.C @@ -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(); } diff --git a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C index da0bd910c6..e02e6ab61d 100644 --- a/src/mesh/snappyHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C +++ b/src/mesh/snappyHexMesh/externalDisplacementMeshMover/medialAxisMeshMover.C @@ -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(); diff --git a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C index ed7666eee6..794475e819 100644 --- a/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C +++ b/src/mesh/snappyHexMesh/snappyHexMeshDriver/snappyLayerDriver.C @@ -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++) diff --git a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C index 2773fb312e..036121102c 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicAMI/cyclicAMIPolyPatch/cyclicAMIPolyPatch.C @@ -175,9 +175,6 @@ void Foam::cyclicAMIPolyPatch::initMovePoints AMITransforms_.clear(); polyPatch::initMovePoints(pBufs, p); - - // See below. Clear out any local geometry - primitivePatch::movePoints(p); } diff --git a/src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatch.C b/src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatch.C index e285311d42..0317c0661d 100644 --- a/src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatch.C +++ b/src/meshTools/AMIInterpolation/patches/cyclicRepeatAMI/cyclicRepeatAMIPolyPatch/cyclicRepeatAMIPolyPatch.C @@ -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 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 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 AMIRightPtr ( new AMIInterpolation diff --git a/src/surfMesh/MeshedSurface/MeshedSurface.C b/src/surfMesh/MeshedSurface/MeshedSurface.C index c39be166d7..edce4740b4 100644 --- a/src/surfMesh/MeshedSurface/MeshedSurface.C +++ b/src/surfMesh/MeshedSurface/MeshedSurface.C @@ -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 void Foam::MeshedSurface::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::scalePoints(const scalar scaleFactor) pointField newPoints(scaleFactor*this->points()); // Adapt for new point position - ParentType::movePoints(newPoints); + ParentType::clearGeom(); storedPoints() = newPoints; } diff --git a/src/triSurface/triSurface/triSurface.C b/src/triSurface/triSurface/triSurface.C index 1c300cbbfa..c6e27cb49c 100644 --- a/src/triSurface/triSurface/triSurface.C +++ b/src/triSurface/triSurface/triSurface.C @@ -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& triangles, @@ -574,7 +573,7 @@ Foam::triSurface::triSurface ( List&& triangles, const geometricSurfacePatchList& patches, - List&& 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; } diff --git a/src/triSurface/triSurface/triSurface.H b/src/triSurface/triSurface/triSurface.H index 1103c63c14..9bb4da1437 100644 --- a/src/triSurface/triSurface/triSurface.H +++ b/src/triSurface/triSurface/triSurface.H @@ -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&&, const geometricSurfacePatchList&, - List&& + pointField&& ); //- Construct from triangles, points. Set patchnames to default. @@ -307,7 +307,7 @@ public: //- Destructor - ~triSurface(); + virtual ~triSurface(); void clearOut();