NeoPZ
pzgeopyramid.cpp
Go to the documentation of this file.
1 
6 #include "pzgeopyramid.h"
7 #include "pzfmatrix.h"
8 #include "pzgeoel.h"
9 #include "pzquad.h"
10 #include "pzshapetetra.h"
11 #include "pzshapepiram.h"
12 #include "tpzgeoelrefpattern.h"
13 
14 #include "pzlog.h"
15 
16 #ifdef LOG4CXX
17 static LoggerPtr logger(Logger::getLogger("pz.geom.pzgeopyramid"));
18 #endif
19 
20 #include <cmath>
21 
22 using namespace pzshape;
23 using namespace std;
24 
25 namespace pzgeom {
26 
27  const double tol = pzgeom_TPZNodeRep_tol;
28 
29 // void TPZGeoPyramid::Shape(TPZVec<REAL> &pt,TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi) {
30 // if(fabs(pt[0])<1.e-10 && fabs(pt[1])<1.e-10 && pt[2]==1.) {
31 // //para testes com transforma�es geometricas-->>Que o que faz o RefPattern!!
32 // //(0,0,1) nunca �um ponto de integra�o
33 // phi(0,0) = 0.;
34 // phi(1,0) = 0.;
35 // phi(2,0) = 0.;
36 // phi(3,0) = 0.;
37 // phi(4,0) = 1.;
38 // dphi(0,0) = -0.25;
39 // dphi(1,0) = -0.25;
40 // dphi(2,0) = -0.25;
41 // dphi(0,1) = 0.25;
42 // dphi(1,1) = -0.25;
43 // dphi(2,1) = -0.25;
44 // dphi(0,2) = 0.25;
45 // dphi(1,2) = 0.25;
46 // dphi(2,2) = -0.25;
47 // dphi(0,3) = -0.25;
48 // dphi(1,3) = 0.25;
49 // dphi(2,3) = -0.25;
50 // dphi(0,4) = 0;
51 // dphi(1,4) = 0;
52 // dphi(2,4) = 1.;
53 //
54 //
55 //
56 // return;
57 // }
58 //
59 // REAL T0xz = .5*(1.-pt[2]-pt[0]) / (1.-pt[2]);
60 // REAL T0yz = .5*(1.-pt[2]-pt[1]) / (1.-pt[2]);
61 // REAL T1xz = .5*(1.-pt[2]+pt[0]) / (1.-pt[2]);
62 // REAL T1yz = .5*(1.-pt[2]+pt[1]) / (1.-pt[2]);
63 // REAL lmez = (1.-pt[2]);
64 // phi(0,0) = T0xz*T0yz*lmez;
65 // phi(1,0) = T1xz*T0yz*lmez;
66 // phi(2,0) = T1xz*T1yz*lmez;
67 // phi(3,0) = T0xz*T1yz*lmez;
68 // phi(4,0) = pt[2];
69 // REAL lmexmez = 1.-pt[0]-pt[2];
70 // REAL lmeymez = 1.-pt[1]-pt[2];
71 // REAL lmaxmez = 1.+pt[0]-pt[2];
72 // REAL lmaymez = 1.+pt[1]-pt[2];
73 // dphi(0,0) = -.25*lmeymez / lmez;
74 // dphi(1,0) = -.25*lmexmez / lmez;
75 // dphi(2,0) = -.25*(lmeymez+lmexmez-lmexmez*lmeymez/lmez) / lmez;
76 //
77 // dphi(0,1) = .25*lmeymez / lmez;
78 // dphi(1,1) = -.25*lmaxmez / lmez;
79 // dphi(2,1) = -.25*(lmeymez+lmaxmez-lmaxmez*lmeymez/lmez) / lmez;
80 //
81 // dphi(0,2) = .25*lmaymez / lmez;
82 // dphi(1,2) = .25*lmaxmez / lmez;
83 // dphi(2,2) = -.25*(lmaymez+lmaxmez-lmaxmez*lmaymez/lmez) / lmez;
84 //
85 // dphi(0,3) = -.25*lmaymez / lmez;
86 // dphi(1,3) = .25*lmexmez / lmez;
87 // dphi(2,3) = -.25*(lmaymez+lmexmez-lmexmez*lmaymez/lmez) / lmez;
88 //
89 // dphi(0,4) = 0.0;
90 // dphi(1,4) = 0.0;
91 // dphi(2,4) = 1.0;
92 // }
93 
94 
95 
96 
98  /* @param gmesh mesh in which the element should be inserted
99  @param matid material id of the element
100  @param lowercorner (in/out) on input lower corner o the cube where the element should be created, on exit position of the next cube
101  @param size (in) size of space where the element should be created
102  */
103  void
104  TPZGeoPyramid::InsertExampleElement(TPZGeoMesh &gmesh, int matid, TPZVec<REAL> &lowercorner, TPZVec<REAL> &size) {
105  TPZManVector<REAL, 3> co(3), shift(3), scale(3);
106  TPZManVector<int64_t, 3> nodeindexes(8);
107  for (int i = 0; i < 3; i++) {
108  scale[i] = size[i] / 3.;
109  shift[i] = 1. / 2. + lowercorner[i];
110  }
111 
112  for (int i = 0; i < NCornerNodes; i++) {
113  ParametricDomainNodeCoord(i, co);
114  for (int j = 0; j < 3; j++) {
115  co[j] = shift[j] + scale[j] * co[j] + (rand() * 0.2 / RAND_MAX) - 0.1;
116  }
117  nodeindexes[i] = gmesh.NodeVec().AllocateNewElement();
118  gmesh.NodeVec()[nodeindexes[i]].Initialize(co, gmesh);
119  }
120  int64_t index;
121  gmesh.CreateGeoElement(EPiramide, nodeindexes, matid, index);
122  }
123 
124  int TPZGeoPyramid::ClassId() const {
125  return Hash("TPZGeoPyramid") ^ TPZNodeRep<5, pztopology::TPZPyramid>::ClassId() << 1;
126  }
127 
128  void TPZGeoPyramid::Read(TPZStream &buf, void *context) {
130  }
131 
132  void TPZGeoPyramid::Write(TPZStream &buf, int withclassid) const {
134  }
135 
136 };
Contains TPZShapeTetra class which implements the shape functions of a tetrahedral element...
int AllocateNewElement()
Makes more room for new elements.
Definition: pzadmchunk.h:184
Contains the TPZInt1d, TPZIntTriang, TPZIntQuad, TPZIntCube3D, TPZIntTetra3D, TPZIntPyram3D and TPZIn...
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
virtual TPZGeoEl * CreateGeoElement(MElementType type, TPZVec< int64_t > &cornerindexes, int matid, int64_t &index, int reftype=1)
Generic method for creating a geometric element. Putting this method centrally facilitates the modifi...
Definition: pzgmesh.cpp:1296
groups all classes dedicated to the computation of shape functions
Definition: pzshapeextend.h:16
static const double tol
Definition: pzgeoprism.cpp:23
Contains TPZMatrixclass which implements full matrix (using column major representation).
const double pzgeom_TPZNodeRep_tol
Initializing tolerance to TPZNodeRep.
Definition: pznoderep.h:32
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
Definition: pzgmesh.h:140
Contains declaration of TPZGeoElRefPattern class which implements a generic geometric element which i...
REAL co[8][3]
Coordinates of the eight nodes.
Implements ... Geometry Topology.
Definition: pznoderep.h:40
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
Contains TPZShapePiram class which implements the shape functions of a pyramid element.
Contains the TPZGeoPyramid class which implements the geometry of pyramid element.
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
Groups all classes which model the geometry.
Definition: pzgeopoint.cpp:18