From a2691ee2b3a09531831ee07dc11a5b58358fd4d3 Mon Sep 17 00:00:00 2001
From: "Dmitry Yu. Naumov" <github@naumov.de>
Date: Thu, 16 Jul 2015 01:39:19 +0000
Subject: [PATCH] [MaL] Eigen add final to classes. Del dtors.

---
 MathLib/LinAlg/Eigen/EigenLinearSolver.cpp     |  8 ++------
 MathLib/LinAlg/Eigen/EigenLinearSolver.h       | 10 ++++++----
 MathLib/LinAlg/Eigen/EigenMatrix.h             |  2 --
 MathLib/LinAlg/Eigen/EigenOption.h             |  5 +----
 MathLib/LinAlg/Eigen/EigenVector.h             |  7 +------
 MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h |  4 +---
 6 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp b/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp
index 8b42c9b77f7..867b25d869c 100644
--- a/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp
+++ b/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp
@@ -26,7 +26,7 @@ namespace details
 
 /// Template class for Eigen direct linear solvers
 template <class T_SOLVER, class T_BASE>
-class EigenDirectLinearSolver : public T_BASE
+class EigenDirectLinearSolver final : public T_BASE
 {
 public:
     explicit EigenDirectLinearSolver(EigenMatrix::RawMatrixType &A) : _A(A)
@@ -39,8 +39,6 @@ public:
         }
     }
 
-    virtual ~EigenDirectLinearSolver() {}
-
     void solve(EigenVector::RawVectorType &b, EigenVector::RawVectorType &x, EigenOption &/*opt*/) override
     {
         INFO("-> solve");
@@ -58,7 +56,7 @@ private:
 
 /// Template class for Eigen iterative linear solvers
 template <class T_SOLVER, class T_BASE>
-class EigenIterativeLinearSolver : public T_BASE
+class EigenIterativeLinearSolver final : public T_BASE
 {
 public:
     explicit EigenIterativeLinearSolver(EigenMatrix::RawMatrixType &A) : _A(A)
@@ -71,8 +69,6 @@ public:
         }
     }
 
-    virtual ~EigenIterativeLinearSolver() {}
-
     void solve(EigenVector::RawVectorType &b, EigenVector::RawVectorType &x, EigenOption &opt) override
     {
         INFO("-> solve");
diff --git a/MathLib/LinAlg/Eigen/EigenLinearSolver.h b/MathLib/LinAlg/Eigen/EigenLinearSolver.h
index 8f7261e3fa1..8d428c88f4e 100644
--- a/MathLib/LinAlg/Eigen/EigenLinearSolver.h
+++ b/MathLib/LinAlg/Eigen/EigenLinearSolver.h
@@ -24,12 +24,12 @@ class EigenMatrix;
 
 /**
  */
-class EigenLinearSolver
+class EigenLinearSolver final
 {
 public:
     EigenLinearSolver(EigenMatrix &A, boost::property_tree::ptree const*const option = nullptr);
 
-    virtual ~EigenLinearSolver()
+    ~EigenLinearSolver()
     {
         delete _solver;
     }
@@ -64,8 +64,10 @@ protected:
     class IEigenSolver
     {
     public:
-        virtual ~IEigenSolver() {}
-        /// execute a linear solver
+        virtual ~IEigenSolver() = default;
+        /**
+         * execute a linear solver
+         */
         virtual void solve(EigenVector::RawVectorType &b, EigenVector::RawVectorType &x, EigenOption &) = 0;
     };
 
diff --git a/MathLib/LinAlg/Eigen/EigenMatrix.h b/MathLib/LinAlg/Eigen/EigenMatrix.h
index 2b7c8040531..79b54e5cb0c 100644
--- a/MathLib/LinAlg/Eigen/EigenMatrix.h
+++ b/MathLib/LinAlg/Eigen/EigenMatrix.h
@@ -40,8 +40,6 @@ public:
      */
     explicit EigenMatrix(std::size_t n) :_mat(n, n) {}
 
-    ~EigenMatrix() {}
-
     /// return the number of rows
     std::size_t getNRows() const { return _mat.rows(); }
 
diff --git a/MathLib/LinAlg/Eigen/EigenOption.h b/MathLib/LinAlg/Eigen/EigenOption.h
index bd8d3f625a7..a7ef314ff37 100644
--- a/MathLib/LinAlg/Eigen/EigenOption.h
+++ b/MathLib/LinAlg/Eigen/EigenOption.h
@@ -18,7 +18,7 @@ namespace MathLib
 /**
  * \brief Option for Eigen sparse solver
  */
-struct EigenOption
+struct EigenOption final
 {
     /// Solver type
     enum class SolverType : int
@@ -53,9 +53,6 @@ struct EigenOption
      */
     EigenOption();
 
-    /// Destructor
-    ~EigenOption() {}
-
     /**
      * return a linear solver type from the solver name
      *
diff --git a/MathLib/LinAlg/Eigen/EigenVector.h b/MathLib/LinAlg/Eigen/EigenVector.h
index 31ad4e83d77..ca52dc1481c 100644
--- a/MathLib/LinAlg/Eigen/EigenVector.h
+++ b/MathLib/LinAlg/Eigen/EigenVector.h
@@ -24,7 +24,7 @@ namespace MathLib
 /**
  * Global vector based on Eigen vector
  */
-class EigenVector
+class EigenVector final
 {
 public:
     using RawVectorType = Eigen::VectorXd;
@@ -38,11 +38,6 @@ public:
     /// copy constructor
     EigenVector(EigenVector const &src) : _vec(src._vec) {}
 
-    /**
-     *
-     */
-    virtual ~EigenVector() {}
-
     /// return a vector length
     std::size_t size() const { return _vec.size(); }
 
diff --git a/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h b/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h
index c503e34ddaa..4629b9e8349 100644
--- a/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h
+++ b/MathLib/LinAlg/EigenLis/EigenLisLinearSolver.h
@@ -25,7 +25,7 @@ class EigenMatrix;
 /**
  * Linear solver using Lis library with Eigen matrix and vector objects
  */
-class EigenLisLinearSolver
+class EigenLisLinearSolver final
 {
 public:
     /**
@@ -37,8 +37,6 @@ public:
      */
     EigenLisLinearSolver(EigenMatrix &A, boost::property_tree::ptree const*const option = nullptr);
 
-    virtual ~EigenLisLinearSolver() {}
-
     /**
      * configure linear solvers
      * @param option
-- 
GitLab