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::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType > Class Template Reference

Short class definition. More...

#include <cg_solver.h>

Inheritance diagram for Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >:
Collaboration diagram for Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >:

Public Member Functions

Life Cycle
 CGSolver ()
 Default constructor. More...
 
 CGSolver (double NewMaxTolerance)
 
 CGSolver (double NewMaxTolerance, unsigned int NewMaxIterationsNumber)
 
 CGSolver (double NewMaxTolerance, unsigned int NewMaxIterationsNumber, typename TPreconditionerType::Pointer pNewPreconditioner)
 
 CGSolver (Parameters settings, typename TPreconditionerType::Pointer pNewPreconditioner)
 
 CGSolver (Parameters settings)
 
 CGSolver (const CGSolver &Other)
 Copy constructor. More...
 
 ~CGSolver () override
 Destructor. More...
 
Operators
CGSolveroperator= (const CGSolver &Other)
 Assignment operator. More...
 
Operations
bool Solve (SparseMatrixType &rA, VectorType &rX, VectorType &rB) override
 
bool Solve (SparseMatrixType &rA, DenseMatrixType &rX, DenseMatrixType &rB) override
 
Input and output
std::string Info () const override
 Turn back information as a string. More...
 
void PrintInfo (std::ostream &rOStream) const override
 Print information about this object. More...
 
void PrintData (std::ostream &rOStream) const override
 Print object's data. More...
 
- Public Member Functions inherited from Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, Preconditioner< TSparseSpaceType, TDenseSpaceType >, Reorderer< TSparseSpaceType, TDenseSpaceType > >
 IterativeSolver ()
 Default constructor. More...
 
 IterativeSolver (double NewTolerance)
 
 IterativeSolver (double NewTolerance, unsigned int NewMaxIterationsNumber)
 
 IterativeSolver (double NewTolerance, unsigned int NewMaxIterationsNumber, typename TPreconditionerType::Pointer pNewPreconditioner)
 
 IterativeSolver (Parameters settings, typename TPreconditionerType::Pointer pNewPreconditioner=Kratos::make_shared< Preconditioner< TSparseSpaceType, TDenseSpaceType > >())
 
 IterativeSolver (const IterativeSolver &Other)
 Copy constructor. More...
 
 ~IterativeSolver () override
 Destructor. More...
 
IterativeSolveroperator= (const IterativeSolver &Other)
 Assignment operator. More...
 
void InitializeSolutionStep (SparseMatrixType &rA, VectorType &rX, VectorType &rB) override
 
void FinalizeSolutionStep (SparseMatrixType &rA, VectorType &rX, VectorType &rB) override
 
void Clear () override
 
bool AdditionalPhysicalDataIsNeeded () override
 
void ProvideAdditionalData (SparseMatrixType &rA, VectorType &rX, VectorType &rB, typename ModelPart::DofsArrayType &rdof_set, ModelPart &r_model_part) override
 
virtual TPreconditionerType::Pointer GetPreconditioner (void)
 
virtual const TPreconditionerType::Pointer GetPreconditioner (void) const
 
virtual void SetPreconditioner (typename TPreconditionerType::Pointer pNewPreconditioner)
 
virtual void SetMaxIterationsNumber (unsigned int NewMaxIterationsNumber)
 
virtual IndexType GetMaxIterationsNumber ()
 
virtual void SetIterationsNumber (unsigned int NewIterationNumber)
 
IndexType GetIterationsNumber () override
 
void SetTolerance (double NewTolerance) override
 This method allows to set the tolerance in the linear solver. More...
 
double GetTolerance () override
 This method allows to get the tolerance in the linear solver. More...
 
virtual void SetResidualNorm (double NewResidualNorm)
 
virtual double GetResidualNorm ()
 
virtual bool IterationNeeded ()
 
virtual bool IsConverged ()
 
std::string Info () const override
 Turn back information as a string. More...
 
void PrintInfo (std::ostream &rOStream) const override
 Print information about this object. More...
 
void PrintData (std::ostream &rOStream) const override
 Print object's data. More...
 
 KRATOS_CLASS_POINTER_DEFINITION (IterativeSolver)
 Pointer definition of IterativeSolver. More...
 
- Public Member Functions inherited from Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >
 LinearSolver ()
 Default constructor. More...
 
 LinearSolver (Reorderer< TSparseSpaceType, TDenseSpaceType > NewReorderer)
 Constructor with specific reorderer. More...
 
 LinearSolver (const LinearSolver &Other)
 Copy constructor. More...
 
virtual ~LinearSolver ()
 Destructor. More...
 
LinearSolveroperator= (const LinearSolver &Other)
 Assignment operator. More...
 
