NeoPZ
TPZQuadTorus.h
Go to the documentation of this file.
1 //
2 // TPZQuadTorus.h
3 // PZ
4 //
5 // Created by Philippe Devloo on 3/21/14.
6 //
7 //
8 
9 #ifndef __PZ__TPZQuadTorus__
10 #define __PZ__TPZQuadTorus__
11 
12 #include <iostream>
13 #include "pzgeoquad.h"
14 
15 namespace pzgeom {
16 
17  class TPZQuadTorus : public TPZGeoQuad
18  {
19  private:
20 
21  REAL fR = 0.;
22  REAL fr = 0.;
23 
25 
27  public:
28 
29  public:
30 int ClassId() const override;
31 
32 
34  TPZQuadTorus(TPZVec<int64_t> &nodeindexes) : TPZGeoQuad(nodeindexes), fOrigin(3,0.), fPhiTheta(3,4,0.)
35  {
36  }
37 
39  TPZQuadTorus() : TPZGeoQuad(), fOrigin(3,0.), fPhiTheta(3,4,0.)
40  {
41  }
42 
45  std::map<int64_t,int64_t> & gl2lcNdMap) : TPZGeoQuad(cp,gl2lcNdMap), fR(cp.fR), fr(cp.fr), fOrigin(cp.fOrigin), fPhiTheta(cp.fPhiTheta)
46  {
47  }
48 
50  TPZQuadTorus(const TPZQuadTorus &cp) : TPZGeoQuad(cp), fR(cp.fR), fr(cp.fr), fOrigin(cp.fOrigin), fPhiTheta(cp.fPhiTheta)
51  {
52  }
53 
55  TPZQuadTorus(const TPZQuadTorus &cp, TPZGeoMesh &) : TPZGeoQuad(cp), fR(cp.fR), fr(cp.fr), fOrigin(cp.fOrigin), fPhiTheta(cp.fPhiTheta)
56  {
57  }
58 
60  {
61  TPZGeoQuad::operator=(cp);
62  fR = cp.fR;
63  fr = cp.fr;
64  fOrigin = cp.fOrigin;
65  fPhiTheta = cp.fPhiTheta;
66  return *this;
67  }
68 
69  void SetDataPhiTheta(const TPZFMatrix<REAL> &phitheta)
70  {
71 #ifdef PZDEBUG
72  if (phitheta.Rows() != 2 || phitheta.Cols() != 4) {
73  DebugStop();
74  }
75 #endif
76  fPhiTheta = phitheta;
77  }
78 
79  void SetDataRadius(const REAL &R, const REAL &r)
80  {
81 #ifdef PZDEBUG
82  if (R < r)
83  {
84  DebugStop();
85  }
86 #endif
87  fR = R;
88  fr = r;
89  }
90 
91  void SetOrigin(TPZVec<REAL> &origin)
92  {
93  fOrigin = origin;
94  }
95 
97  static std::string TypeName() { return "TorusQuad";}
98 
99  /* @brief Computes the coordinate of a point given in parameter space */
100 
101  template<class T>
103  {
104 
105 
106  TPZFNMatrix<6,T> DxDphi(3,2,0.), gradphi(2,2);
107  TPZManVector<T,3> ft(3,0.);
108  TPZGeoQuad::X(fPhiTheta,par,ft);
109  TPZGeoQuad::GradX(fPhiTheta, par, gradphi);
110 
111  DxDphi(0,0) = -cos(ft[1]) * sin(ft[0]);
112  DxDphi(0,1) = -(3. + cos(ft[0])) * sin(ft[1]);
113  DxDphi(1,0) = -sin(ft[1]) * sin(ft[0]);
114  DxDphi(1,1) = cos(ft[1]) * (3. + cos(ft[0]));
115  DxDphi(2,0) = cos(ft[0]);
116  DxDphi(2,1) = 0.;
117  DxDphi.Multiply(gradphi, gradx);
118 
119 
120  }
121  /* @brief Computes the jacobian of the map between the master element and deformed element */
122 // void Jacobian(const TPZGeoEl &gel,TPZVec<REAL> &param,TPZFMatrix<REAL> &jacobian,TPZFMatrix<REAL> &axes,REAL &detjac,TPZFMatrix<REAL> &jacinv) const;
123 
124  template<class T>
125  void X(const TPZFMatrix<REAL> &nodes,TPZVec<T> &loc,TPZVec<T> &result) const
126  {
127  TPZManVector<T,2> resloc(2);
128  TPZGeoQuad::X(this->fPhiTheta,loc,resloc);
129 
130  result[0] = (fR + fr*cos(resloc[0]))*cos(resloc[1]);
131  result[1] = (fR + fr*cos(resloc[0]))*sin(resloc[1]);
132  result[2] = fr*sin(resloc[0]);
133 
134  }
135 
136 
137  // static TPZGeoEl *CreateBCGeoEl(TPZGeoEl *gel, int side,int bc);
138 
139  // /** @brief Creates a geometric element according to the type of the father element */
140  // static TPZGeoEl *CreateGeoElement(TPZGeoMesh &mesh, MElementType type,
141  // TPZVec<int64_t>& nodeindexes,
142  // int matid,
143  // int64_t& index);
144 
145  void Read(TPZStream& buf, void* context) override
146  {
148  }
149 
150  void Write(TPZStream &buf, int withclassid) const override
151  {
152  pzgeom::TPZGeoQuad::Write(buf, withclassid);
153  }
154 
155  static void InsertExampleElement(TPZGeoMesh &gmesh, int matid, TPZVec<REAL> &lowercorner, TPZVec<REAL> &size);
156 
157 
158  };
159 
160 
161 
162 }
163 
164 #endif /* defined(__PZ__TPZQuadTorus__) */
static REAL cornerco[8][3]
void X(const TPZFMatrix< REAL > &nodes, TPZVec< T > &loc, TPZVec< T > &result) const
Definition: TPZQuadTorus.h:125
void Read(TPZStream &buf, void *context) override
Creates a geometric element according to the type of the father element.
Definition: TPZQuadTorus.h:145
TPZFNMatrix< 12, REAL > fPhiTheta
Definition: TPZQuadTorus.h:26
void SetDataRadius(const REAL &R, const REAL &r)
Definition: TPZQuadTorus.h:79
static void GradX(const TPZFMatrix< REAL > &nodes, TPZVec< T > &loc, TPZFMatrix< T > &gradx)
Compute gradient of x mapping from element nodes and local parametric coordinates.
Definition: pzgeoquad.h:144
TPZQuadTorus(const TPZQuadTorus &cp)
Copy constructor.
Definition: TPZQuadTorus.h:50
int ClassId() const override
Creates a geometric element according to the type of the father element.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Definition: pzgeoquad.cpp:126
static void X(const TPZFMatrix< REAL > &nodes, TPZVec< T > &loc, TPZVec< T > &x)
Compute x mapping from element nodes and local parametric coordinates.
Definition: pzgeoquad.h:127
void SetOrigin(TPZVec< REAL > &origin)
Definition: TPZQuadTorus.h:91
TPZQuadTorus(const TPZQuadTorus &cp, std::map< int64_t, int64_t > &gl2lcNdMap)
Constructor with node map.
Definition: TPZQuadTorus.h:44
TPZQuadTorus()
Empty constructor.
Definition: TPZQuadTorus.h:39
sin
Definition: fadfunc.h:63
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Definition: TPZQuadTorus.h:150
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
TPZManVector< REAL > fOrigin
Definition: TPZQuadTorus.h:24
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
Implements the geometry of a quadrilateral element. Geometry.
Definition: pzgeoquad.h:26
void GradX(TPZFMatrix< REAL > &cornerco, TPZVec< T > &par, TPZFMatrix< T > &gradx) const
Definition: TPZQuadTorus.h:102
TPZQuadTorus(const TPZQuadTorus &cp, TPZGeoMesh &)
Copy constructor.
Definition: TPZQuadTorus.h:55
void Read(TPZStream &buf, void *context) override
read objects from the stream
Definition: pzgeoquad.cpp:122
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
TPZQuadTorus(TPZVec< int64_t > &nodeindexes)
Constructor with list of nodes.
Definition: TPZQuadTorus.h:34
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
TPZQuadTorus & operator=(const TPZQuadTorus &cp)
Definition: TPZQuadTorus.h:59
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
void SetDataPhiTheta(const TPZFMatrix< REAL > &phitheta)
Definition: TPZQuadTorus.h:69
static void InsertExampleElement(TPZGeoMesh &gmesh, int matid, TPZVec< REAL > &lowercorner, TPZVec< REAL > &size)
static std::string TypeName()
Returns the type name of the element.
Definition: TPZQuadTorus.h:97
Groups all classes which model the geometry.
Definition: pzgeopoint.cpp:18
TPZFlopCounter cos(const TPZFlopCounter &orig)
Returns the cosine in radians and increments the counter of the Cosine.
Definition: pzreal.h:514