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::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > Class Template Reference

Current class provides an implementation for trilinos builder and solving operations. More...

#include <trilinos_block_builder_and_solver.h>

Inheritance diagram for Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >:
Collaboration diagram for Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >:

Public Member Functions

Life Cycle
 TrilinosBlockBuilderAndSolver ()=default
 Default constructor (empty) More...
 
 TrilinosBlockBuilderAndSolver (EpetraCommunicatorType &rComm, int GuessRowSize, typename TLinearSolver::Pointer pNewLinearSystemSolver)
 Default constructor. More...
 
 TrilinosBlockBuilderAndSolver (EpetraCommunicatorType &rComm, typename TLinearSolver::Pointer pNewLinearSystemSolver, Parameters ThisParameters)
 Default constructor. (with parameters) More...
 
 TrilinosBlockBuilderAndSolver (const TrilinosBlockBuilderAndSolver &rOther)=delete
 
TrilinosBlockBuilderAndSolveroperator= (const TrilinosBlockBuilderAndSolver &rOther)=delete
 
Access
TSparseSpace::MatrixType & GetConstraintRelationMatrix () override
 This method returns constraint relation (T) matrix. More...
 
TSparseSpace::VectorType & GetConstraintConstantVector () override
 This method returns constraint constant vector. More...
 
double GetScaleFactor ()
 Retrieves the current scale factor. This function returns the current scale factor value. More...
 
void SetScaleFactor (const double ScaleFactor)
 Sets the scale factor. This function sets a new value for the scale factor. More...
 
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::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >
 BuilderAndSolver ()
 Default constructor. More...
 
 BuilderAndSolver (typename TLinearSolver::Pointer pNewLinearSystemSolver, Parameters ThisParameters)
 Default constructor with Parameters. More...
 
 BuilderAndSolver (typename TLinearSolver::Pointer pNewLinearSystemSolver)
 Default constructor. More...
 
virtual ~BuilderAndSolver ()
 
virtual ClassType::Pointer Create (typename TLinearSolver::Pointer pNewLinearSystemSolver, Parameters ThisParameters) const
 Create method. More...
 
void SetEchoLevel (int Level)
 It sets the level of echo for the solving strategy. More...
 
int GetEchoLevel () const
 It returns the echo level. More...
 
 KRATOS_CLASS_POINTER_DEFINITION (BuilderAndSolver)
 Pointer definition of BuilderAndSolver. More...
 
bool GetCalculateReactionsFlag () const
 This method returns the flag mCalculateReactionsFlag. More...
 
void SetCalculateReactionsFlag (bool flag)
 This method sets the flag mCalculateReactionsFlag. More...
 
bool GetDofSetIsInitializedFlag () const
 This method returns the flag mDofSetIsInitialized. More...
 
void SetDofSetIsInitializedFlag (bool DofSetIsInitialized)
 This method sets the flag mDofSetIsInitialized. More...
 
bool GetReshapeMatrixFlag () const
 This method returns the flag mReshapeMatrixFlag. More...
 
void SetReshapeMatrixFlag (bool ReshapeMatrixFlag)
 This method sets the flag mReshapeMatrixFlag. More...
 
unsigned int GetEquationSystemSize () const
 This method returns the value mEquationSystemSize. More...
 
TLinearSolver::Pointer GetLinearSystemSolver () const
 This method return the linear solver used. More...
 
void SetLinearSystemSolver (typename TLinearSolver::Pointer pLinearSystemSolver)
 This method sets the linear solver to be used. More...
 
virtual void BuildLHS_Complete (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA)
 It builds a matrix of size N*N where "N" is the total number of degrees of freedom involved. More...
 
virtual void BuildAndSolveLinearizedOnPreviousIteration (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb, const bool MoveMesh)
 Function to perform the building and solving phase at the same time Linearizing with the database at the old iteration. More...
 
