1 | /*!\file: Matrix.h
|
---|
2 | * \brief wrapper to matrix objects. The goal is to control which API (PETSc,Scalpack, Plapack?)
|
---|
3 | * implements our underlying matrix format.
|
---|
4 | */
|
---|
5 |
|
---|
6 | #ifndef _MATRIX_H_
|
---|
7 | #define _MATRIX_H_
|
---|
8 |
|
---|
9 | /*Headers:*/
|
---|
10 | /*{{{*/
|
---|
11 | #ifdef HAVE_CONFIG_H
|
---|
12 | #include <config.h>
|
---|
13 | #else
|
---|
14 | #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
|
---|
15 | #endif
|
---|
16 | #include "../../toolkits/toolkits.h"
|
---|
17 | #include "../../EnumDefinitions/EnumDefinitions.h"
|
---|
18 | /*}}}*/
|
---|
19 | class Vector;
|
---|
20 | enum matrixtype{PetscMatType, SeqMatType};
|
---|
21 |
|
---|
22 | class Matrix{
|
---|
23 |
|
---|
24 | public:
|
---|
25 |
|
---|
26 | #ifdef _HAVE_PETSC_
|
---|
27 | PetscMat *pmatrix;
|
---|
28 | #endif
|
---|
29 | SeqMat *smatrix;
|
---|
30 | int type;
|
---|
31 |
|
---|
32 | /*Matrix constructors, destructors {{{*/
|
---|
33 | Matrix();
|
---|
34 | Matrix(int M,int N,int type=PetscMatType);
|
---|
35 | Matrix(int M,int N,IssmDouble sparsity,int type=PetscMatType);
|
---|
36 | Matrix(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity,int type=PetscMatType);
|
---|
37 | Matrix(int M,int N,int connectivity,int numberofdofspernode,int type=PetscMatType);
|
---|
38 | ~Matrix();
|
---|
39 | /*}}}*/
|
---|
40 | /*Matrix specific routines {{{*/
|
---|
41 | void Echo(void);
|
---|
42 | void Assemble(void);
|
---|
43 | IssmDouble Norm(NormMode norm_type);
|
---|
44 | void GetSize(int *pM,int*pN);
|
---|
45 | void GetLocalSize(int *pM,int*pN);
|
---|
46 | void MatMult(Vector *X,Vector*AX);
|
---|
47 | Matrix *Duplicate(void);
|
---|
48 | IssmDouble *ToSerial(void);
|
---|
49 | void SetValues(int m,int *idxm,int n,int*idxn,IssmDouble*values,InsMode mode);
|
---|
50 | void Convert(MatrixType newtype);
|
---|
51 | /*}}}*/
|
---|
52 | };
|
---|
53 |
|
---|
54 | #endif //#ifndef _MATRIX_H_
|
---|