|
|
| LinearSolver () |
| Default constructor. More...
|
|
| LinearSolver (TReordererType NewReorderer) |
| Constructor with specific reorderer. More...
|
|
| LinearSolver (const LinearSolver &Other) |
| Copy constructor. More...
|
|
virtual | ~LinearSolver () |
| Destructor. More...
|
|
|
LinearSolver & | operator= (const LinearSolver &Other) |
| Assignment operator. More...
|
|
|
virtual void | Initialize (SparseMatrixType &rA, VectorType &rX, VectorType &rB) |
|
virtual void | InitializeSolutionStep (SparseMatrixType &rA, VectorType &rX, VectorType &rB) |
|
virtual void | PerformSolutionStep (SparseMatrixType &rA, VectorType &rX, VectorType &rB) |
|
virtual void | FinalizeSolutionStep (SparseMatrixType &rA, VectorType &rX, VectorType &rB) |
|
virtual void | Clear () |
|
virtual bool | Solve (SparseMatrixType &rA, VectorType &rX, VectorType &rB) |
|
virtual bool | Solve (SparseMatrixType &rA, DenseMatrixType &rX, DenseMatrixType &rB) |
|
virtual void | Solve (SparseMatrixType &K, SparseMatrixType &M, DenseVectorType &Eigenvalues, DenseMatrixType &Eigenvectors) |
|
virtual bool | AdditionalPhysicalDataIsNeeded () |
|
virtual void | ProvideAdditionalData (SparseMatrixType &rA, VectorType &rX, VectorType &rB, typename ModelPart::DofsArrayType &rDoFSet, ModelPart &rModelPart) |
|
|
virtual TReordererType::Pointer | GetReorderer () |
|
virtual void | SetReorderer (typename TReordererType::Pointer pNewReorderer) |
|
virtual void | SetTolerance (double NewTolerance) |
| This method allows to set the tolerance in the linear solver. More...
|
|
virtual double | GetTolerance () |
| This method allows to get the tolerance in the linear solver. More...
|
|
virtual IndexType | GetIterationsNumber () |
|
|
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...
|
|
|
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...
|
|
template<class TSparseSpaceType, class TDenseSpaceType, class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
class Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >
Base class for all the linear solvers in Kratos.
This class define the general interface for the linear solvers in Kratos. There is three template parameter:
- TSparseSpaceType which specify type of the unknowns, coefficients, sparse matrix, vector of unknowns, right hand side vector and their respective operators.
- TDenseMatrixType which specify type of the matrices used as temporary matrices or multi solve unknowns and right hand sides and their operators.
- TReordererType which specify type of the Orderer that performs the reordering of matrix to optimize the solution.
template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
virtual bool Kratos::LinearSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >::AdditionalPhysicalDataIsNeeded |
( |
| ) |
|
|
inlinevirtual |
Some solvers 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 solvers 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::ScalingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MonotonicityPreservingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::IterativeSolver< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector >, Preconditioner< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector > >, Reorderer< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector > > >, Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, Preconditioner< TSparseSpaceType, TDenseSpaceType >, Reorderer< TSparseSpaceType, TDenseSpaceType > >, Kratos::AMGCLSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AMGCLSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >, Kratos::AMGCL_NS_Solver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::TrilinosMonotonicityPreservingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AmgclMPISchurComplementSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, and Kratos::MixedULMLinearSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >.
template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
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. |
Reimplemented in Kratos::SkylineLUCustomScalarSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::ScalingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MonotonicityPreservingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::IterativeSolver< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector >, Preconditioner< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector > >, Reorderer< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector > > >, Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, Preconditioner< TSparseSpaceType, TDenseSpaceType >, Reorderer< TSparseSpaceType, TDenseSpaceType > >, Kratos::TrilinosMonotonicityPreservingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, and Kratos::MixedULMLinearSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >.
template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
This function is designed to be called as few times as possible. It creates the data structures that only depend on the connectivity of the matrix (and not on its coefficients) so that the memory can be allocated once and expensive operations can be done only when strictly needed
- Parameters
-
rA. | System matrix |
rX. | Solution vector. it's also the initial guess for iterative linear solvers. |
rB. | Right hand side vector. |
Reimplemented in Kratos::MixedULMLinearSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >.
template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
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. |
Reimplemented in Kratos::SkylineLUCustomScalarSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::ScalingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MonotonicityPreservingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::IterativeSolver< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector >, Preconditioner< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector > >, Reorderer< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector > > >, Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, Preconditioner< TSparseSpaceType, TDenseSpaceType >, Reorderer< TSparseSpaceType, TDenseSpaceType > >, Kratos::TrilinosMonotonicityPreservingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::EigenDirectSolver< TSolverType, TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MixedULMLinearSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, and Kratos::EigenDenseDirectSolver< TSolverType, TSparseSpaceType, TDenseSpaceType, TReordererType >.
template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
This function actually performs the solution work, eventually taking advantage of what was done before in the Initialize and InitializeSolutionStep functions.
- Parameters
-
rA. | System matrix |
rX. | Solution vector. it's also the initial guess for iterative linear solvers. |
rB. | Right hand side vector. |
Reimplemented in Kratos::SkylineLUCustomScalarSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::EigenDirectSolver< TSolverType, TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MixedULMLinearSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, and Kratos::EigenDenseDirectSolver< TSolverType, TSparseSpaceType, TDenseSpaceType, TReordererType >.
template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Some solvers 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 solvers 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::AMGCL_NS_Solver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AmgclMPISchurComplementSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::ScalingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MonotonicityPreservingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::IterativeSolver< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector >, Preconditioner< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector > >, Reorderer< UblasSpace< double, CompressedMatrix, Vector >, UblasSpace< double, Matrix, Vector > > >, Kratos::IterativeSolver< TSparseSpaceType, TDenseSpaceType, Preconditioner< TSparseSpaceType, TDenseSpaceType >, Reorderer< TSparseSpaceType, TDenseSpaceType > >, Kratos::TrilinosMonotonicityPreservingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AMGCLSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AMGCLSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >, and Kratos::MixedULMLinearSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >.
template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
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. rVectorx 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 in Kratos::TFQMRSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::SkylineLUFactorizationSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::DeflatedCGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::BICGSTABSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::AMGCLSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AMGCLSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >, Kratos::AMGCL_NS_Solver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AztecSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AmgclMPISchurComplementSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AmesosSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::Amesos2Solver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::EigenDirectSolver< TSolverType, TSparseSpaceType, TDenseSpaceType, TReordererType >, and Kratos::MixedULMLinearSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >.
template<class TSparseSpaceType , class TDenseSpaceType , class TReordererType = Reorderer<TSparseSpaceType, TDenseSpaceType>>
Normal solve method. Solves the linear system Ax=b and puts the result on SystemVector& rX. rVectorx 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 in Kratos::TFQMRSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::SkylineLUFactorizationSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::SkylineLUCustomScalarSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::ScalingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MonotonicityPreservingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::CGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::BICGSTABSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::AMGCLSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AMGCLSolver< TSparseSpaceType, TDenseSpaceType, Reorderer< TSparseSpaceType, TDenseSpaceType > >, Kratos::AMGCL_NS_Solver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::TrilinosMonotonicityPreservingSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MultiLevelSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AztecSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AmgclMPISchurComplementSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::AmesosSolver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::Amesos2Solver< TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::EigenDirectSolver< TSolverType, TSparseSpaceType, TDenseSpaceType, TReordererType >, Kratos::MixedULMLinearSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, Kratos::DeflatedCGSolver< TSparseSpaceType, TDenseSpaceType, TPreconditionerType, TReordererType >, and Kratos::EigenDenseDirectSolver< TSolverType, TSparseSpaceType, TDenseSpaceType, TReordererType >.