NeoPZ
pztrnsform.h
Go to the documentation of this file.
1 
6 #ifndef TTRANSFORMH
7 #define TTRANSFORMH
8 
9 #include "pzfmatrix.h"
10 
11 #ifdef _AUTODIFF
12 #include "fad.h"
13 #endif
14 
15 template<class T>
16 class TPZVec;
17 
22 template<class T=REAL>
23 class TPZTransform : public TPZSavable {
25  int fRow;
27  int fCol;
33  // dynamic memory allocation
34 public:
36  TPZTransform(int dim);
38  TPZTransform();
40  TPZTransform(int fRow,int fCol);
42  TPZTransform(const TPZTransform<T> &tr);
44  ~TPZTransform();
45 
46 // /** @brief Rows of transformation matrix */
47 // int Rows();
48 //
49 // /** @brief Cols of transformation matrix */
50 // int Cols();
51 
52  friend class TPZTransform<REAL>;
53 
54 #ifdef _AUTODIFF
55  friend class TPZTransform<Fad<REAL> >;
56 #endif
57 
60 
62  void CopyFrom(const TPZTransform<REAL> &cp);
63 
64  const TPZFMatrix<T> & Mult() const {return fMult;}
65 
66  const TPZFMatrix<T> & Sum() const {return fSum;}
67 
68  TPZFMatrix<T> & Mult() {return fMult;}
69 
70  TPZFMatrix<T> & Sum() {return fSum;}
71 
73  void SetMatrix(TPZFMatrix<T> &mult,TPZFMatrix<T> &sum);
74 
77 
79  void Apply(TPZVec<T> &vectorin,TPZVec<T> &vectorout);
80 
81  void PrintInputForm(std::ostream &out);
82 
84  int CompareTransform(TPZTransform<T> &t,REAL tol = 1.e-6);
85 
86  int ClassId() const override{
87  return Hash("TPZTransform");
88  }
89 
90  void Read(TPZStream& buf, void* context) override { //ok
91  buf.Read(&fRow);
92  buf.Read(&fCol);
93  fMult.Read(buf,context);
94  fSum.Read(buf,context);
95  }
96 
97  void Write(TPZStream& buf, int withclassid) const override{ //ok
98  buf.Write(&fRow);
99  buf.Write(&fCol);
100  fMult.Write(buf,withclassid);
101  fSum.Write(buf,withclassid);
102  }
103 
104 };
105 
107 template<class T>
108 inline std::ostream &operator<<(std::ostream &out, const TPZTransform<T> &tr)
109 {
110  out << "mult = " << tr.Mult() << " sum = " << tr.Sum();
111  return out;
112 }
113 
114 #endif
~TPZTransform()
Default destructor.
Definition: pztrnsform.cpp:79
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Definition: pzfmatrix.h:789
void CopyFrom(const TPZTransform< REAL > &cp)
Create a copy form a real transformation.
Definition: pztrnsform.cpp:62
const TPZFMatrix< T > & Mult() const
Definition: pztrnsform.h:64
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Definition: pztrnsform.h:97
Definition: fad.h:54
int ClassId() const override
Define the class id associated with the class.
Definition: pztrnsform.h:86
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
int fRow
Number of rows of the matrix associated with the transformation.
Definition: pztrnsform.h:25
int fCol
Number of columns of the matrix associated with the transformation.
Definition: pztrnsform.h:27
static const double tol
Definition: pzgeoprism.cpp:23
void Read(TPZStream &buf, void *context) override
read objects from the stream
Definition: pzfmatrix.h:783
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
int CompareTransform(TPZTransform< T > &t, REAL tol=1.e-6)
Compare the current transformation with t transformation considering a given tolerance.
Definition: pztrnsform.cpp:163
Contains TPZMatrixclass which implements full matrix (using column major representation).
TPZTransform()
Default constructor.
Definition: pztrnsform.cpp:31
void Read(TPZStream &buf, void *context) override
read objects from the stream
Definition: pztrnsform.h:90
TPZFMatrix< T > & Mult()
Definition: pztrnsform.h:68
const TPZFMatrix< T > & Sum() const
Definition: pztrnsform.h:66
void PrintInputForm(std::ostream &out)
Definition: pztrnsform.cpp:140
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
TPZTransform< T > Multiply(TPZTransform< T > &right)
Multiply the transformation object (to the right) with right (Multiplying matrices) ...
Definition: pztrnsform.cpp:112
TPZTransform< T > & operator=(const TPZTransform< T > &t)
Overloading equal operator for transformation.
Definition: pztrnsform.cpp:87
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
TPZFMatrix< T > & Sum()
Definition: pztrnsform.h:70
Implements an affine transformation between points in parameter space. Topology Utility.
Definition: pzmganalysis.h:14
void SetMatrix(TPZFMatrix< T > &mult, TPZFMatrix< T > &sum)
Sets the transformation matrices.
Definition: pztrnsform.cpp:96
This class defines the interface to save and restore objects from TPZStream objects. Persistency.
Definition: TPZSavable.h:67
TPZFNMatrix< 3, T > fSum
Matrix used by sums.
Definition: pztrnsform.h:31
TPZFNMatrix< 9, T > fMult
Matrix used by multiplications.
Definition: pztrnsform.h:29
void Apply(TPZVec< T > &vectorin, TPZVec< T > &vectorout)
Transforms the vector.
Definition: pztrnsform.cpp:121
virtual void Read(bool &val)
Definition: TPZStream.cpp:91