8#include <kernel/solver/base.hpp>
9#include <kernel/util/dist.hpp>
31 template<
typename VectorType_,
typename FilterType_>
110 template<
typename NonlinearOperator_>
114 typename NonlinearOperator_::SystemLevelType::GlobalSystemVectorR,
115 typename NonlinearOperator_::SystemLevelType::GlobalSystemFilter
120 typedef typename NonlinearOperator_::SystemLevelType::GlobalSystemVectorR
VectorType;
122 typedef typename NonlinearOperator_::SystemLevelType::GlobalSystemFilter
FilterType;
134 template<
typename... Args_>
136 _op(std::forward<Args_>(args)...)
150 return "NonlinearOperatorPrecondWrapper<"+
_op.name()+
">";
156 _op.prepare(vec_state);
168 Statistics::add_solver_expression(std::make_shared<ExpressionStartSolve>(this->
name()));
169 Statistics::add_solver_expression(std::make_shared<ExpressionCallPrecond>(this->
name(), _op.name()));
173 Statistics::add_solver_expression(std::make_shared<ExpressionEndSolve>(this->
name(), st, 1));
181 return this->
name() +
"[" + _op.info() +
"]";
197 template<
typename NonlinearOperator_,
typename... Args_>
198 inline std::shared_ptr<NonlinearOperatorPrecondWrapper<NonlinearOperator_>>
201 return std::make_shared<NonlinearOperatorPrecondWrapper<NonlinearOperator_>>(std::forward<Args_>(args)...);
Abstract base class for preconditioners for nonlinear optimization.
virtual void prepare(const VectorType &vec_state, FilterType &filter)=0
Prepares the preconditioner for application.
NLOptPrecond()
Empty default constructor.
virtual String name() const override=0
Returns a descriptive String.
VectorType_ VectorType
Floating point data type.
FilterType_ FilterType
Type of the filter.
virtual Status apply(VectorType &vec_cor, const VectorType &vec_def) override=0
Applies the preconditioner.
virtual String info() const
Returns information.
virtual ~NLOptPrecond()
Empty virtual destructor.
Wrapper class around a (potentially nonlinear) operator.
NonlinearOperatorPrecondWrapper(Args_ &&... args)
Variadic template constructor.
NonlinearOperator_ _op
The operator that defines the preconditioner.
Solver::NLOptPrecond< VectorType, FilterType > BaseClass
Our base class.
virtual String name() const override
Returns a descriptive String.
NonlinearOperator_::SystemLevelType::GlobalSystemVectorR VectorType
The vector type the preconditioner can be applied to.
virtual String info() const override
Returns information.
virtual void prepare(const VectorType &vec_state, FilterType &filter) override
Prepares the preconditioner for application.
virtual void init_numeric() override
Numeric initialization method.
virtual ~NonlinearOperatorPrecondWrapper()
Virtual destructor.
virtual Solver::Status apply(VectorType &vec_cor, const VectorType &vec_def) override
Applies the preconditioner.
NonlinearOperator_::SystemLevelType::GlobalSystemFilter FilterType
The filter type.
Polymorphic solver interface.
String class implementation.
std::shared_ptr< NonlinearOperatorPrecondWrapper< NonlinearOperator_ > > new_nonlinear_operator_precond_wrapper(Args_ &&... args)
Creates a new NonlinearOperatorPrecondWrapper.
Status
Solver status return codes enumeration.