From e5e6d5d48309292cc1879fff849b7cbbd24b82ff Mon Sep 17 00:00:00 2001
From: Christoph Lehmann <christoph.lehmann@ufz.de>
Date: Wed, 24 Aug 2016 12:06:01 +0200
Subject: [PATCH] [PL] documented VectorMatrixAssembler

---
 ProcessLib/VectorMatrixAssembler.cpp |  4 +++-
 ProcessLib/VectorMatrixAssembler.h   | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/ProcessLib/VectorMatrixAssembler.cpp b/ProcessLib/VectorMatrixAssembler.cpp
index a5c620aac3e..22496e33a2e 100644
--- a/ProcessLib/VectorMatrixAssembler.cpp
+++ b/ProcessLib/VectorMatrixAssembler.cpp
@@ -96,7 +96,9 @@ void VectorMatrixAssembler::assembleWithJacobian(
             MathLib::toMatrix(_local_Jac_data, num_r_c, num_r_c);
         Jac.add(r_c_indices, local_Jac);
     } else {
-        OGS_FATAL("No Jacobian has been assembled!");
+        OGS_FATAL(
+            "No Jacobian has been assembled! This might be due to programming "
+            "errors in the local assembler of the current process.");
     }
 }
 
diff --git a/ProcessLib/VectorMatrixAssembler.h b/ProcessLib/VectorMatrixAssembler.h
index 702907bcd99..4f99a8d1b85 100644
--- a/ProcessLib/VectorMatrixAssembler.h
+++ b/ProcessLib/VectorMatrixAssembler.h
@@ -23,18 +23,26 @@ namespace ProcessLib
 {
 class LocalAssemblerInterface;
 
+//! Utility class used to assemble global matrices and vectors.
+//!
+//! The methods of this class get the global matrices and vectors as input and
+//! pass only local data on to the local assemblers.
 class VectorMatrixAssembler final
 {
 public:
-    VectorMatrixAssembler(
+    explicit VectorMatrixAssembler(
         std::unique_ptr<AbstractJacobianAssembler>&& jacobian_assembler);
 
+    //! Assembles\c M, \c K, and \c b.
+    //! \remark Jacobian is not assembled here, see assembleWithJacobian().
     void assemble(std::size_t const mesh_item_id,
                   LocalAssemblerInterface& local_assembler,
                   NumLib::LocalToGlobalIndexMap const& dof_table,
                   double const t, GlobalVector const& x, GlobalMatrix& M,
                   GlobalMatrix& K, GlobalVector& b);
 
+    //! Assembles \c M, \c K, \c b, and the Jacobian \c Jac of the residual.
+    //! \note The Jacobian must be assembled.
     void assembleWithJacobian(std::size_t const mesh_item_id,
                               LocalAssemblerInterface& local_assembler,
                               NumLib::LocalToGlobalIndexMap const& dof_table,
@@ -45,11 +53,14 @@ public:
                               GlobalMatrix& Jac);
 
 private:
+    // temporary data only stored here in order to avoid frequent memory
+    // reallocations.
     std::vector<double> _local_M_data;
     std::vector<double> _local_K_data;
     std::vector<double> _local_b_data;
     std::vector<double> _local_Jac_data;
 
+    //! Used to assemble the Jacobian.
     std::unique_ptr<AbstractJacobianAssembler> _jacobian_assembler;
 };
 
-- 
GitLab