From 2d69210ee1ff69f4f9b297c11debb0c3a22cba91 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Fri, 17 Jun 2016 01:14:54 +0000 Subject: [PATCH] Add final specifier to some classes. Also remove unneeded default dtors. --- Applications/FileIO/PetrelInterface.cpp | 3 --- Applications/FileIO/PetrelInterface.h | 3 +-- FileIO/TetGenInterface.cpp | 4 ---- FileIO/TetGenInterface.h | 3 +-- GeoLib/IO/Gmsh/GMSHLine.cpp | 3 --- GeoLib/IO/Gmsh/GMSHLine.h | 3 +-- GeoLib/IO/Gmsh/GMSHPoint.cpp | 3 --- GeoLib/IO/Gmsh/GMSHPoint.h | 5 ++--- GeoLib/PointVec.cpp | 4 ---- GeoLib/PointVec.h | 5 +---- MeshLib/IO/VtkIO/VtuInterface.cpp | 3 --- MeshLib/IO/VtkIO/VtuInterface.h | 3 +-- MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.cpp | 3 --- MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.h | 4 ++-- MeshLib/MeshQuality/AngleSkewMetric.cpp | 3 --- MeshLib/MeshQuality/AngleSkewMetric.h | 5 ++--- MeshLib/Node.cpp | 4 ---- MeshLib/Node.h | 7 ++----- MeshLib/Vtk/VtkMappedMeshSource.cpp | 5 ----- MeshLib/Vtk/VtkMappedMeshSource.h | 5 ++--- 20 files changed, 15 insertions(+), 63 deletions(-) diff --git a/Applications/FileIO/PetrelInterface.cpp b/Applications/FileIO/PetrelInterface.cpp index 6bea9a22d79..387b6cddcba 100644 --- a/Applications/FileIO/PetrelInterface.cpp +++ b/Applications/FileIO/PetrelInterface.cpp @@ -77,9 +77,6 @@ PetrelInterface::PetrelInterface(std::list<std::string> &sfc_fnames, _unique_name); } -PetrelInterface::~PetrelInterface() -{} - void PetrelInterface::readPetrelSurface(std::istream &in) { char buffer[MAX_COLS_PER_ROW]; diff --git a/Applications/FileIO/PetrelInterface.h b/Applications/FileIO/PetrelInterface.h index b7b357404f2..993a0a77c3c 100644 --- a/Applications/FileIO/PetrelInterface.h +++ b/Applications/FileIO/PetrelInterface.h @@ -32,14 +32,13 @@ namespace GeoLib namespace FileIO { -class PetrelInterface +class PetrelInterface final { public: PetrelInterface(std::list<std::string> &sfc_fnames, std::list<std::string> &well_path_fnames, std::string &unique_model_name, GeoLib::GEOObjects* obj); - virtual ~PetrelInterface(); private: void readPetrelSurface (std::istream &in); diff --git a/FileIO/TetGenInterface.cpp b/FileIO/TetGenInterface.cpp index 9b39bd936d4..1f76b4d0eca 100644 --- a/FileIO/TetGenInterface.cpp +++ b/FileIO/TetGenInterface.cpp @@ -38,10 +38,6 @@ TetGenInterface::TetGenInterface() : { } -TetGenInterface::~TetGenInterface() -{ -} - bool TetGenInterface::readTetGenGeometry (std::string const& geo_fname, GeoLib::GEOObjects &geo_objects) { diff --git a/FileIO/TetGenInterface.h b/FileIO/TetGenInterface.h index 7cb274f7f6d..d9ee8f6ae1d 100644 --- a/FileIO/TetGenInterface.h +++ b/FileIO/TetGenInterface.h @@ -38,11 +38,10 @@ namespace FileIO * node - mesh node / geometric point definition * ele - mesh element definition */ -class TetGenInterface +class TetGenInterface final { public: TetGenInterface(); - virtual ~TetGenInterface(); /** * Method reads geometry from a TetGen poly or smesh file. diff --git a/GeoLib/IO/Gmsh/GMSHLine.cpp b/GeoLib/IO/Gmsh/GMSHLine.cpp index d54864be270..d3fda7cb580 100644 --- a/GeoLib/IO/Gmsh/GMSHLine.cpp +++ b/GeoLib/IO/Gmsh/GMSHLine.cpp @@ -22,9 +22,6 @@ GMSHLine::GMSHLine(std::size_t start_point_id, std::size_t end_point_id) : _start_pnt_id(start_point_id), _end_pnt_id(end_point_id) {} -GMSHLine::~GMSHLine() -{} - void GMSHLine::write(std::ostream &os, std::size_t id) const { os << "Line(" << id << ") = {" << _start_pnt_id << "," << _end_pnt_id << "};\n"; diff --git a/GeoLib/IO/Gmsh/GMSHLine.h b/GeoLib/IO/Gmsh/GMSHLine.h index f6ca31d91cc..d67bfcbcb71 100644 --- a/GeoLib/IO/Gmsh/GMSHLine.h +++ b/GeoLib/IO/Gmsh/GMSHLine.h @@ -20,10 +20,9 @@ namespace IO namespace GMSH { -class GMSHLine { +class GMSHLine final { public: GMSHLine(std::size_t start_point_id, std::size_t end_point_id); - virtual ~GMSHLine(); void write(std::ostream &os, std::size_t id) const; void resetLineData(std::size_t start_point_id, std::size_t end_point_id); diff --git a/GeoLib/IO/Gmsh/GMSHPoint.cpp b/GeoLib/IO/Gmsh/GMSHPoint.cpp index ae9714f5f98..3e5da53c8a2 100644 --- a/GeoLib/IO/Gmsh/GMSHPoint.cpp +++ b/GeoLib/IO/Gmsh/GMSHPoint.cpp @@ -34,9 +34,6 @@ void GMSHPoint::write(std::ostream &os) const } } -GMSHPoint::~GMSHPoint() -{} - std::ostream& operator<< (std::ostream &os, GMSHPoint const& p) { p.write (os); diff --git a/GeoLib/IO/Gmsh/GMSHPoint.h b/GeoLib/IO/Gmsh/GMSHPoint.h index 11b2885d1a9..41310a4ba91 100644 --- a/GeoLib/IO/Gmsh/GMSHPoint.h +++ b/GeoLib/IO/Gmsh/GMSHPoint.h @@ -20,11 +20,10 @@ namespace IO { namespace GMSH { - -class GMSHPoint : public GeoLib::Point { +class GMSHPoint final : public GeoLib::Point +{ public: GMSHPoint(GeoLib::Point const& pnt, std::size_t id, double mesh_density); - virtual ~GMSHPoint(); void write(std::ostream &os) const; private: double _mesh_density; diff --git a/GeoLib/PointVec.cpp b/GeoLib/PointVec.cpp index 22af4c9442a..169a4eb713f 100644 --- a/GeoLib/PointVec.cpp +++ b/GeoLib/PointVec.cpp @@ -121,10 +121,6 @@ PointVec::PointVec(const std::string& name, } } -PointVec::~PointVec() -{ -} - std::size_t PointVec::push_back(Point* pnt) { _pnt_id_map.push_back(uniqueInsert(pnt)); diff --git a/GeoLib/PointVec.h b/GeoLib/PointVec.h index 31dd0042104..fa359ebe397 100644 --- a/GeoLib/PointVec.h +++ b/GeoLib/PointVec.h @@ -39,7 +39,7 @@ namespace GeoLib * a unique name from class GEOObject. For this reason PointVec should have * a name. * */ -class PointVec : public TemplateVec<Point> +class PointVec final : public TemplateVec<Point> { public: /// Signals if the vector contains object of type Point or Station @@ -73,9 +73,6 @@ public: std::map<std::string, std::size_t>* name_id_map = nullptr, PointType type = PointVec::PointType::POINT, double rel_eps = std::numeric_limits<double>::epsilon()); - /** Destructor deletes all Points of this PointVec. */ - virtual ~PointVec (); - /** * Method adds a Point to the (internal) standard vector and takes the ownership. * If the given point is already included in the vector, the point will be destroyed and diff --git a/MeshLib/IO/VtkIO/VtuInterface.cpp b/MeshLib/IO/VtkIO/VtuInterface.cpp index f9ce4a60c6e..776e94d6e8f 100644 --- a/MeshLib/IO/VtkIO/VtuInterface.cpp +++ b/MeshLib/IO/VtkIO/VtuInterface.cpp @@ -49,9 +49,6 @@ VtuInterface::VtuInterface(const MeshLib::Mesh* mesh, int dataMode, bool compres WARN("Ascii data cannot be compressed, ignoring compression flag.") } -VtuInterface::~VtuInterface() -{} - MeshLib::Mesh* VtuInterface::readVTUFile(std::string const &file_name) { if (!BaseLib::IsFileExisting(file_name)) { diff --git a/MeshLib/IO/VtkIO/VtuInterface.h b/MeshLib/IO/VtkIO/VtuInterface.h index 8b28b745832..06d881ed2d3 100644 --- a/MeshLib/IO/VtkIO/VtuInterface.h +++ b/MeshLib/IO/VtkIO/VtuInterface.h @@ -29,12 +29,11 @@ namespace IO * This class is currently not inherited from Writer because VTK will implement * writing to a string from 6.2 onwards. */ -class VtuInterface +class VtuInterface final { public: /// Provide the mesh to write and set if compression should be used. VtuInterface(const MeshLib::Mesh* mesh, int dataMode = vtkXMLWriter::Binary, bool compressed = false); - ~VtuInterface(); /// Read an unstructured grid from a VTU file /// \return The converted mesh or a nullptr if reading failed diff --git a/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.cpp b/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.cpp index 3512faebcd2..d97f09abc47 100644 --- a/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.cpp +++ b/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.cpp @@ -33,9 +33,6 @@ Mesh2MeshPropertyInterpolation::Mesh2MeshPropertyInterpolation(Mesh const*const _src_mesh(src_mesh), _src_properties(src_properties) {} -Mesh2MeshPropertyInterpolation::~Mesh2MeshPropertyInterpolation() -{} - bool Mesh2MeshPropertyInterpolation::setPropertiesForMesh(Mesh *dest_mesh, std::vector<double>& dest_properties) const { if (_src_mesh->getDimension() != dest_mesh->getDimension()) { diff --git a/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.h b/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.h index cdaf987fc82..3d4a5525778 100644 --- a/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.h +++ b/MeshLib/MeshEditing/Mesh2MeshPropertyInterpolation.h @@ -24,7 +24,8 @@ class Mesh; * (destination) mesh deploying weighted interpolation. The two * meshes must have the same dimension. */ -class Mesh2MeshPropertyInterpolation { +class Mesh2MeshPropertyInterpolation final +{ public: /** * Constructor taking the source or input mesh and properties. @@ -37,7 +38,6 @@ public: * indices the vector of properties must have \f$\ge n\f$ entries. */ Mesh2MeshPropertyInterpolation(Mesh const*const source_mesh, std::vector<double> const*const source_properties); - virtual ~Mesh2MeshPropertyInterpolation(); /** * Calculates entries for the property vector and sets appropriate indices in the diff --git a/MeshLib/MeshQuality/AngleSkewMetric.cpp b/MeshLib/MeshQuality/AngleSkewMetric.cpp index 6e2c26dcc9f..81919894f21 100644 --- a/MeshLib/MeshQuality/AngleSkewMetric.cpp +++ b/MeshLib/MeshQuality/AngleSkewMetric.cpp @@ -29,9 +29,6 @@ AngleSkewMetric::AngleSkewMetric(Mesh const& mesh) : ElementQualityMetric(mesh) {} -AngleSkewMetric::~AngleSkewMetric() -{} - void AngleSkewMetric::calculateQuality () { const std::vector<MeshLib::Element*>& elements(_mesh.getElements()); diff --git a/MeshLib/MeshQuality/AngleSkewMetric.h b/MeshLib/MeshQuality/AngleSkewMetric.h index c31938eecf8..3b330df5c8a 100644 --- a/MeshLib/MeshQuality/AngleSkewMetric.h +++ b/MeshLib/MeshQuality/AngleSkewMetric.h @@ -23,13 +23,12 @@ namespace MeshLib /** * Calculates the quality of mesh elements based on the EquiAngleSkew measure */ -class AngleSkewMetric : public ElementQualityMetric +class AngleSkewMetric final : public ElementQualityMetric { public: AngleSkewMetric(Mesh const& mesh); - virtual ~AngleSkewMetric(); - virtual void calculateQuality (); + void calculateQuality(); private: double checkTriangle(Element const& elem) const; diff --git a/MeshLib/Node.cpp b/MeshLib/Node.cpp index d28d8a7bbee..c75ae987e28 100644 --- a/MeshLib/Node.cpp +++ b/MeshLib/Node.cpp @@ -38,10 +38,6 @@ Node::Node(const Node &node) { } -Node::~Node() -{ -} - void Node::updateCoordinates(double x, double y, double z) { _x[0] = x; diff --git a/MeshLib/Node.h b/MeshLib/Node.h index 44d3820a206..ee7f8db3497 100644 --- a/MeshLib/Node.h +++ b/MeshLib/Node.h @@ -29,7 +29,7 @@ class Element; /** * A mesh node with coordinates in 3D space. */ -class Node : public MathLib::Point3dWithID +class Node final : public MathLib::Point3dWithID { /* friend classes: */ friend class Mesh; @@ -61,9 +61,6 @@ public: /// Get number of elements the node is part of. std::size_t getNumberOfElements() const { return _elements.size(); } - /// Destructor - virtual ~Node(); - /// Shift the node according to the displacement vector v. Node operator-(MathLib::Vector3 const& v) const { @@ -73,7 +70,7 @@ public: protected: /// Update coordinates of a node. /// This method automatically also updates the areas/volumes of all connected elements. - virtual void updateCoordinates(double x, double y, double z); + void updateCoordinates(double x, double y, double z); /** * Add an element the node is part of. diff --git a/MeshLib/Vtk/VtkMappedMeshSource.cpp b/MeshLib/Vtk/VtkMappedMeshSource.cpp index 6a3e1ec88bc..a0d2c7ad743 100644 --- a/MeshLib/Vtk/VtkMappedMeshSource.cpp +++ b/MeshLib/Vtk/VtkMappedMeshSource.cpp @@ -39,11 +39,6 @@ VtkMappedMeshSource::VtkMappedMeshSource() this->SetNumberOfInputPorts(0); } -VtkMappedMeshSource::~VtkMappedMeshSource() -{ - -} - int VtkMappedMeshSource::ProcessRequest( vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) diff --git a/MeshLib/Vtk/VtkMappedMeshSource.h b/MeshLib/Vtk/VtkMappedMeshSource.h index 4460d1bc58c..a60306cd5e5 100644 --- a/MeshLib/Vtk/VtkMappedMeshSource.h +++ b/MeshLib/Vtk/VtkMappedMeshSource.h @@ -52,12 +52,12 @@ namespace MeshLib { /// Adapter which maps a MeshLib::Mesh to a vtkUnstructuredGridAlgorithm. /// Allows for zero-copy access of the mesh from the visualization side. -class VtkMappedMeshSource : public vtkUnstructuredGridAlgorithm +class VtkMappedMeshSource final : public vtkUnstructuredGridAlgorithm { public: static VtkMappedMeshSource *New(); vtkTypeMacro(VtkMappedMeshSource, vtkUnstructuredGridAlgorithm) - virtual void PrintSelf(std::ostream &os, vtkIndent indent); + void PrintSelf(std::ostream &os, vtkIndent indent); /// Sets the mesh. Calling is mandatory void SetMesh(const MeshLib::Mesh* mesh) { this->_mesh = mesh; this->Modified(); } @@ -67,7 +67,6 @@ public: protected: VtkMappedMeshSource(); - ~VtkMappedMeshSource(); int ProcessRequest(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector); -- GitLab