gmsh-TingyuanDoc
0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
|
Go to the documentation of this file.
6 #ifndef LINEAR_SYSTEM_PETSC_H
7 #define LINEAR_SYSTEM_PETSC_H
37 #include "GmshConfig.h"
45 #if defined(HAVE_PETSC)
51 typedef struct _p_Mat *Mat;
52 typedef struct _p_Vec *Vec;
53 typedef struct _p_KSP *KSP;
57 #if PETSC_VERSION_RELEASE != 0 && \
58 (PETSC_VERSION_MAJOR < 3 || \
59 (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR < 2))
60 #define KSPDestroy(k) KSPDestroy(*(k))
61 #define MatDestroy(m) MatDestroy(*(m))
62 #define VecDestroy(v) VecDestroy(*(v))
63 #define PetscViewerDestroy(v) PetscViewerDestroy(*(v))
64 #define PetscBool PetscTruth
65 #define PetscOptionsGetBool PetscOptionsGetTruth
76 #if(PETSC_VERSION_MAJOR < 3 || \
77 (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR < 5))
78 #define KSPSetOperators(_ksp, _a, _b, SAME_PRECONDITIONER) \
79 KSPSetOperators(_ksp, _a, _b, SAME_PRECONDITIONER)
81 #define SAME_PRECONDITIONER 999
82 #define KSPSetOperators(_ksp, _a, _b, OPT_PRECON) \
83 (KSPSetOperators(_ksp, _a, _b), \
84 KSPSetReusePreconditioner(_ksp, \
85 PetscBool(OPT_PRECON == SAME_PRECONDITIONER)))
92 #if(PETSC_VERSION_MAJOR < 3 || \
93 (PETSC_VERSION_MAJOR == 3 && PETSC_VERSION_MINOR < 7))
94 #define PetscViewerPushFormat(viewer, format) \
95 PetscViewerSetFormat(viewer, format)
100 bool _isAllocated, _kspAllocated, _entriesPreAllocated;
101 bool _matrixChangedSinceLastSolve;
102 bool _valuesNotAssembled;
107 int _localRowStart, _localRowEnd, _localSize, _globalSize;
110 void _assembleMatrixIfNeeded();
114 int _getBlockSizeFromParameters()
const;
129 void addToMatrix(
int row,
int col,
const scalar &val);
137 Mat getMatrix() {
return _a; }
144 MPI_Comm getComm()
const {
return _comm; }
154 Msg::Error(
"PETSc is not available in this version of Gmsh");
int getNumKspIteration() const
void getFromMatrix(int row, int col, scalar &val) const
static void Error(const char *fmt,...)
void addToMatrix(int row, int col, const scalar &val)
void addToRightHandSide(int row, const scalar &val, int ith=0)
void printMatlab(const char *filename) const
void getFromRightHandSide(int row, scalar &val) const
void allocate(int nbRows)
virtual void preAllocateEntries()
double normInfRightHandSide() const
virtual void insertInSparsityPattern(int _row, int _col)
virtual int systemSolve()
void addToSolution(int row, const scalar &val)
void getFromSolution(int row, scalar &val) const