virtual void Initialize (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 
virtual void PerformSolutionStep (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 
virtual void Solve (SparseMatrixType &K, SparseMatrixType &M, DenseVectorType &Eigenvalues, DenseMatrixType &Eigenvectors)
 
virtual TReordererType::Pointer GetReorderer ()
 
virtual void SetReorderer (typename TReordererType::Pointer pNewReorderer)
 
virtual bool IsConsistent (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 This method checks if the dimensions of the system of equations are consistent. More...
 
virtual bool IsConsistent (SparseMatrixType &rA, DenseMatrixType &rX, DenseMatrixType &rB)
 This method checks if the dimensions of the system of equations are consistent (dense matrix for RHS and unknowns version) More...
 
virtual bool IsNotConsistent (SparseMatrixType &rA, VectorType &rX, VectorType &rB)
 This method checks if the dimensions of the system of equations are not consistent. More...
 
virtual bool IsNotConsistent (SparseMatrixType &rA, DenseMatrixType &rX, DenseMatrixType &rB)
 This method checks if the dimensions of the system of equations are not consistent. More...
 
 KRATOS_CLASS_POINTER_DEFINITION (LinearSolver)
 Pointer definition of LinearSolver. More...
 

Type Definitions

typedef IterativeSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType > BaseType
 
typedef TSparseSpaceType::MatrixType SparseMatrixType
 
typedef TSparseSpaceType::VectorType VectorType
 
typedef TDenseSpaceType::MatrixType DenseMatrixType
 
 KRATOS_CLASS_POINTER_DEFINITION (CGSolver)
 Pointer definition of CGSolver. More...
 

Additional Inherited Members

- Public Types inherited from Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, Preconditioner< TSparseSpaceType, TDenseSpaceType >, Reorderer< TSparseSpaceType, TDenseSpaceType > >
typedef LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > > BaseType
 
typedef TSparseSpaceType::MatrixType SparseMatrixType
 
typedef TSparseSpaceType::VectorType VectorType
 
typedef TDenseSpaceType::MatrixType DenseMatrixType
 
typedef Preconditioner< TSparseSpaceType, TDenseSpaceType > PreconditionerType
 
typedef TSparseSpaceType::IndexType IndexType
 The index type definition to be consistent. More...
 
- Public Types inherited from Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >
typedef TSparseSpaceType::MatrixType SparseMatrixType
 
typedef TSparseSpaceType::MatrixPointerType SparseMatrixPointerType
 
typedef TSparseSpaceType::VectorType VectorType
 
typedef TSparseSpaceType::VectorPointerType VectorPointerType
 
typedef TDenseSpaceType::MatrixType DenseMatrixType
 
typedef TDenseSpaceType::VectorType DenseVectorType
 
typedef std::size_t SizeType
 
typedef TSparseSpaceType::IndexType IndexType
 The index type definition to be consistent. More...
 
- Protected Member Functions inherited from Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, Preconditioner< TSparseSpaceType, TDenseSpaceType >, Reorderer< TSparseSpaceType, TDenseSpaceType > >
void PreconditionedMult (SparseMatrixType &rA, VectorType &rX, VectorType &rY)
 
void PreconditionedTransposeMult (SparseMatrixType &rA, VectorType &rX, VectorType &rY)
 
- Protected Attributes inherited from Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, Preconditioner< TSparseSpaceType, TDenseSpaceType >, Reorderer< TSparseSpaceType, TDenseSpaceType > >
double mResidualNorm
 
double mFirstResidualNorm
 
IndexType mIterationsNumber
 
double mBNorm
 

Detailed Description

template<class TSparseSpaceType, class TDenseSpaceType, class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
class Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >

Short class definition.

Detail class definition.

Member Typedef Documentation

◆ BaseType

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
typedef IterativeSolver<TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType> Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::BaseType

◆ DenseMatrixType

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
typedef TDenseSpaceType::MatrixType Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::DenseMatrixType

◆ SparseMatrixType

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
typedef TSparseSpaceType::MatrixType Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::SparseMatrixType

◆ VectorType

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
typedef TSparseSpaceType::VectorType Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::VectorType

Constructor & Destructor Documentation

◆ CGSolver() [1/7]

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::CGSolver ( )
inline

Default constructor.

◆ CGSolver() [2/7]

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::CGSolver ( double  NewMaxTolerance)
inline

◆ CGSolver() [3/7]

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::CGSolver ( double  NewMaxTolerance,
unsigned int  NewMaxIterationsNumber 
)
inline

◆ CGSolver() [4/7]

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::CGSolver ( double  NewMaxTolerance,
unsigned int  NewMaxIterationsNumber,
typename TPreconditionerType::Pointer  pNewPreconditioner 
)
inline

◆ CGSolver() [5/7]

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::CGSolver ( Parameters  settings,
typename TPreconditionerType::Pointer  pNewPreconditioner 
)
inline

◆ CGSolver() [6/7]

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::CGSolver ( Parameters  settings)
inline

◆ CGSolver() [7/7]

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::CGSolver ( const CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType > &  Other)
inline

Copy constructor.

◆ ~CGSolver()

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::~CGSolver ( )
inlineoverride

Destructor.

Member Function Documentation

◆ Info()

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
std::string Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::Info ( ) const
inlineoverridevirtual

◆ KRATOS_CLASS_POINTER_DEFINITION()

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::KRATOS_CLASS_POINTER_DEFINITION ( CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >  )

Pointer definition of CGSolver.

◆ operator=()

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

Assignment operator.

◆ PrintData()

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
void Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::PrintData ( std::ostream &  rOStream) const
inlineoverridevirtual

◆ PrintInfo()

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
void Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::PrintInfo ( std::ostream &  rOStream) const
inlineoverridevirtual

◆ Solve() [1/2]

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
bool Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::Solve ( SparseMatrixType rA,
DenseMatrixType rX,
DenseMatrixType rB 
)
inlineoverridevirtual

Multi solve method for solving a set of linear systems with same coefficient matrix. Solves the linear system Ax=b and puts the result on SystemVector& rX. rX is also th initial guess for iterative methods.

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

Reimplemented from Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >.

◆ Solve() [2/2]

template<class TSparseSpaceType , class TDenseSpaceType , class TPreconditionerType = Preconditioner<TSparseSpaceType, TDenseSpaceType>, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
bool Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >::Solve ( SparseMatrixType rA,
VectorType rX,
VectorType rB 
)
inlineoverridevirtual

Normal solve method. Solves the linear system Ax=b and puts the result on SystemVector& rX. rX is also th initial guess for iterative methods.

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

Reimplemented from Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >.


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