NeoPZ
TPZCylinder.cpp
Go to the documentation of this file.
1 //
2 // TPZCylinder.cpp
3 // pz
4 //
5 // Created by Philippe Devloo on 04/05/18.
6 //
7 
8 #include "TPZCylinder.h"
9 #include "pzvec_extras.h"
10 #include "tpzgeoelmapped.h"
11 
12 namespace pzgeom {
14  template<class TGeo>
16  {
17  // build two normal vectors
18  std::map<REAL,int> vals;
19  for(int i=0; i<3; i++) vals[fabs(axis[i])] = i;
20  TPZManVector<REAL,3> gen(3,0.), orto1(3,0.), orto2(3,0.);
21  auto it = vals.rbegin();
22  gen[it->second] = 1.;
23  Cross(axis, gen, orto1);
24  REAL normax = sqrt(Norm(axis));
25  REAL normort1 = sqrt(Norm(orto1));
26  for (int i=0; i<3; i++) {
27  axis[i] /= normax;
28  orto1[i] /= normort1;
29  }
30  Cross(orto1, axis, orto2);
31  for (int i=0; i<3; i++) {
32  fRotation(0,i) = orto1[i];
33  fRotation(1,i) = orto2[i];
34  fRotation(2,i) = axis[i];
35  }
36  }
37 
39  template<class TGeo>
41  {
42  int nnodes = TGeo::NNodes;
43  for (int in=0; in<nnodes; in++) {
44  int64_t nodeindex = TGeo::fNodeIndexes[in];
46  gmesh.NodeVec()[nodeindex].GetCoordinates(co);
47  TPZManVector<REAL,3> localco(3);
48  for (int i=0; i<3; i++) {
49  localco[i] = 0.;
50  for (int j=0; j<3; j++) {
51  localco[i] += fRotation(i,j)*co[i]-fOrigin[i];
52  }
53  }
54  REAL radius = sqrt(localco[0]*localco[0]+localco[1]*localco[1]);
55  if(fabs(radius-fRadius) > 1.e-6) DebugStop();
56  REAL theta = atan2(localco[1],localco[0]);
57  REAL z = localco[2];
58  fCornerCo(0,in) = theta;
59  fCornerCo(1,in) = z;
60  }
61  }
62 
63  // template<class TGeo>
64  // TPZGeoEl *TPZCylinderMap<TGeo>::CreateBCGeoEl(TPZGeoEl *orig, int side,int bc)
65  // {
66 
67  // int ns = orig->NSideNodes(side);
68  // TPZManVector<int64_t> nodeindices(ns);
69  // int in;
70  // for(in=0; in<ns; in++)
71  // {
72  // nodeindices[in] = orig->SideNodeIndex(side,in);
73  // }
74  // int64_t index;
75 
76  // TPZGeoMesh *mesh = orig->Mesh();
77  // MElementType type = orig->Type(side);
78 
79  // TPZGeoEl *newel = mesh->CreateGeoBlendElement(type, nodeindices, bc, index);
80  // TPZGeoElSide me(orig,side);
81  // TPZGeoElSide newelside(newel,newel->NSides()-1);
82 
83  // newelside.InsertConnectivity(me);
84  // newel->Initialize();
85 
86  // return newel;
87  // }
88 
89 
94  // template<class TGeo>
95  // TPZGeoEl *TPZCylinderMap<TGeo>::CreateGeoElement(TPZGeoMesh &mesh, MElementType type,
96  // TPZVec<int64_t>& nodeindexes,
97  // int matid,
98  // int64_t& index)
99 
100  // {
101  // return ::CreateGeoElementMapped(mesh,type,nodeindexes,matid,index);
102  // }
103 
104 
105 
106 };
TPZFlopCounter atan2(const TPZFlopCounter &val1, const TPZFlopCounter &val2)
Returns the arc tangent in radians and increments the counter of the Arc Tangent. ATAN2 returns the ...
Definition: pzreal.h:544
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
Definition: tfadfunc.h:140
void SetCylinderAxis(const TPZVec< REAL > &axis)
axis direction with the vertical axis
Definition: TPZCylinder.cpp:15
Contains declaration of TPZGeoElMapped class which implements a geometric element using its ancestral...
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
Definition: pzgmesh.h:140
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
Definition: tfadfunc.h:120
REAL co[8][3]
Coordinates of the eight nodes.
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
Extra utilities for TPZVec. Implementations of the saxpy, sscal, sdot, intercept, max and min functio...
Groups all classes which model the geometry.
Definition: pzgeopoint.cpp:18
void ComputeCornerCoordinates(TPZGeoMesh &gmesh)
compute the corner coordinates of the corner nodes
Definition: TPZCylinder.cpp:40
void Cross(const TPZVec< T > &x1, const TPZVec< T > &x2, TPZVec< T > &result)
Definition: pzvec_extras.h:255