14 #if !defined(KRATOS_DIAGONAL_PRECONDITIONER_H_INCLUDED )
15 #define KRATOS_DIAGONAL_PRECONDITIONER_H_INCLUDED
21 #include <boost/numeric/ublas/vector.hpp>
56 template<
class TSparseSpaceType,
class TDenseSpaceType>
68 typedef typename TSparseSpaceType::DataType
DataType;
85 :
BaseType(Other), mDiagonal(Other.mDiagonal), mTemp(Other.mTemp) {}
99 mDiagonal = Other.mDiagonal;
126 mDiagonal[
Index] = 1.00 / std::sqrt(std::abs(diag_Aii));
128 KRATOS_THROW_ERROR(std::logic_error,
"zero found in the diagonal. Diagonal preconditioner can not be used",
"");
232 std::string
Info()
const override
234 return "Diagonal preconditioner";
240 OStream <<
"Diagonal preconditioner";
345 template<
class TSparseSpaceType,
class TDenseSpaceType>
353 template<
class TSparseSpaceType,
class TDenseSpaceType>
358 OStream << std::endl;
DiagonalPreconditioner class.
Definition: diagonal_preconditioner.h:58
Preconditioner< TSparseSpaceType, TDenseSpaceType > BaseType
Definition: diagonal_preconditioner.h:66
~DiagonalPreconditioner() override
Destructor.
Definition: diagonal_preconditioner.h:88
void Mult(SparseMatrixType &rA, VectorType &rX, VectorType &rY) override
Definition: diagonal_preconditioner.h:138
TSparseSpaceType::DataType DataType
Definition: diagonal_preconditioner.h:68
void PrintInfo(std::ostream &OStream) const override
Print information about this object.
Definition: diagonal_preconditioner.h:238
void TransposeMult(SparseMatrixType &rA, VectorType &rX, VectorType &rY) override
Definition: diagonal_preconditioner.h:148
void Initialize(SparseMatrixType &rA, DenseMatrixType &rX, DenseMatrixType &rB) override
Definition: diagonal_preconditioner.h:133
VectorType & ApplyLeft(VectorType &rX) override
Definition: diagonal_preconditioner.h:158
KRATOS_CLASS_POINTER_DEFINITION(DiagonalPreconditioner)
Counted pointer of DiagonalPreconditioner.
DiagonalPreconditioner(const DiagonalPreconditioner &Other)
Copy constructor.
Definition: diagonal_preconditioner.h:84
DiagonalPreconditioner & operator=(const DiagonalPreconditioner &Other)
Assignment operator.
Definition: diagonal_preconditioner.h:96
VectorType & ApplyInverseRight(VectorType &rX) override
Definition: diagonal_preconditioner.h:200
VectorType & ApplyRight(VectorType &rX) override
Definition: diagonal_preconditioner.h:167
std::string Info() const override
Return information about this object.
Definition: diagonal_preconditioner.h:232
TDenseSpaceType::MatrixType DenseMatrixType
Definition: diagonal_preconditioner.h:74
TSparseSpaceType::MatrixType SparseMatrixType
Definition: diagonal_preconditioner.h:70
VectorType & ApplyTransposeRight(VectorType &rX) override
Definition: diagonal_preconditioner.h:191
DiagonalPreconditioner()
Default constructor.
Definition: diagonal_preconditioner.h:81
VectorType & ApplyTransposeLeft(VectorType &rX) override
Definition: diagonal_preconditioner.h:182
VectorType & Finalize(VectorType &rX) override
Definition: diagonal_preconditioner.h:209
TSparseSpaceType::VectorType VectorType
Definition: diagonal_preconditioner.h:72
void Initialize(SparseMatrixType &rA, VectorType &rX, VectorType &rB) override
Definition: diagonal_preconditioner.h:116
This class is useful for index iteration over containers.
Definition: parallel_utilities.h:451
void for_each(TUnaryFunction &&f)
Definition: parallel_utilities.h:514
Preconditioner class.
Definition: preconditioner.h:75
virtual void PrintData(std::ostream &rOStream) const
Print object's data.
Definition: preconditioner.h:278
virtual void Initialize(SparseMatrixType &rA, VectorType &rX, VectorType &rB)
Definition: preconditioner.h:123
Preconditioner & operator=(const Preconditioner &Other)
Assignment operator.
Definition: preconditioner.h:108
#define KRATOS_THROW_ERROR(ExceptionType, ErrorMessage, MoreInfo)
Definition: define.h:77
void TransposeMult(SparseSpaceType &dummy, SparseSpaceType::MatrixType &rA, SparseSpaceType::VectorType &rX, SparseSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:104
TSpaceType::IndexType Size(TSpaceType &dummy, typename TSpaceType::VectorType const &rV)
Definition: add_strategies_to_python.cpp:111
void Mult(TSpaceType &dummy, typename TSpaceType::MatrixType &rA, typename TSpaceType::VectorType &rX, typename TSpaceType::VectorType &rY)
Definition: add_strategies_to_python.cpp:98
REF: G. R. Cowper, GAUSSIAN QUADRATURE FORMULAS FOR TRIANGLES.
Definition: mesh_condition.cpp:21
std::istream & operator>>(std::istream &rIStream, LinearMasterSlaveConstraint &rThis)
input stream function
std::ostream & operator<<(std::ostream &rOStream, const LinearMasterSlaveConstraint &rThis)
output stream function
Definition: linear_master_slave_constraint.h:432
zero
Definition: test_pureconvectionsolver_benchmarking.py:94