15 std::vector<std::string> weak_form_names;
17 weak_form_names.push_back(wf->name());
19 std::vector<std::vector<size_t>> index_map =
field_store->indexMap(weak_form_names);
21 std::vector<std::vector<FieldState>> inputs;
24 "solve_input_field_names size must match weak_forms size");
26 for (
size_t i = 0; i <
weak_forms.size(); ++i) {
27 std::vector<FieldState> fields_for_wk;
32 fields_for_wk.push_back(
field_store->getField(field_name));
35 inputs.push_back(fields_for_wk);
38 std::vector<std::string> bc_field_names;
41 "solve_result_field_names size must match weak_forms size");
43 for (
size_t row = 0; row <
weak_forms.size(); ++row) {
44 for (
size_t col = 0; col <
weak_forms.size(); ++col) {
45 index_map[row][col] = invalid_block_index;
46 for (
size_t arg = 0; arg < inputs[row].size(); ++arg) {
48 index_map[row][col] = arg;
53 SLIC_ERROR_IF(index_map[row][row] == invalid_block_index,
"Requested solve result field '"
55 <<
"' is not an argument of weak form '"
56 << weak_form_names[row] <<
"'");
61 std::vector<std::vector<FieldState>> wk_params(
weak_forms.size(), params);
63 std::vector<WeakForm*> weak_form_ptrs;
65 weak_form_ptrs.push_back(p.get());
68 ?
field_store->getBoundaryConditionManagers(weak_form_names)
69 :
field_store->getBoundaryConditionManagersForFields(bc_field_names);
70 return solver->solve(weak_form_ptrs, index_map,
field_store->getShapeDisp(), inputs, wk_params, time_info,
75 const std::vector<FieldState>& states_for_reactions)
const
77 std::vector<ReactionState> reactions;
80 std::vector<FieldState> wf_fields =
field_store->getStatesFromVectors(wf->name(), states_for_reactions, params);
81 std::string test_field_name =
field_store->getWeakFormReaction(wf->name());
82 size_t test_field_idx =
field_store->getFieldIndex(test_field_name);
83 FieldState test_field = states_for_reactions[test_field_idx];
Accelerator functionality.
constexpr T & get(variant< T0, T1 > &v)
Returns the variant member of specified type.
auto evaluateWeakForm(const std::shared_ptr< WeakForm > &weak_form, const TimeInfo &time_info, FieldState shape_disp, const std::vector< FieldState > &field_states, FieldState field_for_residual_space)
gretl-function implementation which evaluates the residual force (which is minus the mechanical force...
gretl::State< FEFieldPtr, FEDualPtr > FieldState
typedef
Methods for solving systems of equations as given by WeakForms. Tracks these operations on the gretl ...
Reaction class which is a names combination of a weak form and a set of dirichlet constrained nodes.
std::vector< std::shared_ptr< WeakForm > > weak_forms
Weak forms solved together by this system.
std::shared_ptr< FieldStore > field_store
Field store managing the system's fields.
virtual std::vector< ReactionState > computeReactions(const TimeInfo &time_info, const std::vector< FieldState > &states_for_reactions) const
Compute reactions after solving the main state.
virtual std::vector< FieldState > solve(const TimeInfo &time_info) const
Solve the system using the internal weak_forms and solver.
std::shared_ptr< SystemSolver > solver
The solver for the system.
std::vector< std::string > solve_result_field_names
Optional per-weak-form fields to solve/update instead of reaction fields.
std::vector< std::vector< std::string > > solve_input_field_names
Optional per-weak-form input field ordering used during solve.
struct storing time and timestep information
Defines the SystemBase struct for common system functionality.