diff --git a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.C b/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.C index e6f4a466b1..3c5bc0ae65 100644 --- a/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.C +++ b/src/OpenFOAM/interpolations/patchToPatchInterpolation/PatchToPatchInterpolation.C @@ -113,13 +113,7 @@ PatchToPatchInterpolation::PatchToPatchInterpolation fromPatch_(fromPatch), toPatch_(toPatch), alg_(alg), - dir_(dir), - pointAddressingPtr_(nullptr), - pointWeightsPtr_(nullptr), - pointDistancePtr_(nullptr), - faceAddressingPtr_(nullptr), - faceWeightsPtr_(nullptr), - faceDistancePtr_(nullptr) + dir_(dir) {} diff --git a/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.C b/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.C index 3a1a5bc0db..8830d3dd65 100644 --- a/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.C +++ b/src/OpenFOAM/interpolations/primitivePatchInterpolation/PrimitivePatchInterpolation.C @@ -150,9 +150,7 @@ Foam::PrimitivePatchInterpolation::PrimitivePatchInterpolation const Patch& p ) : - patch_(p), - faceToPointWeightsPtr_(nullptr), - faceToEdgeWeightsPtr_(nullptr) + patch_(p) {} diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C index 55ac9b98fc..d51287b0f8 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.C @@ -1794,9 +1794,6 @@ void Foam::globalMeshData::calcGlobalCoPointSlaves() const Foam::globalMeshData::globalMeshData(const polyMesh& mesh) : mesh_(mesh), - globalMeshPointAddr_(), - globalMeshFaceAddr_(), - globalMeshCellAddr_(), processorTopology_ ( processorTopology::New @@ -1805,16 +1802,8 @@ Foam::globalMeshData::globalMeshData(const polyMesh& mesh) mesh_.comm() ) ), - processorPatches_(), - processorPatchIndices_(), - processorPatchNeighbours_(), nGlobalPoints_(-1), - sharedPointLabelsPtr_(nullptr), - sharedPointAddrPtr_(nullptr), - sharedPointGlobalLabelsPtr_(nullptr), - nGlobalEdges_(-1), - sharedEdgeLabelsPtr_(nullptr), - sharedEdgeAddrPtr_(nullptr) + nGlobalEdges_(-1) { updateMesh(); } diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index ea17e4c706..9ceb85a37e 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -247,8 +247,6 @@ Foam::polyMesh::polyMesh(const IOobject& io, const bool doInit) comm_(UPstream::worldComm), geometricD_(Zero), solutionD_(Zero), - tetBasePtIsPtr_(nullptr), - cellTreePtr_(nullptr), pointZones_ ( IOobject @@ -291,13 +289,10 @@ Foam::polyMesh::polyMesh(const IOobject& io, const bool doInit) *this, PtrList() ), - globalMeshDataPtr_(nullptr), moving_(false), topoChanging_(false), storeOldCellCentres_(false), - curMotionTimeIndex_(time().timeIndex()), - oldPointsPtr_(nullptr), - oldCellCentresPtr_(nullptr) + curMotionTimeIndex_(time().timeIndex()) { if (owner_.hasHeaderClass()) { @@ -454,8 +449,6 @@ Foam::polyMesh::polyMesh comm_(UPstream::worldComm), geometricD_(Zero), solutionD_(Zero), - tetBasePtIsPtr_(nullptr), - cellTreePtr_(nullptr), pointZones_ ( IOobject @@ -498,13 +491,10 @@ Foam::polyMesh::polyMesh *this, Foam::zero{} ), - globalMeshDataPtr_(nullptr), moving_(false), topoChanging_(false), storeOldCellCentres_(false), - curMotionTimeIndex_(time().timeIndex()), - oldPointsPtr_(nullptr), - oldCellCentresPtr_(nullptr) + curMotionTimeIndex_(time().timeIndex()) { // Check if the faces and cells are valid forAll(faces_, facei) @@ -608,8 +598,6 @@ Foam::polyMesh::polyMesh comm_(UPstream::worldComm), geometricD_(Zero), solutionD_(Zero), - tetBasePtIsPtr_(nullptr), - cellTreePtr_(nullptr), pointZones_ ( IOobject @@ -652,13 +640,10 @@ Foam::polyMesh::polyMesh *this, Foam::zero{} ), - globalMeshDataPtr_(nullptr), moving_(false), topoChanging_(false), storeOldCellCentres_(false), - curMotionTimeIndex_(time().timeIndex()), - oldPointsPtr_(nullptr), - oldCellCentresPtr_(nullptr) + curMotionTimeIndex_(time().timeIndex()) { // Check if faces are valid forAll(faces_, facei) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C index 871713605b..82e5b9d60e 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshFromShapeMesh.C @@ -524,8 +524,6 @@ Foam::polyMesh::polyMesh comm_(UPstream::worldComm), geometricD_(Zero), solutionD_(Zero), - tetBasePtIsPtr_(nullptr), - cellTreePtr_(nullptr), pointZones_ ( IOobject @@ -568,13 +566,10 @@ Foam::polyMesh::polyMesh *this, Foam::zero{} ), - globalMeshDataPtr_(nullptr), moving_(false), topoChanging_(false), storeOldCellCentres_(false), - curMotionTimeIndex_(time().timeIndex()), - oldPointsPtr_(nullptr), - oldCellCentresPtr_(nullptr) + curMotionTimeIndex_(time().timeIndex()) { DebugInfo << "Constructing polyMesh from cell and boundary shapes." << endl; @@ -806,8 +801,6 @@ Foam::polyMesh::polyMesh comm_(UPstream::worldComm), geometricD_(Zero), solutionD_(Zero), - tetBasePtIsPtr_(nullptr), - cellTreePtr_(nullptr), pointZones_ ( IOobject @@ -850,13 +843,10 @@ Foam::polyMesh::polyMesh *this, Foam::zero{} ), - globalMeshDataPtr_(nullptr), moving_(false), topoChanging_(false), storeOldCellCentres_(false), - curMotionTimeIndex_(time().timeIndex()), - oldPointsPtr_(nullptr), - oldCellCentresPtr_(nullptr) + curMotionTimeIndex_(time().timeIndex()) { DebugInfo << "Constructing polyMesh from cell and boundary shapes." << endl; diff --git a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C index 6c401211ad..270ea43242 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C +++ b/src/OpenFOAM/meshes/primitiveMesh/PrimitivePatch/PrimitivePatch.C @@ -39,25 +39,7 @@ Foam::PrimitivePatch::PrimitivePatch : FaceList(faces), 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), - magFaceAreasPtr_(nullptr), - faceNormalsPtr_(nullptr), - pointNormalsPtr_(nullptr) + nInternalEdges_(-1) {} @@ -70,25 +52,7 @@ Foam::PrimitivePatch::PrimitivePatch : FaceList(std::move(faces)), 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), - magFaceAreasPtr_(nullptr), - faceNormalsPtr_(nullptr), - pointNormalsPtr_(nullptr) + nInternalEdges_(-1) {} @@ -102,25 +66,7 @@ Foam::PrimitivePatch::PrimitivePatch : FaceList(faces, reuse), points_(points, reuse), - 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), - magFaceAreasPtr_(nullptr), - faceNormalsPtr_(nullptr), - pointNormalsPtr_(nullptr) + nInternalEdges_(-1) {} @@ -132,25 +78,7 @@ Foam::PrimitivePatch::PrimitivePatch : FaceList(pp), points_(pp.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), - magFaceAreasPtr_(nullptr), - faceNormalsPtr_(nullptr), - pointNormalsPtr_(nullptr) + nInternalEdges_(-1) {} diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C index a680acbc8a..f8e9cd87d8 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,7 +32,7 @@ License namespace Foam { -defineTypeNameAndDebug(primitiveMesh, 0); + defineTypeNameAndDebug(primitiveMesh, 0); } @@ -48,30 +48,7 @@ Foam::primitiveMesh::primitiveMesh() nEdges_(-1), nInternalFaces_(0), nFaces_(0), - nCells_(0), - - cellShapesPtr_(nullptr), - edgesPtr_(nullptr), - ccPtr_(nullptr), - ecPtr_(nullptr), - pcPtr_(nullptr), - - cfPtr_(nullptr), - efPtr_(nullptr), - pfPtr_(nullptr), - - cePtr_(nullptr), - fePtr_(nullptr), - pePtr_(nullptr), - ppPtr_(nullptr), - cpPtr_(nullptr), - - labels_(0), - - cellCentresPtr_(nullptr), - faceCentresPtr_(nullptr), - cellVolumesPtr_(nullptr), - faceAreasPtr_(nullptr) + nCells_(0) {} @@ -88,30 +65,7 @@ Foam::primitiveMesh::primitiveMesh nEdges_(-1), nInternalFaces_(nInternalFaces), nFaces_(nFaces), - nCells_(nCells), - - cellShapesPtr_(nullptr), - edgesPtr_(nullptr), - ccPtr_(nullptr), - ecPtr_(nullptr), - pcPtr_(nullptr), - - cfPtr_(nullptr), - efPtr_(nullptr), - pfPtr_(nullptr), - - cePtr_(nullptr), - fePtr_(nullptr), - pePtr_(nullptr), - ppPtr_(nullptr), - cpPtr_(nullptr), - - labels_(0), - - cellCentresPtr_(nullptr), - faceCentresPtr_(nullptr), - cellVolumesPtr_(nullptr), - faceAreasPtr_(nullptr) + nCells_(nCells) {} @@ -273,7 +227,7 @@ void Foam::primitiveMesh::reset nCells ); - cfPtr_ = new cellList(clst, true); + cfPtr_ = std::make_unique(std::move(clst)); } @@ -301,10 +255,10 @@ void Foam::primitiveMesh::resetGeometry // Remove old geometry clearGeom(); - faceCentresPtr_ = new pointField(std::move(faceCentres)); - faceAreasPtr_ = new pointField(std::move(faceAreas)); - cellCentresPtr_ = new pointField(std::move(cellCentres)); - cellVolumesPtr_ = new scalarField(std::move(cellVolumes)); + faceCentresPtr_ = std::make_unique(std::move(faceCentres)); + faceAreasPtr_ = std::make_unique(std::move(faceAreas)); + cellCentresPtr_ = std::make_unique(std::move(cellCentres)); + cellVolumesPtr_ = std::make_unique(std::move(cellVolumes)); if (debug) { diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H index edec71812b..8964814412 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMesh.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2023 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -114,46 +114,46 @@ class primitiveMesh // Shapes //- Cell shapes - mutable cellShapeList* cellShapesPtr_; + mutable std::unique_ptr cellShapesPtr_; //- Edges - mutable edgeList* edgesPtr_; + mutable std::unique_ptr edgesPtr_; // Connectivity //- Cell-cells - mutable labelListList* ccPtr_; + mutable std::unique_ptr ccPtr_; //- Edge-cells - mutable labelListList* ecPtr_; + mutable std::unique_ptr ecPtr_; //- Point-cells - mutable labelListList* pcPtr_; + mutable std::unique_ptr pcPtr_; //- Cell-faces - mutable cellList* cfPtr_; + mutable std::unique_ptr cfPtr_; //- Edge-faces - mutable labelListList* efPtr_; + mutable std::unique_ptr efPtr_; //- Point-faces - mutable labelListList* pfPtr_; + mutable std::unique_ptr pfPtr_; //- Cell-edges - mutable labelListList* cePtr_; + mutable std::unique_ptr cePtr_; //- Face-edges - mutable labelListList* fePtr_; + mutable std::unique_ptr fePtr_; //- Point-edges - mutable labelListList* pePtr_; + mutable std::unique_ptr pePtr_; //- Point-points - mutable labelListList* ppPtr_; + mutable std::unique_ptr ppPtr_; //- Cell-points - mutable labelListList* cpPtr_; + mutable std::unique_ptr cpPtr_; // On-the-fly edge addressing storage @@ -168,16 +168,16 @@ class primitiveMesh // Geometric data //- Cell centres - mutable vectorField* cellCentresPtr_; + mutable std::unique_ptr cellCentresPtr_; //- Face centres - mutable vectorField* faceCentresPtr_; + mutable std::unique_ptr faceCentresPtr_; //- Cell volumes - mutable scalarField* cellVolumesPtr_; + mutable std::unique_ptr cellVolumesPtr_; //- Face areas - mutable vectorField* faceAreasPtr_; + mutable std::unique_ptr faceAreasPtr_; // Private Member Functions diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCalcCellShapes.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCalcCellShapes.C index f3d90e1184..4790b99f3a 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCalcCellShapes.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCalcCellShapes.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation + Copyright (C) 2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,8 +49,8 @@ void Foam::primitiveMesh::calcCellShapes() const } else { - cellShapesPtr_ = new cellShapeList(nCells()); - cellShapeList& cellShapes = *cellShapesPtr_; + cellShapesPtr_ = std::make_unique(nCells()); + auto& cellShapes = *cellShapesPtr_; forAll(cellShapes, celli) { diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C index e28eb7e53f..3738a46c1c 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCells.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2023 OpenCFD Ltd. + Copyright (C) 2023-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -72,7 +72,7 @@ void Foam::primitiveMesh::calcCellCells() const } // Create the storage - ccPtr_ = new labelListList(ncc.size()); + ccPtr_ = std::make_unique(ncc.size()); auto& cellCellAddr = *ccPtr_; diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCentresAndVols.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCentresAndVols.C index 56c83e4306..88b53852ce 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCentresAndVols.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellCentresAndVols.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -53,12 +53,12 @@ void Foam::primitiveMesh::calcCellCentresAndVols() const } // set the accumulated cell centre to zero vector - cellCentresPtr_ = new vectorField(nCells(), Zero); - vectorField& cellCtrs = *cellCentresPtr_; + cellCentresPtr_ = std::make_unique(nCells(), Zero); + auto& cellCtrs = *cellCentresPtr_; // Initialise cell volumes to 0 - cellVolumesPtr_ = new scalarField(nCells(), Zero); - scalarField& cellVols = *cellVolumesPtr_; + cellVolumesPtr_ = std::make_unique(nCells(), Zero); + auto& cellVols = *cellVolumesPtr_; // Make centres and volumes primitiveMeshTools::makeCellCentresAndVols diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellEdges.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellEdges.C index 53489382e5..d33b897c75 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellEdges.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellEdges.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -104,8 +104,8 @@ void Foam::primitiveMesh::calcCellEdges() const } } - cePtr_ = new labelListList(ce.size()); - labelListList& cellEdgeAddr = *cePtr_; + cePtr_ = std::make_unique(ce.size()); + auto& cellEdgeAddr = *cePtr_; // reset the size forAll(ce, celli) diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C index 7adcae2cc6..28f12ff977 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCellPoints.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2023 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -61,14 +61,14 @@ void Foam::primitiveMesh::calcCellPoints() const else if (hasPointCells()) { // Invert pointCells - cpPtr_ = new labelListList(nCells()); + cpPtr_ = std::make_unique(nCells()); invertManyToMany(nCells(), pointCells(), *cpPtr_); } else { // Calculate cell-point topology - cpPtr_ = new labelListList(nCells()); + cpPtr_ = std::make_unique(nCells()); auto& cellPointAddr = *cpPtr_; const cellList& cellLst = cells(); diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCells.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCells.C index 413bce401e..664f18e68b 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCells.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCells.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -119,8 +120,8 @@ void Foam::primitiveMesh::calcCells() const else { // Create the storage - cfPtr_ = new cellList(nCells()); - cellList& cellFaceAddr = *cfPtr_; + cfPtr_ = std::make_unique(nCells()); + auto& cellFaceAddr = *cfPtr_; calcCells ( diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C index 13494c0cae..71ab46fe10 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshClear.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation + Copyright (C) 2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -26,7 +27,6 @@ License \*---------------------------------------------------------------------------*/ #include "primitiveMesh.H" -#include "demandDrivenData.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -132,10 +132,10 @@ void Foam::primitiveMesh::clearGeom() << endl; } - deleteDemandDrivenData(cellCentresPtr_); - deleteDemandDrivenData(cellVolumesPtr_); - deleteDemandDrivenData(faceCentresPtr_); - deleteDemandDrivenData(faceAreasPtr_); + cellCentresPtr_.reset(nullptr); + cellVolumesPtr_.reset(nullptr); + faceCentresPtr_.reset(nullptr); + faceAreasPtr_.reset(nullptr); } @@ -148,8 +148,8 @@ void Foam::primitiveMesh::clearCellGeom() << endl; } - deleteDemandDrivenData(cellCentresPtr_); - deleteDemandDrivenData(cellVolumesPtr_); + cellCentresPtr_.reset(nullptr); + cellVolumesPtr_.reset(nullptr); } @@ -162,23 +162,23 @@ void Foam::primitiveMesh::clearAddressing() << endl; } - deleteDemandDrivenData(cellShapesPtr_); + cellShapesPtr_.reset(nullptr); clearOutEdges(); - deleteDemandDrivenData(ccPtr_); - deleteDemandDrivenData(ecPtr_); - deleteDemandDrivenData(pcPtr_); + ccPtr_.reset(nullptr); + ecPtr_.reset(nullptr); + pcPtr_.reset(nullptr); - deleteDemandDrivenData(cfPtr_); - deleteDemandDrivenData(efPtr_); - deleteDemandDrivenData(pfPtr_); + cfPtr_.reset(nullptr); + efPtr_.reset(nullptr); + pfPtr_.reset(nullptr); - deleteDemandDrivenData(cePtr_); - deleteDemandDrivenData(fePtr_); - deleteDemandDrivenData(pePtr_); - deleteDemandDrivenData(ppPtr_); - deleteDemandDrivenData(cpPtr_); + cePtr_.reset(nullptr); + fePtr_.reset(nullptr); + pePtr_.reset(nullptr); + ppPtr_.reset(nullptr); + cpPtr_.reset(nullptr); } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C index b4719c206b..a0bb92b077 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeCells.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2023 OpenCFD Ltd. + Copyright (C) 2023-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -48,7 +48,7 @@ const Foam::labelListList& Foam::primitiveMesh::edgeCells() const } } // Invert cellEdges - ecPtr_ = new labelListList(nEdges()); + ecPtr_ = std::make_unique(nEdges()); invertManyToMany(nEdges(), cellEdges(), *ecPtr_); } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C index 61e79c2778..0c9e3e65b5 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdgeFaces.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2015 OpenFOAM Foundation - Copyright (C) 2021 OpenCFD Ltd. + Copyright (C) 2021-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,7 +49,7 @@ const Foam::labelListList& Foam::primitiveMesh::edgeFaces() const } // Invert faceEdges - efPtr_ = new labelListList(nEdges()); + efPtr_ = std::make_unique(nEdges()); invertManyToMany(nEdges(), faceEdges(), *efPtr_); } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C index 1d5ad4aac6..c47e6748f7 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshEdges.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2018-2023 OpenCFD Ltd. + Copyright (C) 2018-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -28,7 +28,6 @@ License #include "primitiveMesh.H" #include "DynamicList.H" -#include "demandDrivenData.H" #include "SortableList.H" #include "ListOps.H" @@ -129,8 +128,8 @@ void Foam::primitiveMesh::calcEdges(const bool doFaceEdges) const // Estimate faceEdges storage if (doFaceEdges) { - fePtr_ = new labelListList(fcs.size()); - labelListList& faceEdges = *fePtr_; + fePtr_ = std::make_unique(fcs.size()); + auto& faceEdges = *fePtr_; forAll(fcs, facei) { faceEdges[facei].setSize(fcs[facei].size()); @@ -435,16 +434,16 @@ void Foam::primitiveMesh::calcEdges(const bool doFaceEdges) const // Renumber and transfer. // Edges - edgesPtr_ = new edgeList(es.size()); - edgeList& edges = *edgesPtr_; + edgesPtr_ = std::make_unique(es.size()); + auto& edges = *edgesPtr_; forAll(es, edgeI) { edges[oldToNew[edgeI]] = es[edgeI]; } // pointEdges - pePtr_ = new labelListList(nPoints()); - labelListList& pointEdges = *pePtr_; + pePtr_ = std::make_unique(nPoints()); + auto& pointEdges = *pePtr_; forAll(pe, pointi) { DynamicList