NeoPZ
pzgeoprism.h
Go to the documentation of this file.
1 
6 #ifndef TPZGEOPRISMH
7 #define TPZGEOPRISMH
8 
9 #include "pznoderep.h"
10 #include "pzvec.h"
11 #include "pzeltype.h"
12 #include "tpzprism.h"
13 #include "pzfmatrix.h"
14 
15 class TPZGeoEl;
16 class TPZGeoMesh;
17 
18 #include <string>
19 
20 
21 namespace pzgeom {
22 
27  class TPZGeoPrism : public TPZNodeRep<6, pztopology::TPZPrism>
28  {
29  public:
32  enum {NNodes = 6};
35  TPZNodeRep<NNodes, pztopology::TPZPrism>(nodeindexes)
36  {
37  }
38 
42  {
43  }
44 
47  std::map<int64_t,int64_t> & gl2lcNdMap) : TPZRegisterClassId(&TPZGeoPrism::ClassId),
48  TPZNodeRep<NNodes, pztopology::TPZPrism>(cp,gl2lcNdMap)
49  {
50  }
51 
55  {
56  }
57 
61  {
62  }
63 
64  static bool IsLinearMapping(int side)
65  {
66  return true;
67  }
68 
70  static std::string TypeName() { return "Prism";}
71 
72 
73 
75  template<class T>
76  static void X(const TPZFMatrix<REAL> &nodes,TPZVec<T> &loc,TPZVec<T> &x);
77 
79  template<class T>
80  static void GradX(const TPZFMatrix<REAL> &nodes,TPZVec<T> &loc, TPZFMatrix<T> &gradx);
81 
82 
83  // /**
84  // * @brief Method which creates a geometric boundary condition
85  // * element based on the current geometric element,
86  // * a side and a boundary condition number
87  // */
88  // static TPZGeoEl * CreateBCGeoEl(TPZGeoEl *orig,int side,int bc);
89 
90  int ClassId() const override;
91 
92  void Read(TPZStream &buf, void *context) override;
93 
94  void Write(TPZStream &buf, int withclassid) const override;
95 
96 
97  public:
98 
100  /* @param gmesh mesh in which the element should be inserted
101  @param matid material id of the element
102  @param lowercorner (in/out) on input lower corner o the cube where the element should be created, on exit position of the next cube
103  @param size (in) size of space where the element should be created
104  */
105  static void InsertExampleElement(TPZGeoMesh &gmesh, int matid, TPZVec<REAL> &lowercorner, TPZVec<REAL> &size);
106 
108  // static TPZGeoEl *CreateGeoElement(TPZGeoMesh &mesh, MElementType type,
109  // TPZVec<int64_t>& nodeindexes,
110  // int matid, int64_t& index);
111  };
112 
113 
114  template<class T>
115  inline void TPZGeoPrism::X(const TPZFMatrix<REAL> &nodes,TPZVec<T> &loc,TPZVec<T> &x){
116 
117  TPZFNMatrix<6,T> phi(6,1);
118  TPZFNMatrix<18,T> dphi(3,6);
119  TShape(loc,phi,dphi);
120  int space = nodes.Rows();
121 
122  for(int i = 0; i < space; i++) {
123  x[i] = 0.0;
124  for(int j = 0; j < 6; j++) {
125  x[i] += phi(j,0)*nodes.GetVal(i,j);
126  }
127  }
128  }
129 
130 
131  template<class T>
132  inline void TPZGeoPrism::GradX(const TPZFMatrix<REAL> &nodes,TPZVec<T> &loc, TPZFMatrix<T> &gradx){
133 
134  gradx.Resize(3,3);
135  gradx.Zero();
136  int nrow = nodes.Rows();
137  int ncol = nodes.Cols();
138 #ifdef PZDEBUG
139  if(nrow != 3 || ncol != 6){
140  std::cout << "Objects of incompatible lengths, gradient cannot be computed." << std::endl;
141  std::cout << "nodes matrix must be 3x6." << std::endl;
142  DebugStop();
143  }
144 
145 #endif
146  TPZFNMatrix<6,T> phi(6,1);
147  TPZFNMatrix<18,T> dphi(3,6);
148  TShape(loc,phi,dphi);
149  for(int i = 0; i < 6; i++)
150  {
151  for(int j = 0; j < 3; j++)
152  {
153  gradx(j,0) += nodes.GetVal(j,i)*dphi(0,i);
154  gradx(j,1) += nodes.GetVal(j,i)*dphi(1,i);
155  gradx(j,2) += nodes.GetVal(j,i)*dphi(2,i);
156  }
157  }
158 
159  }
160 
161 };
162 #endif
int ClassId() const override
Method which creates a geometric boundary condition element based on the current geometric element...
Definition: pzgeoprism.cpp:54
TPZGeoPrism(const TPZGeoPrism &cp)
Copy constructor.
Definition: pzgeoprism.h:53
static void X(const TPZFMatrix< REAL > &nodes, TPZVec< T > &loc, TPZVec< T > &x)
Compute x mapping from element nodes and local parametric coordinates.
Definition: pzgeoprism.h:115
Templated vector implementation.
static std::string TypeName()
Returns the type name of the element.
Definition: pzgeoprism.h:70
Defines enum MElementType and contains the implementation of MElementType_NNodes(...) functions.
static bool IsLinearMapping(int side)
Definition: pzgeoprism.h:64
TPZGeoPrism(const TPZGeoPrism &cp, std::map< int64_t, int64_t > &gl2lcNdMap)
Constructor with node map.
Definition: pzgeoprism.h:46
int Zero() override
Makes Zero all the elements.
Definition: pzfmatrix.h:651
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Definition: pzgeoprism.cpp:62
Groups all classes defining the structure of the master element.
Definition: PrismExtend.cpp:15
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
static void InsertExampleElement(TPZGeoMesh &gmesh, int matid, TPZVec< REAL > &lowercorner, TPZVec< REAL > &size)
create an example element based on the topology
Definition: pzgeoprism.cpp:34
TPZGeoPrism(const TPZGeoPrism &cp, TPZGeoMesh &)
Copy constructor.
Definition: pzgeoprism.h:59
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
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: pzgeoprism.h:132
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
Contains the TPZNodeRep class which implements ... Clase intermediaria que guarda.
static void TShape(const TPZVec< T > &loc, TPZFMatrix< T > &phi, TPZFMatrix< T > &dphi)
Compute the shape being used to construct the x mapping from local parametric coordinates.
Definition: tpzprism.cpp:348
Defines the topology of a Prism. Topology Sides 0 to 7 are vertices, sides 7 to 14 are lines...
Definition: tpzprism.h:34
Implements ... Geometry Topology.
Definition: pznoderep.h:40
TPZGeoPrism(TPZVec< int64_t > &nodeindexes)
Constructor with list of nodes.
Definition: pzgeoprism.h:34
void Read(TPZStream &buf, void *context) override
read objects from the stream
Definition: pzgeoprism.cpp:58
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
Implements the geometry of a prism element. Geometry.
Definition: pzgeoprism.h:27
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Definition: pzfmatrix.cpp:1016
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
Groups all classes which model the geometry.
Definition: pzgeopoint.cpp:18
TPZGeoPrism()
Empty constructor.
Definition: pzgeoprism.h:40
Contains the TPZPrism class which defines the topology of a Prism.
const TVar & GetVal(const int64_t row, const int64_t col) const override
Get values without bounds checking This method is faster than "Get" if DEBUG is defined.
Definition: pzfmatrix.h:566
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716
pztopology::TPZPrism Top
Definition: pzgeoprism.h:30
TPZPrism()
Default constructor.
Definition: tpzprism.h:47