OGS
LocalAssemblerInterface.cpp
Go to the documentation of this file.
1
12
13#include <cassert>
14
17
18namespace ProcessLib
19{
21 double const /*t*/,
22 double const /*dt*/,
23 std::vector<double> const& /*local_x*/,
24 std::vector<double> const& /*local_x_prev*/,
25 std::vector<double>& /*local_M_data*/,
26 std::vector<double>& /*local_K_data*/,
27 std::vector<double>& /*local_b_data*/)
28{
30 "The assemble() function is not implemented in the local assembler.");
31}
32
34 double const /*t*/, double const /*dt*/, Eigen::VectorXd const& /*local_x*/,
35 Eigen::VectorXd const& /*local_x_prev*/, int const /*process_id*/,
36 std::vector<double>& /*local_M_data*/,
37 std::vector<double>& /*local_K_data*/,
38 std::vector<double>& /*local_b_data*/)
39{
41 "The assembleForStaggeredScheme() function is not implemented in the "
42 "local assembler.");
43}
44
46 double const /*t*/, double const /*dt*/,
47 std::vector<double> const& /*local_x*/,
48 std::vector<double> const& /*local_x_prev*/,
49 std::vector<double>& /*local_b_data*/,
50 std::vector<double>& /*local_Jac_data*/)
51{
53 "The assembleWithJacobian() function is not implemented in the local "
54 "assembler.");
55}
56
58 double const /*t*/, double const /*dt*/, Eigen::VectorXd const& /*local_x*/,
59 Eigen::VectorXd const& /*local_x_prev*/, int const /*process_id*/,
60 std::vector<double>& /*local_b_data*/,
61 std::vector<double>& /*local_Jac_data*/)
62{
64 "The assembleWithJacobianForStaggeredScheme() function is not "
65 "implemented in the local assembler.");
66}
67
69 std::size_t const mesh_item_id,
70 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables,
71 double const t, double const dt, std::vector<GlobalVector*> const& x,
72 GlobalVector const& x_prev, int const process_id)
73{
74 auto const local_x = NumLib::getLocalX(mesh_item_id, dof_tables, x);
75
76 // Todo: A more decent way is to directly pass x_prevs as done for x
77 auto const indices =
78 NumLib::getIndices(mesh_item_id, *dof_tables[process_id]);
79 auto const local_x_prev_vec = x_prev.get(indices);
80 auto const local_x_prev = MathLib::toVector(local_x_prev_vec);
81
82 computeSecondaryVariableConcrete(t, dt, local_x, local_x_prev);
83}
84
86 std::size_t const mesh_item_id,
87 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables,
88 std::vector<GlobalVector*> const& x, double const t, int const process_id)
89{
90 auto local_x = NumLib::getLocalX(mesh_item_id, dof_tables, x);
91
92 setInitialConditionsConcrete(local_x, t, process_id);
93}
94
96 std::size_t const /*mesh_item_id*/,
97 NumLib::LocalToGlobalIndexMap const& /*dof_table*/)
98{
100}
101
103 std::size_t const mesh_item_id,
104 NumLib::LocalToGlobalIndexMap const& dof_table, GlobalVector const& x,
105 double const t, double const delta_t)
106{
107 auto const indices = NumLib::getIndices(mesh_item_id, dof_table);
108 auto const local_x = x.get(indices);
109
110 preTimestepConcrete(local_x, t, delta_t);
111}
112
114 std::size_t const mesh_item_id,
115 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables,
116 std::vector<GlobalVector*> const& x,
117 std::vector<GlobalVector*> const& x_prev, double const t, double const dt,
118 int const process_id)
119{
120 auto const local_x = NumLib::getLocalX(mesh_item_id, dof_tables, x);
121 auto const local_x_prev =
122 NumLib::getLocalX(mesh_item_id, dof_tables, x_prev);
123
124 postTimestepConcrete(local_x, local_x_prev, t, dt, process_id);
125}
126
128 std::size_t const mesh_item_id,
129 std::vector<NumLib::LocalToGlobalIndexMap const*> const& dof_tables,
130 std::vector<GlobalVector*> const& x,
131 std::vector<GlobalVector*> const& x_prev, double const t, double const dt,
132 int const process_id)
133{
134 auto const local_x = NumLib::getLocalX(mesh_item_id, dof_tables, x);
135 auto const local_x_prev =
136 NumLib::getLocalX(mesh_item_id, dof_tables, x_prev);
137
138 postNonLinearSolverConcrete(local_x, local_x_prev, t, dt, process_id);
139}
140
141} // namespace ProcessLib
#define OGS_FATAL(...)
Definition Error.h:26
Global vector based on Eigen vector.
Definition EigenVector.h:25
double get(IndexType rowId) const
get entry
Definition EigenVector.h:58
virtual void preTimestepConcrete(std::vector< double > const &, double const, double const)
virtual void setInitialConditionsConcrete(Eigen::VectorXd const, double const, int const)
virtual void postNonLinearSolverConcrete(Eigen::VectorXd const &, Eigen::VectorXd const &, double const, double const, int const)
void postNonLinearSolver(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
virtual void postTimestep(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, double const t, double const dt, int const process_id)
virtual void computeSecondaryVariableConcrete(double const, double const, Eigen::VectorXd const &, Eigen::VectorXd const &)
virtual void assembleWithJacobian(double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_x_prev, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
virtual void computeSecondaryVariable(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, GlobalVector const &x_prev, int const process_id)
virtual void assembleForStaggeredScheme(double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data)
virtual void postTimestepConcrete(Eigen::VectorXd const &, Eigen::VectorXd const &, double const, double const, int const)
virtual void preTimestep(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table, GlobalVector const &x, double const t, double const delta_t)
virtual void initialize(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
virtual void assembleWithJacobianForStaggeredScheme(double const t, double const dt, Eigen::VectorXd const &local_x, Eigen::VectorXd const &local_x_prev, int const process_id, std::vector< double > &local_b_data, std::vector< double > &local_Jac_data)
virtual void assemble(double const t, double const dt, std::vector< double > const &local_x, std::vector< double > const &local_x_prev, std::vector< double > &local_M_data, std::vector< double > &local_K_data, std::vector< double > &local_b_data)
virtual void setInitialConditions(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x, double const t, int const process_id)
Eigen::Map< const Vector > toVector(std::vector< double > const &data, Eigen::VectorXd::Index size)
Creates an Eigen mapped vector from the given data vector.
std::vector< GlobalIndexType > getIndices(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
Eigen::VectorXd getLocalX(std::size_t const mesh_item_id, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, std::vector< GlobalVector * > const &x)