9#include <kernel/solver/base.hpp>
32 template<
typename Matrix_,
typename Filter_>
34 public SolverBase<typename Matrix_::VectorTypeL>
44 typedef typename MatrixType::DataType
DataType;
103 auto omega_p = section->
query(
"omega");
104 if(omega_p.second && (!omega_p.first.parse(this->_omega) || (this->_omega <=
DataType(0))))
105 throw ParseError(section_name +
".omega", omega_p.first,
"a positive float");
159 vec_cor.component_product(
_inv_diag, vec_def);
160 this->_filter.filter_cor(vec_cor);
180 template<
typename Matrix_,
typename Filter_>
182 const Matrix_& matrix,
const Filter_& filter,
183 const typename Matrix_::DataType omega =
typename Matrix_::DataType(1))
185 return std::make_shared<JacobiPrecond<Matrix_, Filter_>>(matrix, filter, omega);
203 template<
typename Matrix_,
typename Filter_>
206 const Matrix_& matrix,
const Filter_& filter)
208 return std::make_shared<JacobiPrecond<Matrix_, Filter_>>(section_name, section, matrix, 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.
Jacobi preconditioner implementation.
DataType _omega
The damping parameter.
const MatrixType & _matrix
The system matrix.
virtual Status apply(VectorType &vec_cor, const VectorType &vec_def) override
Solver application method.
MatrixType::DataType DataType
The floating point precision.
VectorType _inv_diag
The component-wise inverted diagonal of _matrix.
virtual ~JacobiPrecond()
Empty virtual destructor.
const FilterType & _filter
The filter for projecting solution and defect to subspaces.
void set_omega(DataType omega)
Sets the damping parameter.
JacobiPrecond(const String §ion_name, const PropertyMap *section, const MatrixType &matrix, const FilterType &filter)
Constructor using a PropertyMap.
JacobiPrecond(const MatrixType &matrix, const FilterType &filter, DataType omega=DataType(1))
Constructor.
virtual void init_symbolic() override
Symbolic initialization method.
Filter_ FilterType
The filter type.
Matrix_ MatrixType
The matrix type.
virtual void init_numeric() override
Numeric initialization method.
virtual void done_symbolic() override
Symbolic finalization method.
virtual String name() const override
Returns a descriptive string.
MatrixType::VectorTypeL VectorType
The type of vector this solver can be applied to.
SolverBase< VectorType > BaseClass
Our base class.
Polymorphic solver interface.
String class implementation.
Status
Solver status return codes enumeration.
@ success
solving successful (convergence criterion fulfilled)
std::shared_ptr< JacobiPrecond< Matrix_, Filter_ > > new_jacobi_precond(const Matrix_ &matrix, const Filter_ &filter, const typename Matrix_::DataType omega=typename Matrix_::DataType(1))
Creates a new JacobiPrecond solver object.