NeoPZ
pzstencil.h
Go to the documentation of this file.
1 
7 #ifndef STENMATH
8 #define STENMATH
9 
10 #include "pzmatrix.h"
11 #include "pzfmatrix.h"
12 
13 
18 template<class TVar>
19 class TPZStencilMatrix : public TPZMatrix<TVar> {
20 
21  public :
22 
24  TPZStencilMatrix( int rows, int cols );
25 
26  virtual ~TPZStencilMatrix();
27 
29  virtual int Rows() const;
31  virtual int Cols() const;
32 
34  virtual const TVar &GetVal(const int row,const int col ) const;
35 
38  virtual void MultAdd(const TPZFMatrix<TVar> &x,const TPZFMatrix<TVar> &y, TPZFMatrix<TVar> &z,
39  const TVar alpha=1., const TVar beta = 0., const int opt = 0) const;
40 
42  virtual void Print(const char *title, std::ostream &out = std::cout ,const MatrixOutputFormat form = EFormatted) const;
43 
44  void SolveSOR( int &numiterations,const TPZFMatrix<TVar> &rhs, TPZFMatrix<TVar> &x,
45  TPZFMatrix<TVar> *residual, TPZFMatrix<TVar> &scratch,
46  const TVar overrelax, TVar &tol,
47  const int FromCurrent = 0,const int direction = 1 );
48 
50  void SetStencil( int stencilnumber, int inc, int *IA, TVar *A );
51 
53  void SetNodeStencils( int *stencilnumber );
54 
55 private:
56 
57  void IncreaseStencilPointers( int stencilnumber );
58 
59  void ComputeDiagonal();
60 
61  struct MPStencil {
63  int fInc;
64  int *fIA;
65  TVar *fA;
66 
67  MPStencil( int inc, int *IA, TVar *A );
68  ~MPStencil();
69 
70  } **fMystencils;
71 
73  int fRows, fCols;
75 
76  TVar *fDiag;
77  int fSolver;
79 
81 };
82 
83 template<class TVar>
84 inline int TPZStencilMatrix<TVar>::Rows() const{
85  return fRows;
86 }
87 
88 template<class TVar>
89 inline int TPZStencilMatrix<TVar>::Cols() const{
90  return fCols;
91 }
92 
93 #endif
void IncreaseStencilPointers(int stencilnumber)
Definition: pzstencil.cpp:338
Implements a sparse matrix defined by a stencil. Matrix.
Definition: pzstencil.h:19
MPStencil(int inc, int *IA, TVar *A)
Definition: pzstencil.cpp:366
MatrixOutputFormat
Defines output format.
Definition: pzmatrix.h:55
int * fStencilNumbers
Definition: pzstencil.h:74
void SolveSOR(int &numiterations, const TPZFMatrix< TVar > &rhs, TPZFMatrix< TVar > &x, TPZFMatrix< TVar > *residual, TPZFMatrix< TVar > &scratch, const TVar overrelax, TVar &tol, const int FromCurrent=0, const int direction=1)
Definition: pzstencil.cpp:269
virtual int Rows() const
Returns the rows of this.
Definition: pzstencil.h:84
virtual int Cols() const
Returns the columns of this.
Definition: pzstencil.h:89
struct TPZStencilMatrix::MPStencil ** fMystencils
static const double tol
Definition: pzgeoprism.cpp:23
Contains TPZMatrixclass which implements full matrix (using column major representation).
TPZStencilMatrix(int rows, int cols)
sets up the StencilMatrix based on the stencil
Definition: pzstencil.cpp:19
virtual const TVar & GetVal(const int row, const int col) const
Get the matrix entry at (row,col) without bound checking.
Definition: pzstencil.cpp:59
void ComputeDiagonal()
Definition: pzstencil.cpp:238
virtual void MultAdd(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha=1., const TVar beta=0., const int opt=0) const
computes
Definition: pzstencil.cpp:112
Full matrix class. Matrix.
Definition: pzfmatrix.h:32
void SetStencil(int stencilnumber, int inc, int *IA, TVar *A)
initiates Stencil number "stencilnumber" with the data
Definition: pzstencil.cpp:326
Contains TPZMatrix<TVar>class, root matrix class.
void SetNodeStencils(int *stencilnumber)
associates the given stencil number with each row
Definition: pzstencil.cpp:351
TVar fSORRelaxation
Definition: pzstencil.h:80
virtual void Print(const char *title, std::ostream &out=std::cout, const MatrixOutputFormat form=EFormatted) const
Print the matrix along with a identification title.
Definition: pzstencil.cpp:188
virtual ~TPZStencilMatrix()
Definition: pzstencil.cpp:36
int fNumberOfStencilPointers
Definition: pzstencil.h:72
Root matrix class (abstract). Matrix.
Definition: pzmatrix.h:60