8#include <kernel/solver/base.hpp>
21 template<
typename Vector_,
typename Filter_>
62 const Filter_& filter) :
68 auto omega_p = section->
query(
"omega");
69 if(omega_p.second && !omega_p.first.parse(this->_omega))
70 throw ParseError(section_name +
".omega", omega_p.first,
"a positive float");
100 virtual Status apply(Vector_& vec_cor,
const Vector_& vec_def)
override
102 vec_cor.scale(vec_def, this->_omega);
121 template<
typename Filter_,
typename DataType_>
123 const Filter_& filter, DataType_ omega)
125 return std::make_shared<ScalePrecond<typename Filter_::VectorType, Filter_>>(filter, omega);
143 template<
typename Filter_>
146 const Filter_& filter)
148 return std::make_shared<ScalePrecond<typename Filter_::VectorType, Filter_>>(
149 section_name, section, filter);
#define XASSERT(expr)
Assertion macro definition.
Class for parser related errors.
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.
Scaling preconditioner class template.
ScalePrecond(const String §ion_name, const PropertyMap *section, const Filter_ &filter)
Constructor using a PropertyMap.
DataType _omega
the scaling factor
virtual ~ScalePrecond()
Empty virtual destructor.
SolverBase< Vector_ > BaseClass
Our base class.
virtual Status apply(Vector_ &vec_cor, const Vector_ &vec_def) override
Solver application method.
const Filter_ & _filter
the filter
ScalePrecond(const Filter_ &filter, DataType omega)
Constructor.
Vector_::DataType DataType
our data type
virtual String name() const override
Returns the name of the solver.
void set_omega(DataType omega)
Sets the damping parameter.
Polymorphic solver interface.
String class implementation.
std::shared_ptr< ScalePrecond< typename Filter_::VectorType, Filter_ > > new_scale_precond(const Filter_ &filter, DataType_ omega)
Creates a new ScalePrecond solver object.
Status
Solver status return codes enumeration.
@ success
solving successful (convergence criterion fulfilled)