Skip to content
Snippets Groups Projects
Commit e5e6d5d4 authored by Christoph Lehmann's avatar Christoph Lehmann
Browse files

[PL] documented VectorMatrixAssembler

parent a3ba8180
No related branches found
No related tags found
No related merge requests found
...@@ -96,7 +96,9 @@ void VectorMatrixAssembler::assembleWithJacobian( ...@@ -96,7 +96,9 @@ void VectorMatrixAssembler::assembleWithJacobian(
MathLib::toMatrix(_local_Jac_data, num_r_c, num_r_c); MathLib::toMatrix(_local_Jac_data, num_r_c, num_r_c);
Jac.add(r_c_indices, local_Jac); Jac.add(r_c_indices, local_Jac);
} else { } 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.");
} }
} }
......
...@@ -23,18 +23,26 @@ namespace ProcessLib ...@@ -23,18 +23,26 @@ namespace ProcessLib
{ {
class LocalAssemblerInterface; 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 class VectorMatrixAssembler final
{ {
public: public:
VectorMatrixAssembler( explicit VectorMatrixAssembler(
std::unique_ptr<AbstractJacobianAssembler>&& jacobian_assembler); 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, void assemble(std::size_t const mesh_item_id,
LocalAssemblerInterface& local_assembler, LocalAssemblerInterface& local_assembler,
NumLib::LocalToGlobalIndexMap const& dof_table, NumLib::LocalToGlobalIndexMap const& dof_table,
double const t, GlobalVector const& x, GlobalMatrix& M, double const t, GlobalVector const& x, GlobalMatrix& M,
GlobalMatrix& K, GlobalVector& b); 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, void assembleWithJacobian(std::size_t const mesh_item_id,
LocalAssemblerInterface& local_assembler, LocalAssemblerInterface& local_assembler,
NumLib::LocalToGlobalIndexMap const& dof_table, NumLib::LocalToGlobalIndexMap const& dof_table,
...@@ -45,11 +53,14 @@ public: ...@@ -45,11 +53,14 @@ public:
GlobalMatrix& Jac); GlobalMatrix& Jac);
private: private:
// temporary data only stored here in order to avoid frequent memory
// reallocations.
std::vector<double> _local_M_data; std::vector<double> _local_M_data;
std::vector<double> _local_K_data; std::vector<double> _local_K_data;
std::vector<double> _local_b_data; std::vector<double> _local_b_data;
std::vector<double> _local_Jac_data; std::vector<double> _local_Jac_data;
//! Used to assemble the Jacobian.
std::unique_ptr<AbstractJacobianAssembler> _jacobian_assembler; std::unique_ptr<AbstractJacobianAssembler> _jacobian_assembler;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment