NeoPZ
TPZGeoLinear.cpp
Go to the documentation of this file.
1 
6 #include "TPZGeoLinear.h"
7 #include "pzquad.h"
8 #include "pzshapelinear.h"
9 #include "pzgeoel.h"
10 #include "tpzgeoelrefpattern.h"
11 
12 #include "pzlog.h"
13 
14 #ifdef LOG4CXX
15 static log4cxx::LoggerPtr logger(Logger::getLogger("pz.geom.pzgeolinear"));
16 #endif
17 
18 using namespace pzshape;
19 using namespace std;
20 
21 namespace pzgeom {
22 
23  // TPZGeoEl * TPZGeoLinear::CreateBCGeoEl(TPZGeoEl *orig, int side,int bc){
24  // if(side==2) {
25  // TPZManVector<int64_t> nodes(2);
26  // nodes[0] = orig->SideNodeIndex(side,0);
27  // nodes[1] = orig->SideNodeIndex(side,1);
28  // int64_t index;
29  // TPZGeoEl *gel = orig->Mesh()->CreateGeoElement(EOned,nodes,bc,index);
30  // TPZGeoElSide(gel,0).SetConnectivity(TPZGeoElSide(orig,TPZShapeLinear::ContainedSideLocId(side,0)));
31  // TPZGeoElSide(gel,1).SetConnectivity(TPZGeoElSide(orig,TPZShapeLinear::ContainedSideLocId(side,1)));
32  // TPZGeoElSide(gel,2).SetConnectivity(TPZGeoElSide(orig,side));
33  // return gel;
34  // }
35  // else if(side==0 || side==1) {
36  // TPZManVector<int64_t> nodeindexes(1);
37  // nodeindexes[0] = orig->SideNodeIndex(side,0);
38  // int64_t index;
39  // TPZGeoEl *gel = orig->Mesh()->CreateGeoElement(EPoint,nodeindexes,bc,index);
40  // TPZGeoElSide(gel,0).SetConnectivity(TPZGeoElSide(orig,side));
41  // return gel;
42  // }
43  // else {
44  // PZError << "TPZGeoLinear::CreateBCGeoEl. Side = " << side << endl;
45  // }
46 
47  // return 0;
48  // }
49 
50  // TPZGeoEl * TPZGeoLinear::CreateGeoElement(TPZGeoMesh &mesh, MElementType type,
51  // TPZVec<int64_t>& nodeindexes,
52  // int matid,
53  // int64_t& index)
54  // {
55  // return CreateGeoElementPattern(mesh,type,nodeindexes,matid,index);
56  // }
57 
58 
60  /* @param gmesh mesh in which the element should be inserted
61  @param matid material id of the element
62  @param lowercorner (in/out) on input lower corner o the cube where the element should be created, on exit position of the next cube
63  @param size (in) size of space where the element should be created
64  */
65  void TPZGeoLinear::InsertExampleElement(TPZGeoMesh &gmesh, int matid, TPZVec<REAL> &lowercorner, TPZVec<REAL> &size)
66  {
67  TPZManVector<REAL,3> co(3),shift(3),scale(3);
68  TPZManVector<int64_t,3> nodeindexes(2);
69  for (int i=0; i<3; i++) {
70  scale[i] = size[i]/3.;
71  shift[i] = 1./2.+lowercorner[i];
72  }
73 
74  for (int i=0; i<NCornerNodes; i++) {
75  ParametricDomainNodeCoord(i, co);
76  int j;
77  for (j=0; j<co.size(); j++) {
78  co[j] = shift[j]+scale[j]*co[j]+(rand()*0.2/RAND_MAX)-0.1;
79  }
80  co.Resize(3);
81  for (; j<3; j++) {
82  co[j] = shift[j]+(rand()*0.2/RAND_MAX)-0.1;
83  }
84  nodeindexes[i] = gmesh.NodeVec().AllocateNewElement();
85  gmesh.NodeVec()[nodeindexes[i]].Initialize(co, gmesh);
86  }
87  int64_t index;
88  gmesh.CreateGeoElement(EOned, nodeindexes, matid, index);
89  }
90 
91  int TPZGeoLinear::ClassId() const{
92  return Hash("TPZGeoLinear") ^ TPZNodeRep<2, pztopology::TPZLine>::ClassId() << 1;
93  }
94 
95  void TPZGeoLinear::Read(TPZStream& buf, void* context) {
97  }
98 
99  void TPZGeoLinear::Write(TPZStream& buf, int withclassid) const {
101  }
102 
103 
104 }
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
Contains TPZShapeLinear class which implements the shape functions of a linear one-dimensional elemen...
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
Definition: pzeltype.h:55
Groups all classes which model the geometry.
Definition: pzgeopoint.cpp:18