10#include <kernel/solver/base.hpp>
24 template<
typename Matrix_,
typename Filter_>
26 public SolverBase<typename Matrix_::VectorTypeL>
36 typedef typename MatrixType::DataType
DataType;
104 auto omega_p = section->
query(
"omega");
111 XABORTM(
name()+
" config section is missing the mandatory omega key!");
114 auto m_p = section->
query(
"m");
117 set_m(std::stoul(m_p.first));
121 XABORTM(
name()+
" config section is missing the mandatory m key!");
143 _aux2 =
_matrix.create_vector_r();
144 _aux3 =
_matrix.create_vector_r();
203 vec_cor.component_product(
_inv_diag, vec_def);
206 for (
Index i = 1; i <=
_m; ++i)
212 vec_cor.axpy(_aux2,
DataType(-1.0));
215 this->_filter.filter_cor(vec_cor);
239 template<
typename Matrix_,
typename Filter_>
241 const Matrix_& matrix,
const Filter_& filter,
242 const Index m,
const typename Matrix_::DataType omega =
typename Matrix_::DataType(1))
244 return std::make_shared<PolynomialPrecond<Matrix_, Filter_>>(matrix, filter, m, omega);
265 template<
typename Matrix_,
typename Filter_>
268 const Matrix_& matrix,
const Filter_& filter)
270 return std::make_shared<PolynomialPrecond<Matrix_, Filter_>>(section_name, section, matrix, filter);
#define XABORTM(msg)
Abortion macro definition with custom message.
#define XASSERT(expr)
Assertion macro definition.
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.
Polynomial preconditioner implementation.
Filter_ FilterType
The filter type.
const MatrixType & _matrix
The system matrix.
PolynomialPrecond(const String §ion_name, const PropertyMap *section, const MatrixType &matrix, const FilterType &filter)
Constructor using a PropertyMap.
void set_m(Index m)
Sets the polynomial order parameter.
Index _m
order m of preconditioner
virtual Status apply(VectorType &vec_cor, const VectorType &vec_def) override
Solver application method.
virtual ~PolynomialPrecond()
Empty virtual destructor.
virtual void done_symbolic() override
Symbolic finalization method.
const FilterType & _filter
The filter for projecting solution and defect to subspaces.
MatrixType::DataType DataType
The floating point precision.
virtual String name() const override
Returns a descriptive string.
SolverBase< VectorType > BaseClass
Our base class.
VectorType _aux1
auxiliary vectors
virtual void init_symbolic() override
Symbolic initialization method.
PolynomialPrecond(const MatrixType &matrix, const FilterType &filter, Index m, DataType omega=DataType(1))
Constructor.
Matrix_ MatrixType
The matrix type.
VectorType _inv_diag
The component-wise inverted diagonal of _matrix.
DataType _omega
The damping parameter for the internal jacobi preconditioner.
virtual void init_numeric() override
Numeric initialization method.
void set_omega(DataType omega)
Sets the damping parameter.
MatrixType::VectorTypeL VectorType
The type of vector this solver can be applied to.
Polymorphic solver interface.
String class implementation.
Status
Solver status return codes enumeration.
@ success
solving successful (convergence criterion fulfilled)
std::shared_ptr< PolynomialPrecond< Matrix_, Filter_ > > new_polynomial_precond(const Matrix_ &matrix, const Filter_ &filter, const Index m, const typename Matrix_::DataType omega=typename Matrix_::DataType(1))
Creates a new PoynomialPrecond solver object.
std::uint64_t Index
Index data type.