NeoPZ
pztransfer.h
Go to the documentation of this file.
1 
6 #ifndef TRANSFERH
7 #define TRANSFERH
8 
9 #include "pzblock.h"
10 #include "pzvec.h"
11 #include "pzmanvector.h"
12 #include "pzmatrix.h"
13 
22 template<class TVar>
23 class TPZTransfer : public TPZMatrix<TVar> {
24 
25 public :
26  int ClassId() const override;
27 
29  TPZTransfer();
30 
32  //TPZTransfer(TPZBlock<REAL> &row, TPZBlock<REAL> &col,int nvar, int nrowblocks, int ncolblocks);
33  TPZTransfer(TPZBlock<TVar> &row, TPZBlock<TVar> &col,int nvar, int nrowblocks, int ncolblocks);
34 
37  TPZMatrix<TVar>(cp),
45  {
46  }
47 
48  virtual TPZMatrix<TVar> *Clone() const override { return new TPZTransfer(*this); }
49 
50  //TPZMatrix<REAL> : EFormatted, EInputFormat, EMathematicaInput
51  virtual void Print(const char *name = NULL, std::ostream &out = std::cout , const MatrixOutputFormat form = EFormatted) const override;
52 
54  void SetNTVarVariables(int TVarvar) { fNTVarVar = TVarvar; }
55 
64  //void SetBlocks(TPZBlock<REAL> &row, TPZBlock<REAL> &col, int nvar, int nrowblocks, int ncolblocks);
65  void SetBlocks(TPZBlock<TVar> &row, TPZBlock<TVar> &col, int nvar, int nrowblocks, int ncolblocks);
66 
68  int HasRowDefinition(int row);
69 
71  void AddBlockNumbers(int row, TPZVec<int> &colnumbers);
72 
77  void SetBlockMatrix(int row, int col, TPZFMatrix<TVar> &mat);
78 
80  void MultAdd(const TPZFMatrix<TVar> &x,const TPZFMatrix<TVar> &y, TPZFMatrix<TVar> &z,
81  const TVar alpha,const TVar beta, const int opt = 0) const override;
82 
85  const TVar alpha,const TVar beta, const int opt = 0) const;
90  void TransferSolution(const TPZFMatrix<TVar> &coarsesol, TPZFMatrix<TVar> &finesol);
91 
96  void TransferResidual(const TPZFMatrix<TVar> &fine, TPZFMatrix<TVar> &coarse);
97 
98 // void Multiply(const TPZFMatrix<TVar> &A, TPZFMatrix<TVar> &B, int opt) const override;
99 
100  void MultiplyScalar(const TPZFMatrix<TVar> &A, TPZFMatrix<TVar> &B, int opt) const;
101 
102 private:
103 
106  void ExpandColumnVectorEntries(int numcol);
107 
110  void ExpandDoubleValueEntries(int numval);
111 
115  //TPZBlock<REAL> fRowBlock;
118  //TPZBlock<REAL> fColBlock;
134 
135 };
136 
137 template<class TVar>
139  return Hash("TPZTransfer") ^ TPZMatrix<TVar>::ClassId() << 1;
140 }
141 
142 #endif
143 
TPZManVector< int > fColumnBlockPosition
Vector indicating the starting point of each column block.
Definition: pztransfer.h:125
int ClassId() const override
Define the class id associated with the class.
Definition: pztransfer.h:138
void SetBlockMatrix(int row, int col, TPZFMatrix< TVar > &mat)
Sets the row,col block equal to matrix mat if row col was not specified by AddBlockNumbers, an error will be issued and exit.
Definition: pztransfer.cpp:153
TPZManVector< TVar > fDoubleValues
Storage space for the matrix blocks.
Definition: pztransfer.h:131
TPZBlock< TVar > fColBlock
Block sizes of the columns.
Definition: pztransfer.h:119
void AddBlockNumbers(int row, TPZVec< int > &colnumbers)
Will specify the sparsity pattern of row.
Definition: pztransfer.cpp:121
Templated vector implementation.
MatrixOutputFormat
Defines output format.
Definition: pzmatrix.h:55
void SetBlocks(TPZBlock< TVar > &row, TPZBlock< TVar > &col, int nvar, int nrowblocks, int ncolblocks)
This operation will reset the matrix to zero with no rows defined.
Definition: pztransfer.cpp:85
int fNTVarVar
Number of variables associated with each shape function.
Definition: pztransfer.h:113
int fDoubleValLastUsed
Indicates the next free position of fDoubleValues.
Definition: pztransfer.h:133
virtual void Print(const char *name=NULL, std::ostream &out=std::cout, const MatrixOutputFormat form=EFormatted) const override
It prints the matrix data in a MatrixFormat Rows X Cols.
Definition: pztransfer.cpp:31
virtual TPZMatrix< TVar > * Clone() const override
Definition: pztransfer.h:48
TPZTransfer(const TPZTransfer &cp)
copy constructor
Definition: pztransfer.h:36
void ExpandColumnVectorEntries(int numcol)
Increases the storage allocated int fColPosition to include numcol more values.
Definition: pztransfer.cpp:139
void SetNTVarVariables(int TVarvar)
Identifies the number of equations per shapefunction.
Definition: pztransfer.h:54
TPZVec< int > fNumberofColumnBlocks
Vector indicating the number of column blocks associated with each row.
Definition: pztransfer.h:123
void MultiplyScalar(const TPZFMatrix< TVar > &A, TPZFMatrix< TVar > &B, int opt) const
Definition: pztransfer.cpp:386
int HasRowDefinition(int row)
Returns 1 if the row is defined (i.e. has column entries)
Definition: pztransfer.cpp:114
TPZTransfer()
Default constructor.
Definition: pztransfer.cpp:13
Free store vector implementation.
void TransferResidual(const TPZFMatrix< TVar > &fine, TPZFMatrix< TVar > &coarse)
Will transfer the residual, taking into acount there may be more than one TVar variable.
Definition: pztransfer.cpp:347
TPZVec< int > fColPosition
Vector indicating the starting column block for each row.
Definition: pztransfer.h:121
Full matrix class. Matrix.
Definition: pzfmatrix.h:32
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
Contains TPZMatrix<TVar>class, root matrix class.
void TransferSolution(const TPZFMatrix< TVar > &coarsesol, TPZFMatrix< TVar > &finesol)
Will transfer the solution, taking into acount there may be more than one TVar variable.
Definition: pztransfer.cpp:305
int fColumnBlockLastUsed
Indicates the next free position.
Definition: pztransfer.h:129
Implements block matrices. Matrix utility.
TPZBlock< TVar > fRowBlock
Block sizes of the rows.
Definition: pztransfer.h:116
void MultAdd(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha, const TVar beta, const int opt=0) const override
Multiplies the transfer matrix and puts the result in z.
Definition: pztransfer.cpp:202
void ExpandDoubleValueEntries(int numval)
Increases the storage space available in the fDoubleValues vector to include numval entries...
Definition: pztransfer.cpp:191
Implements rectangular matrix which extends a solution vector of the coarse mesh to a solution vector...
Definition: pzcmesh.h:33
TPZManVector< int > fColumnBlockNumber
Vector indicating the number of the column corresponding to the block.
Definition: pztransfer.h:127
void MultAddScalar(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha, const TVar beta, const int opt=0) const
Multiplies the transfer matrix and puts the result in z.
Definition: pztransfer.cpp:241
int ClassId() const override
Define the class id associated with the class.
Definition: pzmatrix.h:957
Root matrix class (abstract). Matrix.
Definition: pzmatrix.h:60