NeoPZ
pzgeopoint.cpp
Go to the documentation of this file.
1 
6 #include "pzgeopoint.h"
7 #include <ostream> // for operator<<, basic_ostream, endl
8 #include "pzerror.h" // for PZError
9 #include "pzgeoel.h" // for TPZGeoEl
10 #include "pzgeoelside.h" // for TPZGeoElSide
11 #include "pzgmesh.h" // for TPZGeoMesh
12 #include "pzmanvector.h" // for TPZManVector
13 #include "pzvec.h" // for TPZVec
14 #include "tpzgeoelrefpattern.h" // for CreateGeoElementPattern
15 
16 using namespace std;
17 
18 namespace pzgeom {
19 
20  // TPZGeoEl *TPZGeoPoint::CreateBCGeoEl(TPZGeoEl *orig, int side,int bc){
21  // if(side==0) {
22  // TPZManVector<int64_t> nodeindexes(1);
23  // nodeindexes[0] = orig->NodeIndex(0);
24  // int64_t index;
25  // TPZGeoEl *gel = orig->Mesh()->CreateGeoElement(EPoint,nodeindexes,bc,index);
26 
27  // TPZGeoElSide(gel,0).SetConnectivity(TPZGeoElSide(orig,0));
28  // return gel;
29  // }
30  // else PZError << "TPZGeoPoint::CreateBCGeoEl. Side = " << side << endl;
31  // return 0;
32  // }
33 
34  // /** Creates a geometric element according to the type of the father element */
35  // TPZGeoEl *TPZGeoPoint::CreateGeoElement(TPZGeoMesh &mesh, MElementType type,
36  // TPZVec<int64_t>& nodeindexes,
37  // int matid,
38  // int64_t& index)
39  // {
40  // return CreateGeoElementPattern(mesh,type,nodeindexes,matid,index);
41  // }
42 
44  /* @param gmesh mesh in which the element should be inserted
45  @param matid material id of the element
46  @param lowercorner (in/out) on input lower corner o the cube where the element should be created, on exit position of the next cube
47  @param size (in) size of space where the element should be created
48  */
49  void TPZGeoPoint::InsertExampleElement(TPZGeoMesh &gmesh, int matid, TPZVec<REAL> &lowercorner, TPZVec<REAL> &size)
50  {
51  TPZManVector<REAL,3> co(3),shift(3),scale(3);
52  TPZManVector<int64_t,1> nodeindexes(1);
53  for (int i=0; i<3; i++) {
54  scale[i] = size[i]/3.;
55  shift[i] = 1./2.+lowercorner[i];
56  }
57 
58  for (int i = 0; i < NCornerNodes; i++) {
59  ParametricDomainNodeCoord(i, co);
60  for (int j=0; j< co.size(); j++) {
61  co[j] = shift[j]+scale[j]*co[j]+(rand()*0.2/RAND_MAX)-0.1;
62  }
63  nodeindexes[i] = gmesh.NodeVec().AllocateNewElement();
64  gmesh.NodeVec()[nodeindexes[i]].Initialize(co, gmesh);
65  }
66  int64_t index;
67  gmesh.CreateGeoElement(EPoint, nodeindexes, matid, index);
68  }
69 
70  int TPZGeoPoint::ClassId() const{
71  return Hash("TPZGeoPoint") ^ TPZNodeRep<1, pztopology::TPZPoint>::ClassId() << 1;
72  }
73 
74  void TPZGeoPoint::Read(TPZStream& buf, void* context) {
76  }
77 
78  void TPZGeoPoint::Write(TPZStream& buf, int withclassid) const {
80  }
81 
82 };
int AllocateNewElement()
Makes more room for new elements.
Definition: pzadmchunk.h:184
Contains declaration of TPZGeoElSide class which represents an element and its side, and TPZGeoElSideIndex class which represents an TPZGeoElSide index.
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
Templated vector implementation.
Defines PZError.
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
Free store vector implementation.
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
Contains the TPZGeoPoint class which implements the geometry of a point element or 0-D element...
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