10#include <kernel/solver/nlopt_precond.hpp>
12#include <control/meshopt/dudv_functional_control.hpp>
55 typename MeshoptCtrl_,
56 typename DomCtrl_ =
typename MeshoptCtrl_::DomainControlType,
57 typename SolverVectorType_ =
typename MeshoptCtrl_::SystemLevelType::GlobalSystemVectorL,
58 typename FilterType_ =
typename MeshoptCtrl_::SystemLevelType::GlobalSystemFilter
60 static std::shared_ptr<Solver::NLOptPrecond<SolverVectorType_, FilterType_>>
63 std::shared_ptr<Solver::NLOptPrecond<SolverVectorType_, FilterType_> > result;
65 auto& solver_config = my_ctrl.solver_config;
67 auto precon_p = current_section->
query(
"precon");
69 if(precon_p.second && precon_p.first !=
"none")
71 auto precon_section = solver_config.query_section(precon_p.first);
72 if(precon_section ==
nullptr)
73 XABORTM(
"precon_section "+precon_p.first+
" not found!");
81 auto precon_solver_p = precon_section->query(
"linear_solver");
82 if(!precon_solver_p.second)
83 XABORTM(
"precon_section has no linear_solver key!");
85 auto dirichlet_list_p = precon_section->query(
"dirichlet_boundaries");
86 std::deque<String> precon_dirichlet_list = dirichlet_list_p.first.split_by_whitespaces();
88 auto slip_list_p = precon_section->query(
"slip_boundaries");
89 std::deque<String> precon_slip_list = slip_list_p.first.split_by_whitespaces();
91 bool fixed_reference_domain(
false);
92 auto fixed_reference_domain_p = precon_section->query(
"fixed_reference_domain");
93 if(fixed_reference_domain_p.second)
95 fixed_reference_domain = (std::stoi(fixed_reference_domain_p.first) == 1);
98 int level(my_ctrl.meshopt_lvl);
102 typename MeshoptCtrl_::DataType,
103 typename MeshoptCtrl_::IndexType,
107 result = Solver::new_nonlinear_operator_precond_wrapper<PreconControlType>
108 (dom_ctrl, level, precon_dirichlet_list, precon_slip_list,
109 precon_solver_p.first, solver_config, fixed_reference_domain);
118 auto inner_solver_p = current_section->
query(
"inner_solver");
119 if(inner_solver_p.second)
121 auto inner_solver_section = solver_config.query_section(inner_solver_p.first);
#define XABORTM(msg)
Abortion macro definition with custom message.
Control class for DuDvFunctionals.
A class organizing a tree of key-value pairs.
std::pair< String, bool > query(String key_path) const
Queries a value by its key path.
Factory class for specialized preconditioners.
static std::shared_ptr< Solver::NLOptPrecond< SolverVectorType_, FilterType_ > > create_nlopt_precond(MeshoptCtrl_ &my_ctrl, DomCtrl_ &dom_ctrl, PropertyMap *current_section)
Creates a preconditioner for nonlinear mesh optimization problems.