diff --git a/Applications/FileIO/Gmsh/GMSHInterface.cpp b/Applications/FileIO/Gmsh/GMSHInterface.cpp index 01fabb7d3e5d9f77cd34e1137069eb67847aad0b..2946419bac8e79c257bc6702b81f2d4f89b9b6d1 100644 --- a/Applications/FileIO/Gmsh/GMSHInterface.cpp +++ b/Applications/FileIO/Gmsh/GMSHInterface.cpp @@ -49,11 +49,13 @@ GMSHInterface::GMSHInterface( { switch (mesh_density_algorithm) { case GMSH::MeshDensityAlgorithm::FixedMeshDensity: - _mesh_density_strategy = new GMSH::GMSHFixedMeshDensity(pnt_density); + _mesh_density_strategy = + std::make_unique<GMSH::GMSHFixedMeshDensity>(pnt_density); break; case GMSH::MeshDensityAlgorithm::AdaptiveMeshDensity: - _mesh_density_strategy = new GMSH::GMSHAdaptiveMeshDensity( - pnt_density, station_density, max_pnts_per_leaf); + _mesh_density_strategy = + std::make_unique<GMSH::GMSHAdaptiveMeshDensity>( + pnt_density, station_density, max_pnts_per_leaf); break; } } @@ -62,7 +64,6 @@ GMSHInterface::~GMSHInterface() { for (auto * gmsh_pnt : _gmsh_pnts) delete gmsh_pnt; - delete _mesh_density_strategy; for (auto * polygon_tree : _polygon_tree_list) delete polygon_tree; } @@ -138,7 +139,7 @@ int GMSHInterface::writeGMSHInputFile(std::ostream& out) } _polygon_tree_list.push_back(new GMSH::GMSHPolygonTree( new GeoLib::PolygonWithSegmentMarker(*polyline), nullptr, _geo_objs, - _gmsh_geo_name, _mesh_density_strategy)); + _gmsh_geo_name, _mesh_density_strategy.get())); } DBUG( "GMSHInterface::writeGMSHInputFile(): Computed topological hierarchy - " diff --git a/Applications/FileIO/Gmsh/GMSHInterface.h b/Applications/FileIO/Gmsh/GMSHInterface.h index d9a71be64dc4c68c41095c111bbab89668b419fc..ae8d68f3265fcd425cffc92640463b4e8d32f02b 100644 --- a/Applications/FileIO/Gmsh/GMSHInterface.h +++ b/Applications/FileIO/Gmsh/GMSHInterface.h @@ -104,7 +104,7 @@ private: std::vector<GMSH::GMSHPoint*> _gmsh_pnts; - GMSH::GMSHMeshDensityStrategy *_mesh_density_strategy; + std::unique_ptr<GMSH::GMSHMeshDensityStrategy> _mesh_density_strategy; /// Holds the inverse rotation matrix. The matrix is used in writePoints() to /// revert the rotation done in writeGMSHInputFile(). MathLib::DenseMatrix<double> _inverse_rot_mat =