virtual void ApplyDirichletConditions_LHS (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx)
 The same of the precedent but affecting only the LHS. More...
 
virtual void ApplyDirichletConditions_RHS (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemVectorType &rDx, TSystemVectorType &rb)
 The same of the precedent but affecting only the RHS. More...
 
virtual DofsArrayTypeGetDofSet ()
 It allows to get the list of Dofs from the element. More...
 
virtual const DofsArrayTypeGetDofSet () const
 It allows to get the list of Dofs from the element. More...
 
virtual void InitializeSolutionStep (ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb)
 It applies certain operations at the system of equations at the beginning of the solution step. More...
 
virtual void FinalizeSolutionStep (ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb)
 It applies certain operations at the system of equations at the end of the solution step. More...
 

Protected Member Functions

Protected Operations
virtual void ConstructMasterSlaveConstraintsStructure (ModelPart &rModelPart)
 Constructs the master-slave constraints structure for the given model part. More...
 
virtual void BuildMasterSlaveConstraints (ModelPart &rModelPart)
 Builds the master-slave constraints for the given model part. More...
 
virtual void ConstructMatrixStructure (typename TSchemeType::Pointer pScheme, TSystemMatrixPointerType &rpA, TSystemVectorPointerType &rpDx, TSystemVectorPointerType &rpb, ModelPart &rModelPart)
 Constructs the matrix structure for the given problem. More...
 
void AssignSettings (const Parameters ThisParameters) override
 This method assigns settings to member variables. More...
 
- Protected Member Functions inherited from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >
virtual Parameters ValidateAndAssignParameters (Parameters ThisParameters, const Parameters DefaultParameters) const
 This method validate and assign default parameters. More...
 

Protected Attributes

Protected member Variables
EpetraCommunicatorTypemrComm
 
int mGuessRowSize
 The MPI communicator. More...
 
IndexType mLocalSystemSize
 The guess row size. More...
 
int mFirstMyId
 The local system size. More...
 
int mLastMyId
 Auxiliary Id (the first row of the local system) More...
 
Kratos::shared_ptr< Epetra_Map > mpMap = nullptr
 Auxiliary Id (the last row of the local system) // TODO: This can be removed as can be deduced from mLocalSystemSize. More...
 
std::vector< intmFirstMyIds
 The map considered for the different vectors and matrices. More...
 
TSystemMatrixPointerType mpT = nullptr
 The ids corresponding to each partition (only used with MPC) More...
 
TSystemVectorPointerType mpConstantVector = nullptr
 This is matrix containing the global relation for the constraints. More...
 
std::vector< IndexTypemSlaveIds
 This is vector containing the rigid movement of the constraint. More...
 
std::vector< IndexTypemMasterIds
 The equation ids of the slaves. More...
 
std::unordered_set< IndexTypemInactiveSlaveDofs
 The equation ids of the master. More...
 
double mScaleFactor = 1.0
 The set containing the inactive slave dofs. More...
 
SCALING_DIAGONAL mScalingDiagonal = SCALING_DIAGONAL::CONSIDER_MAX_DIAGONAL
 The manually set scale factor. More...
 
Flags mOptions
 We identify the scaling considered for the dirichlet dofs. More...
 
- Protected Attributes inherited from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >
TLinearSolver::Pointer mpLinearSystemSolver = nullptr
 
DofsArrayType mDofSet
 Pointer to the linear solver. More...
 
bool mReshapeMatrixFlag = false
 The set containing the DoF of the system. More...
 
bool mDofSetIsInitialized = false
 If the matrix is reshaped each step. More...
 
bool mCalculateReactionsFlag = false
 Flag taking care if the dof set was initialized ot not. More...
 
unsigned int mEquationSystemSize
 Flag taking in account if it is needed or not to calculate the reactions. More...
 
int mEchoLevel = 0
 Number of degrees of freedom of the problem to be solve. More...
 
