From 5284175198d16fcfb4ba114587da7a763f389a2d Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Tue, 6 Jul 2021 13:56:44 +0200
Subject: [PATCH] [NL/DOF] Split MatrixProviderUser into
 ML/LinAlg/MatrixProvider and ML/LinAlg/VectorProvider.

---
 NumLib/DOF/GlobalMatrixProviders.h            |  3 +-
 NumLib/DOF/MatrixProvider.h                   | 42 +++++++++++++++++++
 NumLib/DOF/SimpleMatrixVectorProvider.h       |  3 +-
 ...{MatrixProviderUser.h => VectorProvider.h} | 25 -----------
 Tests/NumLib/TestExtrapolation.cpp            |  3 +-
 5 files changed, 48 insertions(+), 28 deletions(-)
 create mode 100644 NumLib/DOF/MatrixProvider.h
 rename NumLib/DOF/{MatrixProviderUser.h => VectorProvider.h} (77%)

diff --git a/NumLib/DOF/GlobalMatrixProviders.h b/NumLib/DOF/GlobalMatrixProviders.h
index e386b459c1c..529edf2914d 100644
--- a/NumLib/DOF/GlobalMatrixProviders.h
+++ b/NumLib/DOF/GlobalMatrixProviders.h
@@ -10,7 +10,8 @@
 
 #pragma once
 
-#include "MatrixProviderUser.h"
+#include "MatrixProvider.h"
+#include "VectorProvider.h"
 #include "numlib_export.h"
 
 namespace NumLib
diff --git a/NumLib/DOF/MatrixProvider.h b/NumLib/DOF/MatrixProvider.h
new file mode 100644
index 00000000000..18d3fb69300
--- /dev/null
+++ b/NumLib/DOF/MatrixProvider.h
@@ -0,0 +1,42 @@
+/**
+ * \file
+ * \copyright
+ * Copyright (c) 2012-2021, OpenGeoSys Community (http://www.opengeosys.org)
+ *            Distributed under a Modified BSD License.
+ *              See accompanying file LICENSE.txt or
+ *              http://www.opengeosys.org/project/license
+ *
+ */
+
+#pragma once
+
+#include <cstddef>
+
+#include "MathLib/LinAlg/MatrixSpecifications.h"
+
+namespace NumLib
+{
+/*! Manages storage for matrices.
+ *
+ * This the matrix-analog of VectorProvider. The same notes apply to this class.
+ */
+class MatrixProvider
+{
+public:
+    //! Get an uninitialized matrix with the given \c id.
+    virtual GlobalMatrix& getMatrix(std::size_t& id) = 0;
+
+    //! Get a matrix according to the given specifications in the storage
+    //! of the matrix with the given \c id.
+    virtual GlobalMatrix& getMatrix(MathLib::MatrixSpecifications const& ms,
+                                    std::size_t& id) = 0;
+
+    //! Release the given matrix.
+    //!
+    //! \pre \c A must have been acquired before, i.e., you must not call this
+    //! method twice in a row in the same \c A!
+    virtual void releaseMatrix(GlobalMatrix const& A) = 0;
+
+    virtual ~MatrixProvider() = default;
+};
+}  // namespace NumLib
diff --git a/NumLib/DOF/SimpleMatrixVectorProvider.h b/NumLib/DOF/SimpleMatrixVectorProvider.h
index 293af10f08b..f87a478cca0 100644
--- a/NumLib/DOF/SimpleMatrixVectorProvider.h
+++ b/NumLib/DOF/SimpleMatrixVectorProvider.h
@@ -13,7 +13,8 @@
 #include <map>
 #include <memory>
 
-#include "MatrixProviderUser.h"
+#include "MatrixProvider.h"
+#include "VectorProvider.h"
 
 namespace NumLib
 {
diff --git a/NumLib/DOF/MatrixProviderUser.h b/NumLib/DOF/VectorProvider.h
similarity index 77%
rename from NumLib/DOF/MatrixProviderUser.h
rename to NumLib/DOF/VectorProvider.h
index 8fe4430c898..1ed74c9ef0d 100644
--- a/NumLib/DOF/MatrixProviderUser.h
+++ b/NumLib/DOF/VectorProvider.h
@@ -69,29 +69,4 @@ public:
 
     virtual ~VectorProvider() = default;
 };
-
-/*! Manages storage for matrices.
- *
- * This the matrix-analog of VectorProvider. The same notes apply to this class.
- */
-class MatrixProvider
-{
-public:
-    //! Get an uninitialized matrix with the given \c id.
-    virtual GlobalMatrix& getMatrix(std::size_t& id) = 0;
-
-    //! Get a matrix according to the given specifications in the storage
-    //! of the matrix with the given \c id.
-    virtual GlobalMatrix& getMatrix(MathLib::MatrixSpecifications const& ms,
-                                    std::size_t& id) = 0;
-
-    //! Release the given matrix.
-    //!
-    //! \pre \c A must have been acquired before, i.e., you must not call this
-    //! method twice in a row in the same \c A!
-    virtual void releaseMatrix(GlobalMatrix const& A) = 0;
-
-    virtual ~MatrixProvider() = default;
-};
-
 }  // namespace NumLib
diff --git a/Tests/NumLib/TestExtrapolation.cpp b/Tests/NumLib/TestExtrapolation.cpp
index 2e1cce4e0e5..95712d625a3 100644
--- a/Tests/NumLib/TestExtrapolation.cpp
+++ b/Tests/NumLib/TestExtrapolation.cpp
@@ -13,7 +13,8 @@
 #include "MeshLib/IO/writeMeshToFile.h"
 #include "MeshLib/MeshGenerators/MeshGenerator.h"
 #include "NumLib/DOF/DOFTableUtil.h"
-#include "NumLib/DOF/MatrixProviderUser.h"
+#include "NumLib/DOF/MatrixProvider.h"
+#include "NumLib/DOF/VectorProvider.h"
 #include "NumLib/Extrapolation/ExtrapolatableElementCollection.h"
 #include "NumLib/Extrapolation/Extrapolator.h"
 #include "NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.h"
-- 
GitLab