NeoPZ
TPZTriangleTorus.cpp
Go to the documentation of this file.
1 //
2 // TPZTriangleTorus.cpp
3 // PZ
4 //
5 // Created by Philippe Devloo on 3/21/14.
6 //
7 //
8 
9 #include "TPZTriangleTorus.h"
10 #include "tpzgeomid.h"
11 #include "tpzgeoelmapped.h"
12 #include "tpzgeoelrefpattern.h"
13 
14 namespace pzgeom {
15 
16 // TPZGeoEl *TPZTriangleTorus::CreateBCGeoEl(TPZGeoEl *orig, int side,int bc)
17 // {
18 
19 // int ns = orig->NSideNodes(side);
20 // TPZManVector<int64_t> nodeindices(ns);
21 // int in;
22 // for(in=0; in<ns; in++)
23 // {
24 // nodeindices[in] = orig->SideNodeIndex(side,in);
25 // }
26 // int64_t index;
27 
28 // TPZGeoMesh *mesh = orig->Mesh();
29 // MElementType type = orig->Type(side);
30 
31 // TPZGeoEl *newel = mesh->CreateGeoBlendElement(type, nodeindices, bc, index);
32 // TPZGeoElSide me(orig,side);
33 // TPZGeoElSide newelside(newel,newel->NSides()-1);
34 
35 // newelside.InsertConnectivity(me);
36 // newel->Initialize();
37 
38 // return newel;
39 // }
40 
41  // /**
42  // * Creates a geometric element according to the type of the father element
43  // */
44  // /** @brief Creates a geometric element according to the type of the father element */
45  // TPZGeoEl *TPZTriangleTorus::CreateGeoElement(TPZGeoMesh &mesh, MElementType type,
46  // TPZVec<int64_t>& nodeindexes,
47  // int matid,
48  // int64_t& index)
49 
50  // {
51  // return CreateGeoElementMapped(mesh,type,nodeindexes,matid,index);
52  // }
53 
55  return Hash("TPZTriangleTorus") ^ TPZGeoTriangle::ClassId() << 1;
56  }
57 
59  {
60  REAL R = 1., r = 0.8;
61  size[0] = 2.;
62  size[1] = 2.;
63  size[2] = 1.;
64  TPZManVector<REAL,3> origin(lowercorner);
65  origin[0] += 1.;
66  TPZTriangleTorus torus;
67  torus.SetOrigin(origin);
68  torus.SetDataRadius(R, r);
69  TPZFNMatrix<12,REAL> phitheta(2,3,0.);
70  phitheta(0,0) = 0.;
71  phitheta(0,1) = M_PI/5.;
72  phitheta(0,2) = M_PI;
73 
74  phitheta(1,0) = M_PI;
75  phitheta(1,1) = 2*M_PI;
76  phitheta(1,2) = 2*M_PI-M_PI/5.;
77  torus.SetDataPhiTheta(phitheta);
78  TPZManVector<int64_t,4> indexes(3);
79  REAL coords[3][2] = {
80  {0,0},{1,0},{0,1}
81  };
82  for (int i=0; i<3; i++) {
83  indexes[i] = gmesh.NodeVec().AllocateNewElement();
84  TPZManVector<REAL,3> xco(3), loc(2);
85  loc[0] = coords[i][0];
86  loc[1] = coords[i][1];
87 
88  torus.X(phitheta, loc, xco);
89  gmesh.NodeVec()[indexes[i]].Initialize(xco, gmesh);
90  }
92  gel->Geom().SetOrigin(origin);
93  gel->Geom().SetDataRadius(R, r);
94  gel->Geom().SetDataPhiTheta(phitheta);
95  }
96 
97 }
98 
100 
101 
103 
int AllocateNewElement()
Makes more room for new elements.
Definition: pzadmchunk.h:184
int ClassId() const override
Define the class id associated with the class.
void SetOrigin(TPZVec< REAL > &origin)
void SetDataRadius(const REAL &R, const REAL &r)
Implements the mapping between the master element and deformed element. Geometry. ...
void X(TPZFMatrix< REAL > &coord, TPZVec< T > &loc, TPZVec< T > &result) const
Contains declaration of TPZGeoElMapped class which implements a geometric element using its ancestral...
static void InsertExampleElement(TPZGeoMesh &gmesh, int matid, TPZVec< REAL > &lowercorner, TPZVec< REAL > &size)
Implements a generic geometric element which is refined according to a generic refinement pattern...
Definition: pzgmesh.h:35
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
Definition: pzgmesh.h:140
Contains declaration of TPZGeoElRefPattern class which implements a generic geometric element which i...
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
void SetDataPhiTheta(const TPZFMatrix< REAL > &phitheta)
int ClassId() const override
Creates a geometric element according to the type of the father element.
Groups all classes which model the geometry.
Definition: pzgeopoint.cpp:18
Implements an interface to register a class id and a restore function. Persistence.
Definition: TPZSavable.h:150