From 68b2f50365675bfba223bac4ae0a69278f03be8d Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Mon, 30 Mar 2020 11:34:35 +0200 Subject: [PATCH] STYLE: unique_ptr instead of manual management - conversion, sampling, surfMesh --- src/conversion/ccm/common/ccmBase.C | 5 +-- src/conversion/ccm/common/ccmBase.H | 26 +++++------- src/conversion/ccm/common/ccmInternal.H | 14 +++---- src/conversion/ccm/reader/ccmReader.C | 1 - src/conversion/ccm/reader/ccmReader.H | 6 +-- src/conversion/ccm/writer/ccmWriter.C | 5 +-- src/conversion/ccm/writer/ccmWriter.H | 4 +- src/conversion/common/reader/calcPointCells.C | 5 ++- src/conversion/common/reader/meshReader.C | 13 +----- src/conversion/common/reader/meshReader.H | 12 +++--- .../meshToMesh0/calculateMeshToMesh0Weights.C | 40 ++++++++----------- src/sampling/meshToMesh0/meshToMesh0.C | 16 ++------ src/sampling/meshToMesh0/meshToMesh0.H | 21 +++++----- src/surfMesh/polySurface/polySurfaceClear.C | 1 - src/surfMesh/surfMesh/surfMesh.C | 1 - src/surfMesh/surfMesh/surfMeshClear.C | 1 - src/surfMesh/triSurface/triSurface.C | 9 ++--- src/surfMesh/triSurface/triSurface.H | 8 ++-- .../triSurface/triSurfaceAddressing.C | 9 ++--- 19 files changed, 77 insertions(+), 120 deletions(-) diff --git a/src/conversion/ccm/common/ccmBase.C b/src/conversion/ccm/common/ccmBase.C index d6e9b47e03d..cb8fecdf3a3 100644 --- a/src/conversion/ccm/common/ccmBase.C +++ b/src/conversion/ccm/common/ccmBase.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2019 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -89,8 +89,7 @@ bool Foam::ccm::base::close() { CCMIOCloseFile(nullptr, globalState_->root); } - delete globalState_; - globalState_ = nullptr; + globalState_.reset(nullptr); return true; } diff --git a/src/conversion/ccm/common/ccmBase.H b/src/conversion/ccm/common/ccmBase.H index 9e14e0d8216..e4966fdf3ab 100644 --- a/src/conversion/ccm/common/ccmBase.H +++ b/src/conversion/ccm/common/ccmBase.H @@ -41,6 +41,7 @@ SourceFiles #ifndef ccmBase_H #define ccmBase_H +#include <memory> #include <string> // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,8 +51,7 @@ namespace Foam namespace ccm { -// * * * * * * * * * * * * * Forward Declarations * * * * * * * * * * * * * // - +// Forward Declarations class ccmGlobalState; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -62,21 +62,12 @@ class ccmGlobalState; class base { - // Private Member Functions - - //- No copy construct - base(const base&) = delete; - - //- No copy assignment - void operator=(const base&) = delete; - - protected: // Protected Data //- Maintain overall global states (error, root-node) - ccmGlobalState* globalState_; + std::unique_ptr<ccmGlobalState> globalState_; // Protected Member Functions @@ -99,11 +90,18 @@ protected: bool assertNoError(const std::string& msg) const; + //- No copy construct + base(const base&) = delete; + + //- No copy assignment + void operator=(const base&) = delete; + + public: // Constructors - //- Construct null + //- Default construct. Initializes the global-state. base(); @@ -113,8 +111,6 @@ public: // Member Functions - // Access - //- Explicitly close the file and terminate ccmio access. // Return false if it was already closed. bool close(); diff --git a/src/conversion/ccm/common/ccmInternal.H b/src/conversion/ccm/common/ccmInternal.H index db3d6ac6194..302f5c28dfa 100644 --- a/src/conversion/ccm/common/ccmInternal.H +++ b/src/conversion/ccm/common/ccmInternal.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -33,14 +33,14 @@ Description #include "className.H" #include "List.H" -// headers and definitions for using libccmio +// Headers and definitions for using libccmio #include "libccmio/ccmio.h" -// low-level routines are also needed +// Low-level routines are also needed #include "libccmio/ccmiocore.h" #include "libccmio/ccmioutility.h" -// don't want these defines to leak through +// Do not allow these defines to leak through #undef TRUE #undef FALSE @@ -62,10 +62,7 @@ NamespaceName("ccm"); //- A C++ wrapper for the C struct -class ccmID -: - public CCMIOID -{}; +class ccmID : public CCMIOID {}; //- A C++ wrapper for the C struct class ccmNODE @@ -146,6 +143,7 @@ public: class ccmMaps { public: + //- The cell map ccmID cells; diff --git a/src/conversion/ccm/reader/ccmReader.C b/src/conversion/ccm/reader/ccmReader.C index 89f272e42ba..845735eee13 100644 --- a/src/conversion/ccm/reader/ccmReader.C +++ b/src/conversion/ccm/reader/ccmReader.C @@ -714,7 +714,6 @@ Foam::ccm::reader::reader(const fileName& file, const reader::options& opts) Foam::ccm::reader::~reader() { close(); - deleteDemandDrivenData(options_); } diff --git a/src/conversion/ccm/reader/ccmReader.H b/src/conversion/ccm/reader/ccmReader.H index bbfa1420b51..f84425911df 100644 --- a/src/conversion/ccm/reader/ccmReader.H +++ b/src/conversion/ccm/reader/ccmReader.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -204,10 +204,10 @@ private: static const char* cellTableOptstr[]; - // Private data + // Private Data //- Reader options - const options* options_; + const unique_ptr<options> options_; //- Enumeration defining the status of a ccmio node diff --git a/src/conversion/ccm/writer/ccmWriter.C b/src/conversion/ccm/writer/ccmWriter.C index 1bebd94a212..19c7323c167 100644 --- a/src/conversion/ccm/writer/ccmWriter.C +++ b/src/conversion/ccm/writer/ccmWriter.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016-2018 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,7 +30,6 @@ License #include "demandDrivenData.H" #include "ccmInternal.H" // include last to avoid any strange interactions - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // Name for the topology file reference @@ -377,8 +376,6 @@ Foam::ccm::writer::writer Foam::ccm::writer::~writer() { close(); - - deleteDemandDrivenData(maps_); } diff --git a/src/conversion/ccm/writer/ccmWriter.H b/src/conversion/ccm/writer/ccmWriter.H index 0f7c9e39e5d..a5e06f9542a 100644 --- a/src/conversion/ccm/writer/ccmWriter.H +++ b/src/conversion/ccm/writer/ccmWriter.H @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -132,7 +132,7 @@ class writer // Member Data //- MapIds for various components (cell, internalFaces, boundaries) - ccmMaps* maps_; + unique_ptr<ccmMaps> maps_; //- mesh reference const polyMesh& mesh_; diff --git a/src/conversion/common/reader/calcPointCells.C b/src/conversion/common/reader/calcPointCells.C index 54e03a1c40c..e8c15ce17e4 100644 --- a/src/conversion/common/reader/calcPointCells.C +++ b/src/conversion/common/reader/calcPointCells.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -46,8 +47,8 @@ void Foam::meshReader::calcPointCells() const label nPoints = points_.size(); - pointCellsPtr_ = new labelListList(nPoints); - labelListList& ptCells = *pointCellsPtr_; + pointCellsPtr_.reset(new labelListList(nPoints)); + auto& ptCells = *pointCellsPtr_; forAll(ptCells, i) { diff --git a/src/conversion/common/reader/meshReader.C b/src/conversion/common/reader/meshReader.C index f13720e9cbd..5db5fb6b0d0 100644 --- a/src/conversion/common/reader/meshReader.C +++ b/src/conversion/common/reader/meshReader.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -31,7 +31,6 @@ License #include "polyMesh.H" #include "faceSet.H" #include "emptyPolyPatch.H" -#include "demandDrivenData.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -147,7 +146,7 @@ void Foam::meshReader::clearExtraStorage() boundaryIds_.clear(); baffleIds_.clear(); - deleteDemandDrivenData(pointCellsPtr_); + pointCellsPtr_.reset(nullptr); } @@ -190,12 +189,4 @@ Foam::meshReader::meshReader } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::meshReader::~meshReader() -{ - deleteDemandDrivenData(pointCellsPtr_); -} - - // ************************************************************************* // diff --git a/src/conversion/common/reader/meshReader.H b/src/conversion/common/reader/meshReader.H index 156b94a9837..aed1acadf6d 100644 --- a/src/conversion/common/reader/meshReader.H +++ b/src/conversion/common/reader/meshReader.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2016 OpenCFD Ltd. + Copyright (C) 2016-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -117,12 +117,12 @@ protected: private: - // Private data + // Private Data //- Point-cell addressing. Used for topological analysis // Warning. This point cell addressing list potentially contains // duplicate cell entries. Use additional checking - mutable labelListList* pointCellsPtr_; + mutable unique_ptr<labelListList> pointCellsPtr_; //- Association between two faces List<labelPair> interfaces_; @@ -205,7 +205,7 @@ private: protected: - // Protected member data + // Protected Data //- Referenced filename fileName geometryFile_; @@ -255,7 +255,7 @@ protected: cellTable cellTable_; - // Protected member functions + // Protected Member Functions //- Subclasses are required to supply this information virtual bool readGeometry(const scalar scaleFactor = 1.0) = 0; @@ -276,7 +276,7 @@ public: //- Destructor - virtual ~meshReader(); + virtual ~meshReader() = default; // Member Functions diff --git a/src/sampling/meshToMesh0/calculateMeshToMesh0Weights.C b/src/sampling/meshToMesh0/calculateMeshToMesh0Weights.C index 31d3cf001ca..c6e71763b95 100644 --- a/src/sampling/meshToMesh0/calculateMeshToMesh0Weights.C +++ b/src/sampling/meshToMesh0/calculateMeshToMesh0Weights.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,11 +33,8 @@ License void Foam::meshToMesh0::calculateInverseDistanceWeights() const { - if (debug) - { - InfoInFunction - << "Calculating inverse distance weighting factors" << endl; - } + DebugInFunction + << "Calculating inverse distance weighting factors" << nl; if (inverseDistanceWeightsPtr_) { @@ -46,10 +44,10 @@ void Foam::meshToMesh0::calculateInverseDistanceWeights() const } //- Initialise overlap volume to zero - V_ = 0.0; + V_ = 0; - inverseDistanceWeightsPtr_ = new scalarListList(toMesh_.nCells()); - scalarListList& invDistCoeffs = *inverseDistanceWeightsPtr_; + inverseDistanceWeightsPtr_.reset(new scalarListList(toMesh_.nCells())); + auto& invDistCoeffs = *inverseDistanceWeightsPtr_; // get reference to source mesh data const labelListList& cc = fromMesh_.cellCells(); @@ -134,11 +132,8 @@ void Foam::meshToMesh0::calculateInverseDistanceWeights() const void Foam::meshToMesh0::calculateInverseVolumeWeights() const { - if (debug) - { - InfoInFunction - << "Calculating inverse volume weighting factors" << endl; - } + DebugInFunction + << "Calculating inverse volume weighting factors" << endl; if (inverseVolumeWeightsPtr_) { @@ -148,10 +143,10 @@ void Foam::meshToMesh0::calculateInverseVolumeWeights() const } //- Initialise overlap volume to zero - V_ = 0.0; + V_ = 0; - inverseVolumeWeightsPtr_ = new scalarListList(toMesh_.nCells()); - scalarListList& invVolCoeffs = *inverseVolumeWeightsPtr_; + inverseVolumeWeightsPtr_.reset(new scalarListList(toMesh_.nCells())); + auto& invVolCoeffs = *inverseVolumeWeightsPtr_; const labelListList& cellToCell = cellToCellAddressing(); @@ -197,11 +192,8 @@ void Foam::meshToMesh0::calculateInverseVolumeWeights() const void Foam::meshToMesh0::calculateCellToCellAddressing() const { - if (debug) - { - InfoInFunction - << "Calculating cell to cell addressing" << endl; - } + DebugInFunction + << "Calculating cell to cell addressing" << endl; if (cellToCellAddressingPtr_) { @@ -211,12 +203,12 @@ void Foam::meshToMesh0::calculateCellToCellAddressing() const } //- Initialise overlap volume to zero - V_ = 0.0; + V_ = 0; tetOverlapVolume overlapEngine; - cellToCellAddressingPtr_ = new labelListList(toMesh_.nCells()); - labelListList& cellToCell = *cellToCellAddressingPtr_; + cellToCellAddressingPtr_.reset(new labelListList(toMesh_.nCells())); + auto& cellToCell = *cellToCellAddressingPtr_; forAll(cellToCell, iTo) diff --git a/src/sampling/meshToMesh0/meshToMesh0.C b/src/sampling/meshToMesh0/meshToMesh0.C index fb5fe0a25e8..3a663647475 100644 --- a/src/sampling/meshToMesh0/meshToMesh0.C +++ b/src/sampling/meshToMesh0/meshToMesh0.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -27,7 +28,6 @@ License #include "meshToMesh0.H" #include "processorFvPatch.H" -#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -57,7 +57,7 @@ Foam::meshToMesh0::meshToMesh0 inverseDistanceWeightsPtr_(nullptr), inverseVolumeWeightsPtr_(nullptr), cellToCellAddressingPtr_(nullptr), - V_(0.0) + V_(0) { forAll(fromMesh_.boundaryMesh(), patchi) { @@ -125,7 +125,7 @@ Foam::meshToMesh0::meshToMesh0 inverseDistanceWeightsPtr_(nullptr), inverseVolumeWeightsPtr_(nullptr), cellToCellAddressingPtr_(nullptr), - V_(0.0) + V_(0) { // check whether both meshes have got the same number // of boundary patches @@ -191,14 +191,4 @@ Foam::meshToMesh0::meshToMesh0 } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::meshToMesh0::~meshToMesh0() -{ - deleteDemandDrivenData(inverseDistanceWeightsPtr_); - deleteDemandDrivenData(inverseVolumeWeightsPtr_); - deleteDemandDrivenData(cellToCellAddressingPtr_); -} - - // ************************************************************************* // diff --git a/src/sampling/meshToMesh0/meshToMesh0.H b/src/sampling/meshToMesh0/meshToMesh0.H index 9d8df0b94bc..bb2ce9f784e 100644 --- a/src/sampling/meshToMesh0/meshToMesh0.H +++ b/src/sampling/meshToMesh0/meshToMesh0.H @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2020 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -55,9 +55,8 @@ SourceFiles namespace Foam { -template<class Type> -class indexedOctree; - +// Forward Declarations +template<class Type> class indexedOctree; class treeDataCell; /*---------------------------------------------------------------------------*\ @@ -66,9 +65,9 @@ class treeDataCell; class meshToMesh0 { - // Private data + // Private Data - // mesh references + // Mesh References const fvMesh& fromMesh_; const fvMesh& toMesh_; @@ -92,13 +91,13 @@ class meshToMesh0 labelListList boundaryAddressing_; //- Inverse-distance interpolation weights - mutable scalarListList* inverseDistanceWeightsPtr_; + mutable unique_ptr<scalarListList> inverseDistanceWeightsPtr_; //- Inverse-volume interpolation weights - mutable scalarListList* inverseVolumeWeightsPtr_; + mutable unique_ptr<scalarListList> inverseVolumeWeightsPtr_; //- Cell to cell overlap addressing - mutable labelListList* cellToCellAddressingPtr_; + mutable unique_ptr<labelListList> cellToCellAddressingPtr_; //- Overlap volume mutable scalar V_; @@ -130,7 +129,7 @@ class meshToMesh0 const labelListList& cellToCellAddressing() const; - // Private static data members + // Private Static Data Members //- Direct hit tolerance static const scalar directHitTol; @@ -175,7 +174,7 @@ public: //- Destructor - ~meshToMesh0(); + ~meshToMesh0() = default; //- Patch-field interpolation class diff --git a/src/surfMesh/polySurface/polySurfaceClear.C b/src/surfMesh/polySurface/polySurfaceClear.C index fac0516e22f..f8148f4fcc7 100644 --- a/src/surfMesh/polySurface/polySurfaceClear.C +++ b/src/surfMesh/polySurface/polySurfaceClear.C @@ -27,7 +27,6 @@ License #include "polySurface.H" #include "globalMeshData.H" -#include "demandDrivenData.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/surfMesh/surfMesh/surfMesh.C b/src/surfMesh/surfMesh/surfMesh.C index ff63be45b9c..04d3bc22713 100644 --- a/src/surfMesh/surfMesh/surfMesh.C +++ b/src/surfMesh/surfMesh/surfMesh.C @@ -33,7 +33,6 @@ License #include "Time.H" #include "OSspecific.H" #include "MeshedSurface.H" -#include "demandDrivenData.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // diff --git a/src/surfMesh/surfMesh/surfMeshClear.C b/src/surfMesh/surfMesh/surfMeshClear.C index 8b9b99d88e1..4552b8cef3d 100644 --- a/src/surfMesh/surfMesh/surfMeshClear.C +++ b/src/surfMesh/surfMesh/surfMeshClear.C @@ -28,7 +28,6 @@ License #include "surfMesh.H" #include "globalMeshData.H" -#include "demandDrivenData.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/surfMesh/triSurface/triSurface.C b/src/surfMesh/triSurface/triSurface.C index d554a2d8e54..850d444d0b1 100644 --- a/src/surfMesh/triSurface/triSurface.C +++ b/src/surfMesh/triSurface/triSurface.C @@ -27,7 +27,6 @@ License \*---------------------------------------------------------------------------*/ #include "triSurface.H" -#include "demandDrivenData.H" #include "Time.H" #include "surfZoneList.H" #include "MeshedSurface.H" @@ -525,8 +524,8 @@ Foam::triSurface::~triSurface() void Foam::triSurface::clearTopology() { ParentType::clearTopology(); - deleteDemandDrivenData(sortedEdgeFacesPtr_); - deleteDemandDrivenData(edgeOwnerPtr_); + sortedEdgeFacesPtr_.reset(nullptr); + edgeOwnerPtr_.reset(nullptr); } @@ -585,7 +584,7 @@ const Foam::labelList& Foam::triSurface::edgeOwner() const void Foam::triSurface::movePoints(const pointField& pts) { // Remove all geometry dependent data - deleteDemandDrivenData(sortedEdgeFacesPtr_); + sortedEdgeFacesPtr_.reset(nullptr); // Adapt for new point positions ParentType::movePoints(pts); @@ -598,7 +597,7 @@ void Foam::triSurface::movePoints(const pointField& pts) void Foam::triSurface::swapPoints(pointField& pts) { // Remove all geometry dependent data - deleteDemandDrivenData(sortedEdgeFacesPtr_); + sortedEdgeFacesPtr_.reset(nullptr); // Adapt for new point positions ParentType::movePoints(pts); diff --git a/src/surfMesh/triSurface/triSurface.H b/src/surfMesh/triSurface/triSurface.H index 8179c39d0c9..263d8e733f4 100644 --- a/src/surfMesh/triSurface/triSurface.H +++ b/src/surfMesh/triSurface/triSurface.H @@ -106,11 +106,11 @@ class triSurface // Demand driven private data. //- Edge-face addressing (sorted) - mutable labelListList* sortedEdgeFacesPtr_; + mutable unique_ptr<labelListList> sortedEdgeFacesPtr_; - //- Label of face that 'owns' edge (i.e. e.vec() is righthanded walk - //- along face) - mutable labelList* edgeOwnerPtr_; + //- Label of face that 'owns' edge + //- i.e. e.vec() is righthanded walk along face + mutable unique_ptr<labelList> edgeOwnerPtr_; // Private Member Functions diff --git a/src/surfMesh/triSurface/triSurfaceAddressing.C b/src/surfMesh/triSurface/triSurfaceAddressing.C index 54119133f2a..d8767b49c5c 100644 --- a/src/surfMesh/triSurface/triSurfaceAddressing.C +++ b/src/surfMesh/triSurface/triSurfaceAddressing.C @@ -47,8 +47,8 @@ void Foam::triSurface::calcSortedEdgeFaces() const const labelListList& eFaces = edgeFaces(); - sortedEdgeFacesPtr_ = new labelListList(eFaces.size()); - labelListList& sortedEdgeFaces = *sortedEdgeFacesPtr_; + sortedEdgeFacesPtr_.reset(new labelListList(eFaces.size())); + auto& sortedEdgeFaces = *sortedEdgeFacesPtr_; sortedEdgeFaces = PatchTools::sortedEdgeFaces(*this); } @@ -63,9 +63,8 @@ void Foam::triSurface::calcEdgeOwner() const << abort(FatalError); } - // create the owner list - edgeOwnerPtr_ = new labelList(nEdges()); - labelList& edgeOwner = *edgeOwnerPtr_; + edgeOwnerPtr_.reset(new labelList(nEdges())); + auto& edgeOwner = *edgeOwnerPtr_; forAll(edges(), edgeI) { -- GitLab