36 #ifndef _LINEARSYSTEM_HPP_
37 #define _LINEARSYSTEM_HPP_
43 #include "PetscVecTools.hpp"
44 #include "PetscMatTools.hpp"
45 #include "OutputFileHandler.hpp"
46 #include "PCBlockDiagonal.hpp"
47 #include "PCLDUFactorisation.hpp"
48 #include "PCTwoLevelsBlockDiagonal.hpp"
49 #include "ArchiveLocationInfo.hpp"
55 #include <petscviewer.h>
67 friend class TestLinearSystem;
68 friend class TestPCBlockDiagonal;
69 friend class TestPCTwoLevelsBlockDiagonal;
70 friend class TestPCLDUFactorisation;
71 friend class TestChebyshevIteration;
150 unsigned mTotalNumIterations;
151 unsigned mMaxNumIterations;
161 template<
class Archive>
162 void serialize(Archive & archive,
const unsigned int version)
207 LinearSystem(
Vec templateVector,
unsigned rowPreallocation,
bool newAllocationError=
true);
340 void SetPcType(
const char* pcType, boost::shared_ptr<std::vector<PetscInt> > pBathNodes=boost::shared_ptr<std::vector<PetscInt> >() );
539 template<
size_t MATRIX_SIZE>
540 void AddLhsMultipleValues(
unsigned* matrixRowAndColIndices, c_matrix<double, MATRIX_SIZE, MATRIX_SIZE>& rSmallMatrix)
554 template<
size_t VECTOR_SIZE>
586 namespace serialization
588 template<
class Archive>
589 inline void save_construct_data(
590 Archive & ar,
const LinearSystem * t,
const unsigned int file_version)
595 const unsigned size = t->
GetSize();
602 PetscBool symm_set, is_symmetric;
603 is_symmetric = PETSC_FALSE;
605 MatIsSymmetricKnown(t->
GetLhsMatrix(), &symm_set, &is_symmetric);
606 assert(symm_set == is_symmetric);
614 template<
class Archive>
615 inline void load_construct_data(
616 Archive & ar,
LinearSystem * t,
const unsigned int file_version)
635 if (symm_set == PETSC_TRUE)
646 #endif //_LINEARSYSTEM_HPP_
void AssembleFinalLinearSystem()
Mat & rGetPrecondMatrix()
void FinalisePrecondMatrix()
unsigned mRowPreallocation
friend class boost::serialization::access
void AddToRhsVectorElement(PetscInt row, double value)
void GetOwnershipRange(PetscInt &lo, PetscInt &hi)
bool mUseAbsoluteTolerance
void * mpConvergenceTestContext
void serialize(Archive &archive, const unsigned int version)
void AddLhsMultipleValues(unsigned *matrixRowAndColIndices, c_matrix< double, MATRIX_SIZE, MATRIX_SIZE > &rSmallMatrix)
void SetKspType(const char *kspType)
Vec Solve(Vec lhsGuess=nullptr)
void ZeroMatrixRowsWithValueOnDiagonal(std::vector< unsigned > &rRows, double diagonalValue)
unsigned mEvaluateNumItsEveryNSolves
void SetRelativeTolerance(double relativeTolerance)
void SetMatrixElement(PetscInt row, PetscInt col, double value)
void AddToMatrixElement(PetscInt row, PetscInt col, double value)
Vec mDirichletBoundaryConditionsVector
Vec & rGetDirichletBoundaryConditionsVector()
PCTwoLevelsBlockDiagonal * mpTwoLevelsBlockDiagonalPC
void ZeroMatrixRowsAndColumnsWithValueOnDiagonal(std::vector< unsigned > &rRowColIndices, double diagonalValue)
double GetRhsVectorElement(PetscInt row)
boost::shared_ptr< std::vector< PetscInt > > mpBathNodes
double GetMatrixElement(PetscInt row, PetscInt col)
void ZeroMatrixColumn(PetscInt col)
void SetPrecondMatrixIsDifferentFromLhs(bool precondIsDifferent=true)
PetscInt mOwnershipRangeHi
void SetMatrixIsSymmetric(bool isSymmetric=true)
LinearSystem(PetscInt lhsVectorSize, unsigned rowPreallocation=UINT_MAX)
PCBlockDiagonal * mpBlockDiagonalPC
void SetNullBasis(Vec nullbasis[], unsigned numberOfBases)
MatNullSpace mMatNullSpace
PCLDUFactorisation * mpLDUFactorisationPC
void SetPcType(const char *pcType, boost::shared_ptr< std::vector< PetscInt > > pBathNodes=boost::shared_ptr< std::vector< PetscInt > >())
void SetAbsoluteTolerance(double absoluteTolerance)
bool mForceSpectrumReevaluation
void SetRhsVectorElement(PetscInt row, double value)
void AssembleIntermediateLinearSystem()
void AddRhsMultipleValues(unsigned *vectorIndices, c_vector< double, VECTOR_SIZE > &smallVector)
#define CHASTE_CLASS_EXPORT(T)
void SwitchWriteModeLhsMatrix()
unsigned GetNumIterations() const
static std::string GetArchiveDirectory()
PetscInt mOwnershipRangeLo
gcov doesn't like this file...
void SetUseFixedNumberIterations(bool useFixedNumberIterations=true, unsigned evaluateNumItsEveryNSolves=UINT_MAX)
bool mPrecondMatrixIsNotLhs
void SetMatrixRow(PetscInt row, double value)
Vec GetMatrixRowDistributed(unsigned rowIndex)
void SetMatrixIsConstant(bool matrixIsConstant)
bool mUseFixedNumberIterations