#include <LinearSystem.hpp>
Public Member Functions | |
LinearSystem (PetscInt lhsVectorSize, MatType matType=(MatType) MATMPIAIJ) | |
LinearSystem (Vec templateVector) | |
LinearSystem (Vec residualVector, Mat jacobianMatrix) | |
LinearSystem (PetscInt lhsVectorSize, Mat lhsMatrix, Vec rhsVector, MatType matType=(MatType) MATMPIAIJ) | |
~LinearSystem () | |
void | SetupVectorAndMatrix (MatType matType) |
void | SetMatrixElement (PetscInt row, PetscInt col, double value) |
void | AddToMatrixElement (PetscInt row, PetscInt col, double value) |
void | AssembleFinalLinearSystem () |
void | AssembleIntermediateLinearSystem () |
void | AssembleFinalLhsMatrix () |
void | AssembleIntermediateLhsMatrix () |
void | AssembleRhsVector () |
void | SetMatrixIsSymmetric (bool isSymmetric=true) |
void | SetMatrixIsConstant (bool matrixIsConstant) |
void | SetRelativeTolerance (double relativeTolerance) |
void | SetAbsoluteTolerance (double absoluteTolerance) |
void | SetKspType (const char *kspType) |
void | SetPcType (const char *pcType) |
void | DisplayMatrix () |
void | DisplayRhs () |
void | SetMatrixRow (PetscInt row, double value) |
void | ZeroMatrixRow (PetscInt row) |
void | ZeroMatrixColumn (PetscInt col) |
void | ZeroLhsMatrix () |
void | ZeroRhsVector () |
void | ZeroLinearSystem () |
Vec | Solve (Vec lhsGuess=NULL) |
void | SetRhsVectorElement (PetscInt row, double value) |
void | AddToRhsVectorElement (PetscInt row, double value) |
unsigned | GetSize () const |
void | SetNullBasis (Vec nullbasis[], unsigned numberOfBases) |
Vec & | rGetRhsVector () |
Vec | GetRhsVector () const |
Mat & | rGetLhsMatrix () |
Mat | GetLhsMatrix () const |
Vec & | rGetDirichletBoundaryConditionsVector () |
void | GetOwnershipRange (PetscInt &lo, PetscInt &hi) |
double | GetMatrixElement (PetscInt row, PetscInt col) |
double | GetRhsVectorElement (PetscInt row) |
unsigned | GetNumIterations () const |
template<size_t MATRIX_SIZE> | |
void | AddLhsMultipleValues (unsigned *matrixRowAndColIndices, c_matrix< double, MATRIX_SIZE, MATRIX_SIZE > &rSmallMatrix) |
template<size_t VECTOR_SIZE> | |
void | AddRhsMultipleValues (unsigned *vectorIndices, c_vector< double, VECTOR_SIZE > &smallVector) |
Private Member Functions | |
template<class Archive> | |
void | serialize (Archive &archive, const unsigned int version) |
Private Attributes | |
Mat | mLhsMatrix |
Vec | mRhsVector |
PetscInt | mSize |
PetscInt | mOwnershipRangeLo |
PetscInt | mOwnershipRangeHi |
MatNullSpace | mMatNullSpace |
bool | mDestroyMatAndVec |
KSP | mKspSolver |
bool | mKspIsSetup |
double | mNonZerosUsed |
bool | mMatrixIsConstant |
double | mTolerance |
bool | mUseAbsoluteTolerance |
std::string | mKspType |
std::string | mPcType |
Vec | mDirichletBoundaryConditionsVector |
PCBlockDiagonal * | mpBlockDiagonalPC |
Friends | |
class | TestLinearSystem |
class | TestPCBlockDiagonal |
class | boost::serialization::access |
Definition at line 57 of file LinearSystem.hpp.
LinearSystem::LinearSystem | ( | PetscInt | lhsVectorSize, | |
MatType | matType = (MatType) MATMPIAIJ | |||
) |
Constructor.
lhsVectorSize | the size of the LHS vector | |
matType | the type of matrix (defaults to MATMPIAIJ) |
Definition at line 42 of file LinearSystem.cpp.
References mKspType, mPcType, and SetupVectorAndMatrix().
LinearSystem::LinearSystem | ( | Vec | templateVector | ) |
Alternative constructor.
Create a linear system, where the size is based on the size of a given PETSc vec.
The LHS & RHS vectors will be created by duplicating this vector's settings. This should avoid problems with using VecScatter on bidomain simulation results.
templateVector | a PETSc vec |
Definition at line 93 of file LinearSystem.cpp.
References mKspType, mLhsMatrix, mOwnershipRangeHi, mOwnershipRangeLo, mPcType, mRhsVector, mSize, and PetscTools::SetupMat().
LinearSystem::LinearSystem | ( | Vec | residualVector, | |
Mat | jacobianMatrix | |||
) |
Alternative constructor.
Create a linear system which wraps the provided PETSc objects so we can access them using our API. Either of the objects may be NULL, but at least one of them must not be.
Useful for storing residuals and jacobians when solving nonlinear PDEs.
residualVector | the residual vector | |
jacobianMatrix | the Jacobian matrix |
Definition at line 122 of file LinearSystem.cpp.
References mKspType, mLhsMatrix, mOwnershipRangeHi, mOwnershipRangeLo, mPcType, mRhsVector, and mSize.
LinearSystem::LinearSystem | ( | PetscInt | lhsVectorSize, | |
Mat | lhsMatrix, | |||
Vec | rhsVector, | |||
MatType | matType = (MatType) MATMPIAIJ | |||
) |
Alternative constructor for archiving.
lhsVectorSize | the size of the LHS vector | |
lhsMatrix | the RHS matrix | |
rhsVector | the RHS vector | |
matType | the type of matrix (defaults to MATMPIAIJ) |
Definition at line 68 of file LinearSystem.cpp.
References mLhsMatrix, mOwnershipRangeHi, mOwnershipRangeLo, and mRhsVector.
LinearSystem::~LinearSystem | ( | ) |
Destructor.
Definition at line 165 of file LinearSystem.cpp.
References mDestroyMatAndVec, mDirichletBoundaryConditionsVector, mKspIsSetup, mKspSolver, mLhsMatrix, mMatNullSpace, mpBlockDiagonalPC, and mRhsVector.
void LinearSystem::serialize | ( | Archive & | archive, | |
const unsigned int | version | |||
) | [inline, private] |
Archive the member variables.
archive | ||
version |
Definition at line 112 of file LinearSystem.hpp.
References mKspType, mMatrixIsConstant, mNonZerosUsed, mPcType, mTolerance, and mUseAbsoluteTolerance.
void LinearSystem::SetupVectorAndMatrix | ( | MatType | matType | ) |
Helper method for the constructor. Initializes the LHS matrix and RHS vector.
matType | the type of matrix |
Definition at line 207 of file LinearSystem.cpp.
References mLhsMatrix, mOwnershipRangeHi, mOwnershipRangeLo, mRhsVector, mSize, and PetscTools::SetupMat().
Referenced by LinearSystem().
void LinearSystem::SetMatrixElement | ( | PetscInt | row, | |
PetscInt | col, | |||
double | value | |||
) |
Change one of the entires of the matrix to the specified value.
row | the row index | |
col | the column index | |
value | the value for this entry |
Definition at line 218 of file LinearSystem.cpp.
References mLhsMatrix, mOwnershipRangeHi, and mOwnershipRangeLo.
Referenced by AbstractNonlinearElasticityAssembler< DIM >::ApplyBoundaryConditions(), BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem(), BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem(), and SetMatrixRow().
void LinearSystem::AddToMatrixElement | ( | PetscInt | row, | |
PetscInt | col, | |||
double | value | |||
) |
Add the specified value to an entry of the matrix.
row | the row index | |
col | the column index | |
value | the value for this entry |
Definition at line 226 of file LinearSystem.cpp.
References mLhsMatrix, mOwnershipRangeHi, and mOwnershipRangeLo.
void LinearSystem::AssembleFinalLinearSystem | ( | ) |
Call this before Solve().
This calls AssembleFinalLhsMatrix() and AssembleRhsVector().
Definition at line 234 of file LinearSystem.cpp.
References AssembleFinalLhsMatrix(), and AssembleRhsVector().
Referenced by BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem().
void LinearSystem::AssembleIntermediateLinearSystem | ( | ) |
Should be called before AddToMatrixElement.
This calls AssembleIntermediateLhsMatrix() and AssembleRhsVector().
Definition at line 240 of file LinearSystem.cpp.
References AssembleIntermediateLhsMatrix(), and AssembleRhsVector().
void LinearSystem::AssembleFinalLhsMatrix | ( | ) |
Sets up the PETSc matrix left-hand-side mLhsMatrix
Definition at line 246 of file LinearSystem.cpp.
References mLhsMatrix.
Referenced by AssembleFinalLinearSystem(), NonlinearElasticityAssembler< DIM >::AssembleSystem(), AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::AssembleSystem(), and BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem().
void LinearSystem::AssembleIntermediateLhsMatrix | ( | ) |
Sets up the PETSc matrix left-hand-side mLhsMatrix
Definition at line 252 of file LinearSystem.cpp.
References mLhsMatrix.
Referenced by AssembleIntermediateLinearSystem(), NonlinearElasticityAssembler< DIM >::AssembleSystem(), and AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::AssembleSystem().
void LinearSystem::AssembleRhsVector | ( | ) |
Sets up the PETSc vector right-hand-side mRhsVector
Definition at line 258 of file LinearSystem.cpp.
References mRhsVector.
Referenced by AssembleFinalLinearSystem(), AssembleIntermediateLinearSystem(), NonlinearElasticityAssembler< DIM >::AssembleSystem(), AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::AssembleSystem(), and BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem().
void LinearSystem::SetMatrixIsSymmetric | ( | bool | isSymmetric = true |
) |
Force PETSc to treat the matrix in this linear system as symmetric from now on.
isSymmetric | whether the matrix is symmetric or not (defaults to true) |
Definition at line 465 of file LinearSystem.cpp.
References mLhsMatrix.
Referenced by MonodomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve(), and BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve().
void LinearSystem::SetMatrixIsConstant | ( | bool | matrixIsConstant | ) |
Set mMatrixIsConstant.
matrixIsConstant | whether the matrix is constant |
Definition at line 480 of file LinearSystem.cpp.
References mMatrixIsConstant.
Referenced by AbstractLinearAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::InitialiseForSolve().
void LinearSystem::SetRelativeTolerance | ( | double | relativeTolerance | ) |
Set the relative tolerance.
relativeTolerance | the relative tolerance |
Definition at line 485 of file LinearSystem.cpp.
References mKspIsSetup, mKspSolver, mTolerance, and mUseAbsoluteTolerance.
Referenced by MonodomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve(), and BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve().
void LinearSystem::SetAbsoluteTolerance | ( | double | absoluteTolerance | ) |
Set the absolute tolerance.
absoluteTolerance | the absolute tolerance |
Definition at line 495 of file LinearSystem.cpp.
References mKspIsSetup, mKspSolver, mTolerance, and mUseAbsoluteTolerance.
Referenced by MonodomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve(), and BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve().
void LinearSystem::SetKspType | ( | const char * | kspType | ) |
Set the KSP solver type (see PETSc KSPSetType() for valid arguments).
kspType | the KSP solver type |
Definition at line 505 of file LinearSystem.cpp.
References mKspIsSetup, mKspSolver, and mKspType.
Referenced by BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem(), BidomainWithBathAssembler< ELEMENT_DIM, SPACE_DIM >::FinaliseLinearSystem(), MonodomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve(), and BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve().
void LinearSystem::SetPcType | ( | const char * | pcType | ) |
Set the preconditioner type (see PETSc PCSetType() for valid arguments).
pcType | the preconditioner type |
Definition at line 515 of file LinearSystem.cpp.
References mKspIsSetup, mKspSolver, mpBlockDiagonalPC, and mPcType.
Referenced by MonodomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve(), and BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::InitialiseForSolve().
void LinearSystem::DisplayMatrix | ( | ) |
Display the left-hand side matrix.
Definition at line 280 of file LinearSystem.cpp.
References mLhsMatrix.
void LinearSystem::DisplayRhs | ( | ) |
Display the right-hand side vector.
Definition at line 285 of file LinearSystem.cpp.
References mRhsVector.
void LinearSystem::SetMatrixRow | ( | PetscInt | row, | |
double | value | |||
) |
Set all entries in a given row of a matrix to a certain value. This must be called by the process who owns the row, (but other processors will treat it as a null-op
row | the row index | |
value | the value to set each entry in this row |
Definition at line 290 of file LinearSystem.cpp.
References mLhsMatrix, mOwnershipRangeHi, mOwnershipRangeLo, and SetMatrixElement().
void LinearSystem::ZeroMatrixRow | ( | PetscInt | row | ) |
Zero a row of the left-hand side matrix. This method is a collective call (all processes should call it together). If processes call it with different arguments then its results may not be predictable.
row | the row index |
Definition at line 303 of file LinearSystem.cpp.
References mLhsMatrix.
Referenced by AbstractNonlinearElasticityAssembler< DIM >::ApplyBoundaryConditions(), BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem(), and BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem().
void LinearSystem::ZeroMatrixColumn | ( | PetscInt | col | ) |
Zero a column of the left-hand side matrix.
Unfortunately there is no equivalent method in Petsc, so this has to be done carefully to ensure that the sparsity structure of the matrix is not broken. Only owned entries which are non-zero are zeroed.
col | the column index |
Definition at line 323 of file LinearSystem.cpp.
References GetMatrixElement(), mLhsMatrix, mOwnershipRangeHi, and mOwnershipRangeLo.
Referenced by BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem().
void LinearSystem::ZeroLhsMatrix | ( | ) |
Zero all entries of the left-hand side matrix.
Definition at line 374 of file LinearSystem.cpp.
References mLhsMatrix.
Referenced by NonlinearElasticityAssembler< DIM >::AssembleSystem(), AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::AssembleSystem(), and ZeroLinearSystem().
void LinearSystem::ZeroRhsVector | ( | ) |
Zero all entries of the right-hand side vector.
Definition at line 363 of file LinearSystem.cpp.
References mOwnershipRangeHi, mOwnershipRangeLo, and mRhsVector.
Referenced by NonlinearElasticityAssembler< DIM >::AssembleSystem(), AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::AssembleSystem(), and ZeroLinearSystem().
void LinearSystem::ZeroLinearSystem | ( | ) |
Zero all entries of the left-hand side matrix and right-hand side vector.
Definition at line 379 of file LinearSystem.cpp.
References ZeroLhsMatrix(), and ZeroRhsVector().
Referenced by SimpleNewtonNonlinearSolver::Solve().
Vec LinearSystem::Solve | ( | Vec | lhsGuess = NULL |
) |
Solve the linear system.
lhsGuess | an optional initial guess for the solution (defaults to NULL) |
Definition at line 539 of file LinearSystem.cpp.
References GenericEventHandler< 11, HeartEventHandler >::BeginEvent(), GenericEventHandler< 11, HeartEventHandler >::EndEvent(), mKspIsSetup, mKspSolver, mKspType, mLhsMatrix, mMatNullSpace, mMatrixIsConstant, mNonZerosUsed, mpBlockDiagonalPC, mPcType, mRhsVector, mSize, mTolerance, and mUseAbsoluteTolerance.
Referenced by SimpleNewtonNonlinearSolver::Solve(), and AbstractLinearAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::StaticSolve().
void LinearSystem::SetRhsVectorElement | ( | PetscInt | row, | |
double | value | |||
) |
Set an element of the right-hand side vector to a given value.
row | the row index | |
value | the value to set this entry |
Definition at line 264 of file LinearSystem.cpp.
References mOwnershipRangeHi, mOwnershipRangeLo, and mRhsVector.
Referenced by AbstractNonlinearElasticityAssembler< DIM >::ApplyBoundaryConditions(), BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem(), and BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem().
void LinearSystem::AddToRhsVectorElement | ( | PetscInt | row, | |
double | value | |||
) |
Add a value to an element of the right-hand side vector.
row | the row index | |
value | the value to set this entry |
Definition at line 272 of file LinearSystem.cpp.
References mOwnershipRangeHi, mOwnershipRangeLo, and mRhsVector.
unsigned LinearSystem::GetSize | ( | ) | const |
Get method for mSize.
Definition at line 385 of file LinearSystem.cpp.
References mSize.
Referenced by AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::AssembleSystem(), and BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem().
void LinearSystem::SetNullBasis | ( | Vec | nullbasis[], | |
unsigned | numberOfBases | |||
) |
nullbasis | ||
numberOfBases |
Definition at line 390 of file LinearSystem.cpp.
References mMatNullSpace.
Referenced by BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::FinaliseAssembleSystem().
Vec & LinearSystem::rGetRhsVector | ( | ) |
Get access to the RHS vector directly. Shouldn't generally need to be called.
Definition at line 440 of file LinearSystem.cpp.
References mRhsVector.
Referenced by AbstractNonlinearAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CONCRETE >::ApplyDirichletConditions(), BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem(), AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::AssembleSystem(), AbstractNonlinearElasticityAssembler< DIM >::CalculateResidualNorm(), BidomainDg0Assembler< ELEMENT_DIM, SPACE_DIM >::CheckCompatibilityCondition(), SimpleNewtonNonlinearSolver::Solve(), and AbstractNonlinearElasticityAssembler< DIM >::TakeNewtonStep().
Vec LinearSystem::GetRhsVector | ( | ) | const |
Get access to the RHS vector for archiving
Definition at line 445 of file LinearSystem.cpp.
References mRhsVector.
Mat & LinearSystem::rGetLhsMatrix | ( | ) |
Get access to the LHS matrix directly. Shouldn't generally need to be called.
Definition at line 450 of file LinearSystem.cpp.
References mLhsMatrix.
Referenced by AbstractNonlinearElasticityAssembler< DIM >::AllocateMatrixMemory(), AbstractNonlinearAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, CONCRETE >::ApplyDirichletConditions(), BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem(), AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::AssembleSystem(), MonodomainRhsMatrixAssembler< ELEM_DIM, SPACE_DIM >::GetMatrix(), BidomainWithBathRhsMatrixAssembler< DIM >::GetMatrix(), BidomainRhsMatrixAssembler< DIM >::GetMatrix(), SimpleNewtonNonlinearSolver::Solve(), and AbstractNonlinearElasticityAssembler< DIM >::TakeNewtonStep().
Mat LinearSystem::GetLhsMatrix | ( | ) | const |
Get access to the LHS matrix for archiving
Definition at line 455 of file LinearSystem.cpp.
References mLhsMatrix.
Vec & LinearSystem::rGetDirichletBoundaryConditionsVector | ( | ) |
Get access to the dirichlet boundary conditions vector.
Should only be used by the BoundaryConditionsContainer.
Definition at line 460 of file LinearSystem.cpp.
References mDirichletBoundaryConditionsVector.
Referenced by BoundaryConditionsContainer< ELEM_DIM, SPACE_DIM, PROBLEM_DIM >::ApplyDirichletToLinearProblem().
void LinearSystem::GetOwnershipRange | ( | PetscInt & | lo, | |
PetscInt & | hi | |||
) |
Get this process's ownership range of the contents of the system.
lo | lowest index owned by this process | |
hi | highest index owned by this process |
Definition at line 395 of file LinearSystem.cpp.
References mOwnershipRangeHi, and mOwnershipRangeLo.
double LinearSystem::GetMatrixElement | ( | PetscInt | row, | |
PetscInt | col | |||
) |
Return an element of the matrix. May only be called for elements you own.
row | the row index | |
col | the column index |
Definition at line 401 of file LinearSystem.cpp.
References mLhsMatrix, mOwnershipRangeHi, and mOwnershipRangeLo.
Referenced by ZeroMatrixColumn().
double LinearSystem::GetRhsVectorElement | ( | PetscInt | row | ) |
Return an element of the RHS vector. May only be called for elements you own.
row | the row index |
Definition at line 416 of file LinearSystem.cpp.
References mOwnershipRangeHi, mOwnershipRangeLo, and mRhsVector.
unsigned LinearSystem::GetNumIterations | ( | ) | const |
Return the number of iterations taken by the last Solve()
Definition at line 429 of file LinearSystem.cpp.
References mKspIsSetup, and mKspSolver.
void LinearSystem::AddLhsMultipleValues | ( | unsigned * | matrixRowAndColIndices, | |
c_matrix< double, MATRIX_SIZE, MATRIX_SIZE > & | rSmallMatrix | |||
) | [inline] |
Add multiple values to the matrix of linear system.
matrixRowAndColIndices | mapping from index of the ublas matrix (see param below) to index of the Petsc matrix of this linear system | |
rSmallMatrix | Ublas matrix containing the values to be added |
Definition at line 438 of file LinearSystem.hpp.
References mLhsMatrix, mOwnershipRangeHi, and mOwnershipRangeLo.
Referenced by NonlinearElasticityAssembler< DIM >::AssembleSystem(), and AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::AssembleSystem().
void LinearSystem::AddRhsMultipleValues | ( | unsigned * | vectorIndices, | |
c_vector< double, VECTOR_SIZE > & | smallVector | |||
) | [inline] |
Add multiple values to the RHS vector.
vectorIndices | mapping from index of the ublas vector (see param below) to index of the vector of this linear system | |
smallVector | Ublas vector containing the values to be added |
Definition at line 501 of file LinearSystem.hpp.
References mOwnershipRangeHi, mOwnershipRangeLo, and mRhsVector.
Referenced by NonlinearElasticityAssembler< DIM >::AssembleSystem(), and AbstractStaticAssembler< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM, NON_HEART, CONCRETE >::AssembleSystem().
friend class boost::serialization::access [friend] |
Needed for serialization.
Definition at line 104 of file LinearSystem.hpp.
Mat LinearSystem::mLhsMatrix [private] |
The left-hand side matrix.
Definition at line 64 of file LinearSystem.hpp.
Referenced by AddLhsMultipleValues(), AddToMatrixElement(), AssembleFinalLhsMatrix(), AssembleIntermediateLhsMatrix(), DisplayMatrix(), GetLhsMatrix(), GetMatrixElement(), LinearSystem(), rGetLhsMatrix(), SetMatrixElement(), SetMatrixIsSymmetric(), SetMatrixRow(), SetupVectorAndMatrix(), Solve(), ZeroLhsMatrix(), ZeroMatrixColumn(), ZeroMatrixRow(), and ~LinearSystem().
Vec LinearSystem::mRhsVector [private] |
The right-hand side vector.
Definition at line 65 of file LinearSystem.hpp.
Referenced by AddRhsMultipleValues(), AddToRhsVectorElement(), AssembleRhsVector(), DisplayRhs(), GetRhsVector(), GetRhsVectorElement(), LinearSystem(), rGetRhsVector(), SetRhsVectorElement(), SetupVectorAndMatrix(), Solve(), ZeroRhsVector(), and ~LinearSystem().
PetscInt LinearSystem::mSize [private] |
The size of the linear system.
Definition at line 66 of file LinearSystem.hpp.
Referenced by GetSize(), LinearSystem(), SetupVectorAndMatrix(), and Solve().
PetscInt LinearSystem::mOwnershipRangeLo [private] |
Definition at line 72 of file LinearSystem.hpp.
Referenced by AddLhsMultipleValues(), AddRhsMultipleValues(), AddToMatrixElement(), AddToRhsVectorElement(), GetMatrixElement(), GetOwnershipRange(), GetRhsVectorElement(), LinearSystem(), SetMatrixElement(), SetMatrixRow(), SetRhsVectorElement(), SetupVectorAndMatrix(), ZeroMatrixColumn(), and ZeroRhsVector().
PetscInt LinearSystem::mOwnershipRangeHi [private] |
Stores one more than the highest index stored locally.
Definition at line 73 of file LinearSystem.hpp.
Referenced by AddLhsMultipleValues(), AddRhsMultipleValues(), AddToMatrixElement(), AddToRhsVectorElement(), GetMatrixElement(), GetOwnershipRange(), GetRhsVectorElement(), LinearSystem(), SetMatrixElement(), SetMatrixRow(), SetRhsVectorElement(), SetupVectorAndMatrix(), ZeroMatrixColumn(), and ZeroRhsVector().
MatNullSpace LinearSystem::mMatNullSpace [private] |
PETSc null matrix.
Definition at line 75 of file LinearSystem.hpp.
Referenced by SetNullBasis(), Solve(), and ~LinearSystem().
bool LinearSystem::mDestroyMatAndVec [private] |
Whether we need to destroy the PETSc matrix and vector in our destructor
Definition at line 78 of file LinearSystem.hpp.
Referenced by ~LinearSystem().
KSP LinearSystem::mKspSolver [private] |
The PETSc linear solver object
Definition at line 80 of file LinearSystem.hpp.
Referenced by GetNumIterations(), SetAbsoluteTolerance(), SetKspType(), SetPcType(), SetRelativeTolerance(), Solve(), and ~LinearSystem().
bool LinearSystem::mKspIsSetup [private] |
Used by Solve method to track whether KSP has been used.
Definition at line 81 of file LinearSystem.hpp.
Referenced by GetNumIterations(), SetAbsoluteTolerance(), SetKspType(), SetPcType(), SetRelativeTolerance(), Solve(), and ~LinearSystem().
double LinearSystem::mNonZerosUsed [private] |
Yes, it really is stored as a double.
Definition at line 82 of file LinearSystem.hpp.
Referenced by serialize(), and Solve().
bool LinearSystem::mMatrixIsConstant [private] |
Whether the matrix is unchanged each time Solve() is called
Definition at line 83 of file LinearSystem.hpp.
Referenced by serialize(), SetMatrixIsConstant(), and Solve().
double LinearSystem::mTolerance [private] |
absolute or relative tolerance of the KSP solver
Definition at line 84 of file LinearSystem.hpp.
Referenced by serialize(), SetAbsoluteTolerance(), SetRelativeTolerance(), and Solve().
bool LinearSystem::mUseAbsoluteTolerance [private] |
Sets either absolute or relative tolerance of the KSP solver. Default is to false
Definition at line 89 of file LinearSystem.hpp.
Referenced by serialize(), SetAbsoluteTolerance(), SetRelativeTolerance(), and Solve().
std::string LinearSystem::mKspType [private] |
KSP solver type (see PETSc KSPSetType() )
Definition at line 90 of file LinearSystem.hpp.
Referenced by LinearSystem(), serialize(), SetKspType(), and Solve().
std::string LinearSystem::mPcType [private] |
Preconditioner type (see PETSc PCSetType() )
Definition at line 91 of file LinearSystem.hpp.
Referenced by LinearSystem(), serialize(), SetPcType(), and Solve().
Vec LinearSystem::mDirichletBoundaryConditionsVector [private] |
Storage for efficient application of Dirichlet BCs, see AbstractBoundaryConditionsContainer
Definition at line 93 of file LinearSystem.hpp.
Referenced by rGetDirichletBoundaryConditionsVector(), and ~LinearSystem().
PCBlockDiagonal* LinearSystem::mpBlockDiagonalPC [private] |
Stores a pointer to a purpose-build preconditioner
Definition at line 96 of file LinearSystem.hpp.
Referenced by SetPcType(), Solve(), and ~LinearSystem().