TSystemVectorPointerType mpReactionsVector
 

Type Definitions

using BaseType = BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >
 Definition of the base class. More...
 
using SizeType = std::size_t
 The size_t types. More...
 
using IndexType = std::size_t
 
using TSchemeType = typename BaseType::TSchemeType
 Definition of the classes from the base class. More...
 
using DofsArrayType = typename BaseType::DofsArrayType
 
using EpetraCommunicatorType = Epetra_MpiComm
 Epetra definitions. More...
 
using NodeType = Node
 DoF types definition. More...
 
using TSystemMatrixType = typename BaseType::TSystemMatrixType
 Defining the sparse matrices and vectors. More...
 
using TSystemVectorType = typename BaseType::TSystemVectorType
 
using LocalSystemMatrixType = typename BaseType::LocalSystemMatrixType
 Defining the local matrices and vectors. More...
 
using LocalSystemVectorType = typename BaseType::LocalSystemVectorType
 
using TSystemMatrixPointerType = typename BaseType::TSystemMatrixPointerType
 Definition of the pointer types. More...
 
using TSystemVectorPointerType = typename BaseType::TSystemVectorPointerType
 
 KRATOS_DEFINE_LOCAL_FLAG (SILENT_WARNINGS)
 Definition of the flags. More...
 
 KRATOS_CLASS_POINTER_DEFINITION (TrilinosBlockBuilderAndSolver)
 Definition of the pointer. More...
 

Operations

void Build (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rb) override
 Function to perform the build the system matrix and the residual vector. More...
 
void BuildLHS (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA) override
 Function to perform the building of the LHS. More...
 
void BuildLHS_CompleteOnFreeRows (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &A) override
 Build a rectangular matrix of size n*N where "n" is the number of unrestrained degrees of freedom and "N" is the total number of degrees of freedom involved. More...
 
void SystemSolve (TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
 This is a call to the linear system solver. More...
 
void SystemSolveWithPhysics (TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb, ModelPart &rModelPart)
 This is a call to the linear system solver (taking into account some physical particularities of the problem) More...
 
void InternalSystemSolveWithPhysics (TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb, ModelPart &rModelPart)
 This is a call to the linear system solver (taking into account some physical particularities of the problem) More...
 
void BuildAndSolve (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
 Function to perform the building and solving phase at the same time. More...
 
void BuildRHSAndSolve (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
 Corresponds to the previous, but the System's matrix is considered already built and only the RHS is built again. More...
 
void BuildRHS (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemVectorType &rb) override
 Function to perform the build of the RHS. More...
 
void SetUpDofSet (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart) override
 Builds the list of the DofSets involved in the problem by "asking" to each element and condition its Dofs. More...
 
void SetUpSystem (ModelPart &rModelPart) override
 Organizes the DoF set in order to speed up the building phase Sets equation id for degrees of freedom. More...
 
void ResizeAndInitializeVectors (typename TSchemeType::Pointer pScheme, TSystemMatrixPointerType &rpA, TSystemVectorPointerType &rpDx, TSystemVectorPointerType &rpb, ModelPart &rModelPart) override
 Resizes the system matrix and the vector according to the number of dos in the current rModelPart. This function also decides on the sparsity pattern and the graph of the Trilinos csr matrix. More...
 
void CalculateReactions (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
 It computes the reactions of the system. More...
 
void ApplyDirichletConditions (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rDx, TSystemVectorType &rb) override
 Applies the dirichlet conditions. This operation may be very heavy or completely unexpensive depending on the implementation choosen and on how the System Matrix is built. More...
 
void ApplyRHSConstraints (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemVectorType &rb) override
 Applies the constraints with master-slave relation matrix (RHS only) More...
 
void ApplyConstraints (typename TSchemeType::Pointer pScheme, ModelPart &rModelPart, TSystemMatrixType &rA, TSystemVectorType &rb) override
 Applies the constraints with master-slave relation matrix. More...
 
void Clear () override
 This function is intended to be called at the end of the solution step to clean up memory storage not needed. More...
 
int Check (ModelPart &rModelPart) override
 This function is designed to be called once to perform all the checks needed on the input provided. Checks can be "expensive" as the function is designed to catch user's errors. More...
 
Parameters GetDefaultParameters () const override
 This method provides the defaults parameters to avoid conflicts between the different constructors. More...
 
static std::string Name ()
 Returns the name of the class as used in the settings (snake_case format) More...
 

Additional Inherited Members

- Public Types inherited from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >
typedef BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > ClassType
 The definition of the current class. More...
 
typedef std::size_t SizeType
 Definition of the size type. More...
 
typedef std::size_t IndexType
 Definition of the index type. More...
 
typedef TSparseSpace::DataType TDataType
 Definition of the data type. More...
 
typedef TSparseSpace::MatrixType TSystemMatrixType
 Definition of the sparse matrix. More...
 
typedef TSparseSpace::VectorType TSystemVectorType
 Definition of the vector size. More...
 
typedef TSparseSpace::MatrixPointerType TSystemMatrixPointerType
 Definition of the pointer to the sparse matrix. More...
 
typedef TSparseSpace::VectorPointerType TSystemVectorPointerType
 Definition of the pointer to the vector. More...
 
typedef TDenseSpace::MatrixType LocalSystemMatrixType
 The local matrix definition. More...
 
typedef TDenseSpace::VectorType LocalSystemVectorType
 The local vector definition. More...
 
typedef Scheme< TSparseSpace, TDenseSpace > TSchemeType
 Definition of the scheme type. More...
 
typedef ModelPart::DofType TDofType
 Definition of the DoF class. More...
 
typedef ModelPart::DofsArrayType DofsArrayType
 Definition of the DoF array type. More...
 
typedef ModelPart::NodesContainerType NodesArrayType
 The containers of the entities. More...
 
typedef ModelPart::ElementsContainerType ElementsArrayType
 
typedef ModelPart::ConditionsContainerType ConditionsArrayType
 
typedef PointerVectorSet< Element, IndexedObjectElementsContainerType
 The definition of the element container type. More...
 
- Static Public Member Functions inherited from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >
static std::string Name ()
 Returns the name of the class as used in the settings (snake_case format) More...
 

Detailed Description

template<class TSparseSpace, class TDenseSpace, class TLinearSolver>
class Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >

Current class provides an implementation for trilinos builder and solving operations.

The RHS is constituted by the unbalanced loads (residual) Degrees of freedom are reordered putting the restrained degrees of freedom at the end of the system ordered in reverse order with respect to the DofSet. Imposition of the dirichlet conditions is naturally dealt with as the residual already contains this information. Calculation of the reactions involves a cost very similar to the calculation of the total residual

Author
Riccardo Rossi
Vicente Mataix Ferrandiz (MPC)
Note
Should be TrilinosResidualBasedBlockBuilderAndSolver?

Member Typedef Documentation

◆ BaseType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::BaseType = BuilderAndSolver<TSparseSpace, TDenseSpace, TLinearSolver>

Definition of the base class.

◆ DofsArrayType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::DofsArrayType = typename BaseType::DofsArrayType

◆ EpetraCommunicatorType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::EpetraCommunicatorType = Epetra_MpiComm

Epetra definitions.

◆ IndexType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::IndexType = std::size_t

◆ LocalSystemMatrixType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::LocalSystemMatrixType = typename BaseType::LocalSystemMatrixType

Defining the local matrices and vectors.

◆ LocalSystemVectorType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::LocalSystemVectorType = typename BaseType::LocalSystemVectorType

◆ NodeType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::NodeType = Node

DoF types definition.

◆ SizeType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::SizeType = std::size_t

The size_t types.

◆ TSchemeType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::TSchemeType = typename BaseType::TSchemeType

Definition of the classes from the base class.

◆ TSystemMatrixPointerType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::TSystemMatrixPointerType = typename BaseType::TSystemMatrixPointerType

Definition of the pointer types.

◆ TSystemMatrixType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::TSystemMatrixType = typename BaseType::TSystemMatrixType

Defining the sparse matrices and vectors.

◆ TSystemVectorPointerType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::TSystemVectorPointerType = typename BaseType::TSystemVectorPointerType

◆ TSystemVectorType

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
using Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::TSystemVectorType = typename BaseType::TSystemVectorType

Constructor & Destructor Documentation

◆ TrilinosBlockBuilderAndSolver() [1/4]

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::TrilinosBlockBuilderAndSolver ( )
explicitdefault

Default constructor (empty)

◆ TrilinosBlockBuilderAndSolver() [2/4]

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::TrilinosBlockBuilderAndSolver ( EpetraCommunicatorType rComm,
int  GuessRowSize,
typename TLinearSolver::Pointer  pNewLinearSystemSolver 
)
inlineexplicit

Default constructor.

◆ TrilinosBlockBuilderAndSolver() [3/4]

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::TrilinosBlockBuilderAndSolver ( EpetraCommunicatorType rComm,
typename TLinearSolver::Pointer  pNewLinearSystemSolver,
Parameters  ThisParameters 
)
inlineexplicit

Default constructor. (with parameters)

◆ TrilinosBlockBuilderAndSolver() [4/4]

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::TrilinosBlockBuilderAndSolver ( const TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > &  rOther)
delete

Copy constructor

Member Function Documentation

◆ ApplyConstraints()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::ApplyConstraints ( typename TSchemeType::Pointer  pScheme,
ModelPart rModelPart,
TSystemMatrixType rA,
TSystemVectorType rb 
)
inlineoverridevirtual

Applies the constraints with master-slave relation matrix.

Parameters
pSchemeThe integration scheme considered
rModelPartThe model part of the problem to solve
rAThe LHS matrix
rbThe RHS vector

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ ApplyDirichletConditions()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::ApplyDirichletConditions ( typename TSchemeType::Pointer  pScheme,
ModelPart rModelPart,
TSystemMatrixType rA,
TSystemVectorType rDx,
TSystemVectorType rb 
)
inlineoverridevirtual

Applies the dirichlet conditions. This operation may be very heavy or completely unexpensive depending on the implementation choosen and on how the System Matrix is built.

For explanation of how it works for a particular implementation the user should refer to the particular Builder And Solver choosen

Parameters
pSchemeThe integration scheme considered
rModelPartThe model part of the problem to solve
AThe LHS matrix
DxThe Unknowns vector
bThe RHS vector

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ ApplyRHSConstraints()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::ApplyRHSConstraints ( typename TSchemeType::Pointer  pScheme,
ModelPart rModelPart,
TSystemVectorType rb 
)
inlineoverridevirtual

Applies the constraints with master-slave relation matrix (RHS only)

Parameters
pSchemeThe integration scheme considered
rModelPartThe model part of the problem to solve
rbThe RHS vector

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ AssignSettings()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::AssignSettings ( const Parameters  ThisParameters)
inlineoverrideprotectedvirtual

This method assigns settings to member variables.

Parameters
ThisParametersParameters that are assigned to the member variables

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ Build()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::Build ( typename TSchemeType::Pointer  pScheme,
ModelPart rModelPart,
TSystemMatrixType rA,
TSystemVectorType rb 
)
inlineoverridevirtual

Function to perform the build the system matrix and the residual vector.

Parameters
pSchemeThe integration scheme considered
rModelPartThe model part of the problem to solve
rAThe LHS matrix
rbThe RHS vector

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ BuildAndSolve()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::BuildAndSolve ( typename TSchemeType::Pointer  pScheme,
ModelPart rModelPart,
TSystemMatrixType rA,
TSystemVectorType rDx,
TSystemVectorType rb 
)
inlineoverridevirtual

Function to perform the building and solving phase at the same time.

It is ideally the fastest and safer function to use when it is possible to solve just after building

Parameters
pSchemeThe integration scheme considered
rModelPartThe model part of the problem to solve
rAThe LHS matrix
rDxThe Unknowns vector
rbThe RHS vector

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ BuildLHS()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::BuildLHS ( typename TSchemeType::Pointer  pScheme,
ModelPart rModelPart,
TSystemMatrixType rA 
)
inlineoverridevirtual

Function to perform the building of the LHS.

Depending on the implementation choosen the size of the matrix could be equal to the total number of Dofs or to the number of unrestrained dofs

Parameters
pSchemeThe integration scheme considered
rModelPartThe model part of the problem to solve
rAThe LHS matrix

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ BuildLHS_CompleteOnFreeRows()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::BuildLHS_CompleteOnFreeRows ( typename TSchemeType::Pointer  pScheme,
ModelPart rModelPart,
TSystemMatrixType A 
)
inlineoverridevirtual

Build a rectangular matrix of size n*N where "n" is the number of unrestrained degrees of freedom and "N" is the total number of degrees of freedom involved.

This matrix is obtained by building the total matrix without the lines corresponding to the fixed degrees of freedom (but keeping the columns!!)

Parameters
pSchemeThe integration scheme considered
rModelPartThe model part of the problem to solve
AThe LHS matrix

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ BuildMasterSlaveConstraints()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
virtual void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::BuildMasterSlaveConstraints ( ModelPart rModelPart)
inlineprotectedvirtual

Builds the master-slave constraints for the given model part.

Parameters
rModelPartthe model part to build the constraints for

◆ BuildRHS()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::BuildRHS ( typename TSchemeType::Pointer  pScheme,
ModelPart rModelPart,
TSystemVectorType rb 
)
inlineoverridevirtual

Function to perform the build of the RHS.

The vector could be sized as the total number of dofs or as the number of unrestrained ones

Parameters
pSchemeThe integration scheme considered
rModelPartThe model part of the problem to solve

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ BuildRHSAndSolve()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::BuildRHSAndSolve ( typename TSchemeType::Pointer  pScheme,
ModelPart rModelPart,
TSystemMatrixType rA,
TSystemVectorType rDx,
TSystemVectorType rb 
)
inlineoverridevirtual

Corresponds to the previous, but the System's matrix is considered already built and only the RHS is built again.

Parameters
pSchemeThe integration scheme considered
rModelPartThe model part of the problem to solve
rAThe LHS matrix
rDxThe Unknowns vector
rbThe RHS vector

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ CalculateReactions()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::CalculateReactions ( typename TSchemeType::Pointer  pScheme,
ModelPart rModelPart,
TSystemMatrixType rA,
TSystemVectorType rDx,
TSystemVectorType rb 
)
inlineoverridevirtual

It computes the reactions of the system.

Parameters
pSchemeThe pointer to the integration scheme
rModelPartThe model part to compute
rAThe LHS matrix of the system of equations
rDxThe vector of unknowns
rbThe RHS vector of the system of equations

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ Check()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
int Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::Check ( ModelPart rModelPart)
inlineoverridevirtual

This function is designed to be called once to perform all the checks needed on the input provided. Checks can be "expensive" as the function is designed to catch user's errors.

Parameters
rModelPartThe model part of the problem to solve
Returns
0 all ok

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ Clear()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::Clear ( )
inlineoverridevirtual

This function is intended to be called at the end of the solution step to clean up memory storage not needed.

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ ConstructMasterSlaveConstraintsStructure()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
virtual void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::ConstructMasterSlaveConstraintsStructure ( ModelPart rModelPart)
inlineprotectedvirtual

Constructs the master-slave constraints structure for the given model part.

Parameters
rModelPartthe model part
Exceptions
ErrorTypedescribes an Epetra failure in Graph.InsertGlobalIndices

◆ ConstructMatrixStructure()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
virtual void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::ConstructMatrixStructure ( typename TSchemeType::Pointer  pScheme,
TSystemMatrixPointerType rpA,
TSystemVectorPointerType rpDx,
TSystemVectorPointerType rpb,
ModelPart rModelPart 
)
inlineprotectedvirtual

Constructs the matrix structure for the given problem.

Parameters
pSchemepointer to the scheme object
rpAreference to the system matrix pointer
rpDxreference to the system vector pointer for the solution vector
rpbreference to the system vector pointer for the right-hand side vector
rModelPartreference to the model part object
Exceptions
Runtimeerror if there is an error in constructing the matrix structure

◆ GetConstraintConstantVector()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
TSparseSpace::VectorType& Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::GetConstraintConstantVector ( )
inlineoverridevirtual

This method returns constraint constant vector.

Returns
The constraint constant vector

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ GetConstraintRelationMatrix()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
TSparseSpace::MatrixType& Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::GetConstraintRelationMatrix ( )
inlineoverridevirtual

This method returns constraint relation (T) matrix.

Returns
The constraint relation (T) matrix

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ GetDefaultParameters()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
Parameters Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::GetDefaultParameters ( ) const
inlineoverridevirtual

This method provides the defaults parameters to avoid conflicts between the different constructors.

Returns
The default parameters

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ GetScaleFactor()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
double Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::GetScaleFactor ( )
inline

Retrieves the current scale factor. This function returns the current scale factor value.

Returns
Returns the current scale factor.

◆ Info()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
std::string Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::Info ( ) const
inlineoverridevirtual

Turn back information as a string.

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ InternalSystemSolveWithPhysics()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::InternalSystemSolveWithPhysics ( TSystemMatrixType rA,
TSystemVectorType rDx,
TSystemVectorType rb,
ModelPart rModelPart 
)
inline

This is a call to the linear system solver (taking into account some physical particularities of the problem)

Parameters
rAThe LHS matrix
rDxThe Unknowns vector
rbThe RHS vector
rModelPartThe model part of the problem to solve

◆ KRATOS_CLASS_POINTER_DEFINITION()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::KRATOS_CLASS_POINTER_DEFINITION ( TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >  )

Definition of the pointer.

◆ KRATOS_DEFINE_LOCAL_FLAG()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::KRATOS_DEFINE_LOCAL_FLAG ( SILENT_WARNINGS  )

Definition of the flags.

◆ Name()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
static std::string Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::Name ( )
inlinestatic

Returns the name of the class as used in the settings (snake_case format)

Returns
The name of the class

◆ operator=()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
TrilinosBlockBuilderAndSolver& Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::operator= ( const TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver > &  rOther)
delete

Assignment operator

◆ PrintData()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::PrintData ( std::ostream &  rOStream) const
inlineoverridevirtual

◆ PrintInfo()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::PrintInfo ( std::ostream &  rOStream) const
inlineoverridevirtual

Print information about this object.

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ ResizeAndInitializeVectors()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::ResizeAndInitializeVectors ( typename TSchemeType::Pointer  pScheme,
TSystemMatrixPointerType rpA,
TSystemVectorPointerType rpDx,
TSystemVectorPointerType rpb,
ModelPart rModelPart 
)
inlineoverridevirtual

Resizes the system matrix and the vector according to the number of dos in the current rModelPart. This function also decides on the sparsity pattern and the graph of the Trilinos csr matrix.

Parameters
pSchemeThe integration scheme considered
rpAThe LHS matrix
rpDxThe Unknowns vector
rpdThe RHS vector
rModelPartThe model part of the problem to solve

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ SetScaleFactor()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::SetScaleFactor ( const double  ScaleFactor)
inline

Sets the scale factor. This function sets a new value for the scale factor.

Parameters
ScaleFactorThe new value for the scale factor.

◆ SetUpDofSet()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::SetUpDofSet ( typename TSchemeType::Pointer  pScheme,
ModelPart rModelPart 
)
inlineoverridevirtual

Builds the list of the DofSets involved in the problem by "asking" to each element and condition its Dofs.

The list of dofs is stores inside the BuilderAndSolver as it is closely connected to the way the matrix and RHS are built

Parameters
pSchemeThe integration scheme considered
rModelPartThe model part of the problem to solve

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ SetUpSystem()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::SetUpSystem ( ModelPart rModelPart)
inlineoverridevirtual

Organizes the DoF set in order to speed up the building phase Sets equation id for degrees of freedom.

Parameters
rModelPartThe model part of the problem to solve

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

Reimplemented in Kratos::TrilinosBlockBuilderAndSolverPeriodic< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ SystemSolve()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::SystemSolve ( TSystemMatrixType rA,
TSystemVectorType rDx,
TSystemVectorType rb 
)
inlineoverridevirtual

This is a call to the linear system solver.

Parameters
rAThe LHS matrix
rDxThe Unknowns vector
rbThe RHS vector

Reimplemented from Kratos::BuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >.

◆ SystemSolveWithPhysics()

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
void Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::SystemSolveWithPhysics ( TSystemMatrixType rA,
TSystemVectorType rDx,
TSystemVectorType rb,
ModelPart rModelPart 
)
inline

This is a call to the linear system solver (taking into account some physical particularities of the problem)

Parameters
rAThe LHS matrix
rDxThe Unknowns vector
rbThe RHS vector
rModelPartThe model part of the problem to solve

Member Data Documentation

◆ mFirstMyId

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
int Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mFirstMyId
protected

The local system size.

◆ mFirstMyIds

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
std::vector<int> Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mFirstMyIds
protected

The map considered for the different vectors and matrices.

◆ mGuessRowSize

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
int Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mGuessRowSize
protected

The MPI communicator.

◆ mInactiveSlaveDofs

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
std::unordered_set<IndexType> Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mInactiveSlaveDofs
protected

The equation ids of the master.

◆ mLastMyId

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
int Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mLastMyId
protected

Auxiliary Id (the first row of the local system)

◆ mLocalSystemSize

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
IndexType Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mLocalSystemSize
protected

The guess row size.

◆ mMasterIds

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
std::vector<IndexType> Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mMasterIds
protected

The equation ids of the slaves.

◆ mOptions

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
Flags Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mOptions
protected

We identify the scaling considered for the dirichlet dofs.

◆ mpConstantVector

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
TSystemVectorPointerType Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mpConstantVector = nullptr
protected

This is matrix containing the global relation for the constraints.

◆ mpMap

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
Kratos::shared_ptr<Epetra_Map> Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mpMap = nullptr
protected

Auxiliary Id (the last row of the local system) // TODO: This can be removed as can be deduced from mLocalSystemSize.

◆ mpT

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
TSystemMatrixPointerType Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mpT = nullptr
protected

The ids corresponding to each partition (only used with MPC)

◆ mrComm

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
EpetraCommunicatorType& Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mrComm
protected

◆ mScaleFactor

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
double Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mScaleFactor = 1.0
protected

The set containing the inactive slave dofs.

◆ mScalingDiagonal

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
SCALING_DIAGONAL Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mScalingDiagonal = SCALING_DIAGONAL::CONSIDER_MAX_DIAGONAL
protected

The manually set scale factor.

◆ mSlaveIds

template<class TSparseSpace , class TDenseSpace , class TLinearSolver >
std::vector<IndexType> Kratos::TrilinosBlockBuilderAndSolver< TSparseSpace, TDenseSpace, TLinearSolver >::mSlaveIds
protected

This is vector containing the rigid movement of the constraint.


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