24 : _jacobian_assembler(jacobian_assembler)
34 auto const local_x = x.
get(indices);
41 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& dof_tables,
42 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
43 std::vector<GlobalVector*>
const& x_prev,
int const process_id,
46 std::vector<std::vector<GlobalIndexType>> indices_of_processes;
47 indices_of_processes.reserve(dof_tables.size());
48 transform(cbegin(dof_tables), cend(dof_tables),
49 back_inserter(indices_of_processes),
50 [&](
auto const dof_table)
53 auto const& indices = indices_of_processes[process_id];
58 std::size_t
const number_of_processes = x.size();
60 if (number_of_processes == 1)
62 auto const local_x = x[process_id]->get(indices);
63 auto const local_x_prev = x_prev[process_id]->get(indices);
69 auto local_coupled_xs =
73 auto local_coupled_x_prevs =
82 auto const num_r_c = indices.size();
83 auto const r_c_indices =
89 M->
add(r_c_indices, local_M);
94 K->
add(r_c_indices, local_K);
108 std::vector<NumLib::LocalToGlobalIndexMap const*>
const& dof_tables,
109 const double t,
double const dt, std::vector<GlobalVector*>
const& x,
110 std::vector<GlobalVector*>
const& x_prev,
int const process_id,
113 std::vector<std::vector<GlobalIndexType>> indices_of_processes;
114 indices_of_processes.reserve(dof_tables.size());
115 transform(cbegin(dof_tables), cend(dof_tables),
116 back_inserter(indices_of_processes),
117 [&](
auto const dof_table)
120 auto const& indices = indices_of_processes[process_id];
125 std::size_t
const number_of_processes = x.size();
127 if (number_of_processes == 1)
129 auto const local_x = x[process_id]->get(indices);
130 auto const local_x_prev = x_prev[process_id]->get(indices);
132 local_assembler, t, dt, local_x, local_x_prev,
_local_b_data,
137 auto local_coupled_xs =
141 auto local_coupled_x_prevs =
146 local_assembler, t, dt, local_x, local_x_prev, process_id,
150 auto const num_r_c = indices.size();
151 auto const r_c_indices =
161 auto const local_Jac =
163 Jac->
add(r_c_indices, local_Jac);
168 "No Jacobian has been assembled! This might be due to programming "
169 "errors in the local assembler of the current process.");
int add(IndexType row, IndexType col, double val)
Global vector based on Eigen vector.
void add(IndexType rowId, double v)
add entry
double get(IndexType rowId) const
get entry
MathLib::RowColumnIndices< GlobalIndexType > RowColumnIndices
Base class for Jacobian assemblers.
virtual void assembleWithJacobian(LocalAssemblerInterface &local_assembler, 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)=0
virtual void assembleWithJacobianForStaggeredScheme(LocalAssemblerInterface &, double const, double const, Eigen::VectorXd const &, Eigen::VectorXd const &, int const, std::vector< double > &, std::vector< double > &)
virtual void preAssemble(double const, double const, std::vector< double > const &)
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 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)
std::vector< double > _local_b_data
void assemble(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, double const t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalMatrix *M, GlobalMatrix *K, GlobalVector *b)
VectorMatrixAssembler(AbstractJacobianAssembler &jacobian_assembler)
std::vector< double > _local_K_data
std::vector< double > _local_Jac_data
void preAssemble(const std::size_t mesh_item_id, LocalAssemblerInterface &local_assembler, const NumLib::LocalToGlobalIndexMap &dof_table, const double t, double const dt, const GlobalVector &x)
Assembly::LocalMatrixOutput _local_output
AbstractJacobianAssembler & _jacobian_assembler
Used to assemble the Jacobian.
void assembleWithJacobian(std::size_t const mesh_item_id, LocalAssemblerInterface &local_assembler, std::vector< NumLib::LocalToGlobalIndexMap const * > const &dof_tables, const double t, double const dt, std::vector< GlobalVector * > const &x, std::vector< GlobalVector * > const &x_prev, int const process_id, GlobalVector *b, GlobalMatrix *Jac)
std::vector< double > _local_M_data
Eigen::Map< const Vector > toVector(std::vector< double > const &data, Eigen::VectorXd::Index size)
Creates an Eigen mapped vector from the given data vector.
Eigen::Map< const Matrix > toMatrix(std::vector< double > const &data, Eigen::MatrixXd::Index rows, Eigen::MatrixXd::Index cols)
std::vector< GlobalIndexType > getIndices(std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const &dof_table)
std::vector< double > getCoupledLocalSolutions(std::vector< GlobalVector * > const &global_solutions, std::vector< std::vector< GlobalIndexType > > const &indices)