KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
List of all members
Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType > Class Template Reference

Preconditioner class. More...

#include <preconditioner.h>

Inheritance diagram for Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >:
Collaboration diagram for Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >:

Public Member Functions

Life Cycle
 Preconditioner ()
 Default constructor. More...
 
 Preconditioner (const Preconditioner &Other)
 Copy constructor. More...
 
virtual ~Preconditioner ()
 Destructor. More...
 
Operators
Preconditioneroperator= (const Preconditioner &Other)
 Assignment operator. More...
 
Operations
virtual void Initialize (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 
virtual void Initialize (SparseMatrixType &rA, DenseMatrixType &rX, DenseMatrixType &rB)
 
virtual void InitializeSolutionStep (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 
virtual void FinalizeSolutionStep (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 
virtual void Clear ()
 
virtual bool AdditionalPhysicalDataIsNeeded ()
 
virtual void ProvideAdditionalData (SparseMatrixType &rA, VectorType &rX, VectorType &rB, typename ModelPart::DofsArrayType &rdof_set, ModelPart &r_model_part)
 
virtual void Mult (SparseMatrixType &rA, VectorType &rX, VectorType &rY)
 
virtual void TransposeMult (SparseMatrixType &rA, VectorType &rX, VectorType &rY)
 
virtual VectorTypeApplyLeft (VectorType &rX)
 
virtual VectorTypeApplyRight (VectorType &rX)
 
virtual VectorTypeApplyTransposeLeft (VectorType &rX)
 
virtual VectorTypeApplyTransposeRight (VectorType &rX)
 
virtual VectorTypeApplyInverseRight (VectorType &rX)
 
virtual VectorTypeFinalize (VectorType &rX)
 
Input and output
virtual std::string Info () const
 Turn back information as a string. More...
 
virtual void PrintInfo (std::ostream &rOStream) const
 Print information about this object. More...
 
virtual void PrintData (std::ostream &rOStream) const
 Print object's data. More...
 

Type Definitions

typedef TSparseSpaceType::MatrixType SparseMatrixType
 
typedef TSparseSpaceType::VectorType VectorType
 
typedef TDenseSpaceType::MatrixType DenseMatrixType
 
 KRATOS_CLASS_POINTER_DEFINITION (Preconditioner)
 Pointer definition of Preconditioner. More...
 

Detailed Description

template<class TSparseSpaceType, class TDenseSpaceType>
class Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >

Preconditioner class.

Base class for preconditioners for linesr system solvers which defining standard interface for all the preconditioners derived from it.

Considering a linear solver FooSolver with a method FooSolver::Solve. A typical code using this type of Preconditioners would be:

\begin{verbatim} FooSolver::Solve(A,b,x,preconditioner) { preconditioner.Initialize(A,x,b); ... ... while(...) // Start iteration. { preconditioner.ApplyLeft(x); mult(a,x) preconditioner.ApplyRight(x) } // End iteration

preconditioner.Finalize(A,x,b); } \end{verbatim}

Member Typedef Documentation

◆ DenseMatrixType

template<class TSparseSpaceType , class TDenseSpaceType >
typedef TDenseSpaceType::MatrixType Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::DenseMatrixType

◆ SparseMatrixType

template<class TSparseSpaceType , class TDenseSpaceType >
typedef TSparseSpaceType::MatrixType Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::SparseMatrixType

◆ VectorType

template<class TSparseSpaceType , class TDenseSpaceType >
typedef TSparseSpaceType::VectorType Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::VectorType

Constructor & Destructor Documentation

◆ Preconditioner() [1/2]

template<class TSparseSpaceType , class TDenseSpaceType >
Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::Preconditioner ( )
inline

Default constructor.

◆ Preconditioner() [2/2]

template<class TSparseSpaceType , class TDenseSpaceType >
Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::Preconditioner ( const Preconditioner< TSparseSpaceType, TDenseSpaceType > &  Other)
inline

Copy constructor.

◆ ~Preconditioner()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::~Preconditioner ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ AdditionalPhysicalDataIsNeeded()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual bool Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::AdditionalPhysicalDataIsNeeded ( )
inlinevirtual

Some preconditioners may require a minimum degree of knowledge of the structure of the matrix. To make an example when solving a mixed u-p problem, it is important to identify the row associated to v and p. another example is the automatic prescription of rotation null-space for smoothed-aggregation preconditioners which require knowledge on the spatial position of the nodes associated to a given dof. This function tells if the solver requires such data

Reimplemented in Kratos::AdditiveSchwarzPreconditioner< TSparseSpaceType, TDenseSpaceType >.

◆ ApplyInverseRight()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual VectorType& Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::ApplyInverseRight ( VectorType rX)
inlinevirtual

◆ ApplyLeft()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual VectorType& Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::ApplyLeft ( VectorType rX)
inlinevirtual

◆ ApplyRight()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual VectorType& Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::ApplyRight ( VectorType rX)
inlinevirtual

◆ ApplyTransposeLeft()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual VectorType& Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::ApplyTransposeLeft ( VectorType rX)
inlinevirtual

Preconditioner transpose solver. Solving tranpose preconditioner system M^T*x=y, where m^T means transpose.

Parameters
rXUnknows of preconditioner suystem

Reimplemented in Kratos::ILUPreconditioner< TSparseSpaceType, TDenseSpaceType >, and Kratos::DiagonalPreconditioner< TSparseSpaceType, TDenseSpaceType >.

◆ ApplyTransposeRight()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual VectorType& Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::ApplyTransposeRight ( VectorType rX)
inlinevirtual

◆ Clear()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual void Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::Clear ( )
inlinevirtual

This function is designed to clean up all internal data in the solver. Clear is designed to leave the solver object as if newly created. After a clear a new Initialize is needed

◆ Finalize()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual VectorType& Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::Finalize ( VectorType rX)
inlinevirtual

◆ FinalizeSolutionStep()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual void Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::FinalizeSolutionStep ( SparseMatrixType rA,
VectorType rX,
VectorType rB 
)
inlinevirtual

This function is designed to be called at the end of the solve step. for example this is the place to remove any data that we do not want to save for later

Parameters
rA.System matrix
rX.Solution vector. it's also the initial guess for iterative linear solvers.
rB.Right hand side vector.

◆ Info()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual std::string Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::Info ( ) const
inlinevirtual

◆ Initialize() [1/2]

template<class TSparseSpaceType , class TDenseSpaceType >
virtual void Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::Initialize ( SparseMatrixType rA,
DenseMatrixType rX,
DenseMatrixType rB 
)
inlinevirtual

◆ Initialize() [2/2]

template<class TSparseSpaceType , class TDenseSpaceType >
virtual void Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::Initialize ( SparseMatrixType rA,
VectorType rX,
VectorType rB 
)
inlinevirtual

Preconditioner Initialize Initialize preconditioner for linear system rA*rX=rB

Parameters
rAsystem matrix.
rXUnknows vector
rBRight side linear system of equations.

Reimplemented in Kratos::ILU0Preconditioner< TSparseSpaceType, TDenseSpaceType >, and Kratos::DiagonalPreconditioner< TSparseSpaceType, TDenseSpaceType >.

◆ InitializeSolutionStep()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual void Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::InitializeSolutionStep ( SparseMatrixType rA,
VectorType rX,
VectorType rB 
)
inlinevirtual

This function is designed to be called every time the coefficients change in the system that is, normally at the beginning of each solve. For example if we are implementing a direct solver, this is the place to do the factorization so that then the backward substitution can be performed effectively more than once

Parameters
rA.System matrix
rX.Solution vector. it's also the initial guess for iterative linear solvers.
rB.Right hand side vector.

◆ KRATOS_CLASS_POINTER_DEFINITION()

template<class TSparseSpaceType , class TDenseSpaceType >
Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::KRATOS_CLASS_POINTER_DEFINITION ( Preconditioner< TSparseSpaceType, TDenseSpaceType >  )

Pointer definition of Preconditioner.

◆ Mult()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual void Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::Mult ( SparseMatrixType rA,
VectorType rX,
VectorType rY 
)
inlinevirtual

◆ operator=()

template<class TSparseSpaceType , class TDenseSpaceType >
Preconditioner& Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::operator= ( const Preconditioner< TSparseSpaceType, TDenseSpaceType > &  Other)
inline

Assignment operator.

◆ PrintData()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual void Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::PrintData ( std::ostream &  rOStream) const
inlinevirtual

◆ PrintInfo()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual void Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::PrintInfo ( std::ostream &  rOStream) const
inlinevirtual

◆ ProvideAdditionalData()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual void Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::ProvideAdditionalData ( SparseMatrixType rA,
VectorType rX,
VectorType rB,
typename ModelPart::DofsArrayType rdof_set,
ModelPart r_model_part 
)
inlinevirtual

Some preconditioners may require a minimum degree of knowledge of the structure of the matrix. To make an example when solving a mixed u-p problem, it is important to identify the row associated to v and p. another example is the automatic prescription of rotation null-space for smoothed-aggregation preconditioners which require knowledge on the spatial position of the nodes associated to a given dof. This function is the place to eventually provide such data

Reimplemented in Kratos::AdditiveSchwarzPreconditioner< TSparseSpaceType, TDenseSpaceType >.

◆ TransposeMult()

template<class TSparseSpaceType , class TDenseSpaceType >
virtual void Kratos::Preconditioner< TSparseSpaceType, TDenseSpaceType >::TransposeMult ( SparseMatrixType rA,
VectorType rX,
VectorType rY 
)
inlinevirtual

The documentation for this class was generated from the following file: