NeoPZ
pzgeotetrahedra.cpp
Go to the documentation of this file.
1 
6 #include "pzgeotetrahedra.h"
7 #include "pzfmatrix.h"
8 #include "pzgeoel.h"
9 #include "pzquad.h"
10 #include "pzshapetetra.h"
11 #include "tpzgeoelrefpattern.h"
12 
13 using namespace pzshape;
14 using namespace std;
15 
16 #include "pzlog.h"
17 
18 #ifdef LOG4CXX
19 static LoggerPtr logger(Logger::getLogger("pz.geom.pzgeotetrahedra"));
20 #endif
21 
22 namespace pzgeom {
23 
24  const double tol = pzgeom_TPZNodeRep_tol;
25 
26 
28  /* @param gmesh mesh in which the element should be inserted
29  @param matid material id of the element
30  @param lowercorner (in/out) on input lower corner o the cube where the element should be created, on exit position of the next cube
31  @param size (in) size of space where the element should be created
32  */
33  void TPZGeoTetrahedra::InsertExampleElement(TPZGeoMesh &gmesh, int matid, TPZVec<REAL> &lowercorner,
34  TPZVec<REAL> &size) {
35  TPZManVector<REAL, 3> co(3), shift(3), scale(3);
36  TPZManVector<int64_t, 3> nodeindexes(8);
37  for (int i = 0; i < 3; i++) {
38  scale[i] = size[i] / 3.;
39  shift[i] = 1. / 2. + lowercorner[i];
40  }
41 
42  for (int i = 0; i < NCornerNodes; i++) {
43  ParametricDomainNodeCoord(i, co);
44  for (int j = 0; j < 3; j++) {
45  co[j] = shift[j] + scale[j] * co[j] + (rand() * 0.2 / RAND_MAX) - 0.1;
46  }
47  nodeindexes[i] = gmesh.NodeVec().AllocateNewElement();
48  gmesh.NodeVec()[nodeindexes[i]].Initialize(co, gmesh);
49  }
50  int64_t index;
51  gmesh.CreateGeoElement(ETetraedro, nodeindexes, matid, index);
52  }
53 
54  int TPZGeoTetrahedra::ClassId() const {
55  return Hash("TPZGeoTetrahedra") ^ TPZNodeRep<4, pztopology::TPZTetrahedron>::ClassId() << 1;
56  }
57 
58  void TPZGeoTetrahedra::Read(TPZStream &buf, void *context) {
60  }
61 
62  void TPZGeoTetrahedra::Write(TPZStream &buf, int withclassid) const {
64  }
65 
66 
67 };
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 the TPZGeoTetrahedra class which implements the geometry of a tetrahedral element...
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
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
Groups all classes which model the geometry.
Definition: pzgeopoint.cpp:18