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"
50#include <boost/serialization/shared_ptr.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);
341 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>
586namespace serialization
588template<
class Archive>
589inline 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);
614template<
class Archive>
615inline void load_construct_data(
616 Archive & ar,
LinearSystem * t,
const unsigned int file_version)
635 if (symm_set == PETSC_TRUE)
gcov doesn't like this file...
#define CHASTE_CLASS_EXPORT(T)
static std::string GetArchiveDirectory()
Vec & rGetDirichletBoundaryConditionsVector()
void SetNullBasis(Vec nullbasis[], unsigned numberOfBases)
void serialize(Archive &archive, const unsigned int version)
void SetPrecondMatrixIsDifferentFromLhs(bool precondIsDifferent=true)
boost::shared_ptr< std::vector< PetscInt > > mpBathNodes
Vec Solve(Vec lhsGuess=nullptr)
Vec mDirichletBoundaryConditionsVector
void SetMatrixIsSymmetric(bool isSymmetric=true)
void AssembleFinalLinearSystem()
bool mUseAbsoluteTolerance
void ZeroMatrixColumn(PetscInt col)
bool mForceSpectrumReevaluation
void SetMatrixIsConstant(bool matrixIsConstant)
unsigned mRowPreallocation
void FinalisePrecondMatrix()
void GetOwnershipRange(PetscInt &lo, PetscInt &hi)
PCLDUFactorisation * mpLDUFactorisationPC
void SwitchWriteModeLhsMatrix()
void AddToMatrixElement(PetscInt row, PetscInt col, double value)
double GetMatrixElement(PetscInt row, PetscInt col)
PetscInt mOwnershipRangeLo
void SetKspType(const char *kspType)
void SetMatrixElement(PetscInt row, PetscInt col, double value)
unsigned GetNumIterations() const
PetscInt mOwnershipRangeHi
void SetUseFixedNumberIterations(bool useFixedNumberIterations=true, unsigned evaluateNumItsEveryNSolves=UINT_MAX)
MatNullSpace mMatNullSpace
void ZeroMatrixRowsWithValueOnDiagonal(std::vector< unsigned > &rRows, double diagonalValue)
void ZeroMatrixRowsAndColumnsWithValueOnDiagonal(std::vector< unsigned > &rRowColIndices, double diagonalValue)
void SetAbsoluteTolerance(double absoluteTolerance)
void AssembleIntermediateLinearSystem()
void SetRhsVectorElement(PetscInt row, double value)
void SetMatrixRow(PetscInt row, double value)
void * mpConvergenceTestContext
PCTwoLevelsBlockDiagonal * mpTwoLevelsBlockDiagonalPC
Mat & rGetPrecondMatrix()
Vec GetMatrixRowDistributed(unsigned rowIndex)
friend class boost::serialization::access
PCBlockDiagonal * mpBlockDiagonalPC
void AddLhsMultipleValues(unsigned *matrixRowAndColIndices, c_matrix< double, MATRIX_SIZE, MATRIX_SIZE > &rSmallMatrix)
void AddToRhsVectorElement(PetscInt row, double value)
unsigned mEvaluateNumItsEveryNSolves
bool mPrecondMatrixIsNotLhs
void SetRelativeTolerance(double relativeTolerance)
bool mUseFixedNumberIterations
double GetRhsVectorElement(PetscInt row)
void SetPcType(const char *pcType, boost::shared_ptr< std::vector< PetscInt > > pBathNodes=boost::shared_ptr< std::vector< PetscInt > >())
void AddRhsMultipleValues(unsigned *vectorIndices, c_vector< double, VECTOR_SIZE > &smallVector)