NeoPZ
pzgenericshape.h
Go to the documentation of this file.
1 
2 
3 #include "pzshapequad.h"
4 #include "pzshapelinear.h"
5 #include "pzshapecube.h"
6 #include "pzshapepiram.h"
7 #include "pzshapetetra.h"
8 #include "pzshapeprism.h"
9 
10 template <class TSHAPE>
11 TPZTransform<REAL> GetSideTransform(int side, int trans_id);
12 template <class TSHAPE>
14 template <class TSHAPE>
16 
17 
18 
19 template <class TSHAPE>
21  int NSides = TSHAPE::NSides;
22  int NCorners = TSHAPE::NCornerNodes;
23  transvec.resize(NSides - NCorners);
24  for (int iside = NCorners; iside< NSides ; iside++) {
25  int pos = iside - NCorners;
26  int trans_id = TSHAPE::GetTransformId(iside, id); // Foi criado
27  transvec[pos] = GetSideTransform<TSHAPE>(iside, trans_id); // Foi criado
28  }
29 }
30 
31 template <class TSHAPE>
33 
34  int dim = TSHAPE::Dimension;
35  int NSides = TSHAPE::NSides;
36  int NCorners = TSHAPE::NCornerNodes;
37 
38  TPZFNMatrix<100> phiblend(NSides,1),dphiblend(dim,NSides);
39  TSHAPE::ShapeCorner(pt,phi,dphi);
40 
41  phiblend = phi;
42  dphiblend = dphi;
43 
44  TSHAPE::ShapeGenerating(pt,phiblend, dphiblend);
45  int shape = NCorners;
46  for (int side = NCorners; side<NSides ; side++)
47  {
48  TPZTransform<REAL> transform = transvec[side - NCorners];
49  int sidedim = TSHAPE::SideDimension(side);
50  int numshape =TSHAPE::NConnectShapeF( side, orders[side - NCorners]);
51  TPZFNMatrix<100,REAL> phin(numshape,1), dphin(sidedim,numshape), dphiaux(sidedim,numshape);
52 
53  TPZManVector<REAL,1> outvec(sidedim);
54  transform.Apply(pt, outvec);
55  dphin.Zero();
56  TSHAPE::ShapeInternal(side, outvec,orders[side - NCorners], phin, dphin);
57  REAL alpha = 1.0, beta =0.0;
58  int transpose = 1;
59  transform.Mult().MultAdd(dphin, dphin, dphiaux, alpha, beta, transpose);
60  for (int i = 0; i < numshape; i++) {
61  phi(shape,0) = phiblend(side,0)*phin(i,0);
62  for(int xj=0;xj<TSHAPE::Dimension;xj++) {
63  dphi(xj,shape) = dphiblend(xj,side)*phin(i,0)+phiblend(side,0)*dphiaux(xj,i);
64  }
65  shape++;
66  }
67 
68  }
69 
70 }
71 
72 
73 template <class TSHAPE>
74 TPZTransform<REAL> GetSideTransform(int side, int trans_id) {
75 
76  MElementType type_side = TSHAPE::Type(side);
77  TPZTransform<REAL> TransElToSide = TSHAPE::TransformElementToSide(side);
78 
79  TPZTransform<REAL> TransParametric(1,1);
80  switch (type_side) {
81  case EOned:
82  {
83  TransParametric = pzshape::TPZShapeLinear::ParametricTransform(trans_id);
84  }
85  break;
86  case EQuadrilateral:
87  {
88  TransParametric = pzshape::TPZShapeQuad::ParametricTransform(trans_id);
89  }
90  break;
91  case ETriangle:
92  {
93  TransParametric = pzshape::TPZShapeTriang::ParametricTransform(trans_id);
94  }
95  break;
96  default:
97  break;
98  }
99 
100  if ((side == TSHAPE::NSides - 1) && TSHAPE::Dimension>2) {
101 
102  return TransElToSide;
103  }
104  else{
105  TPZFMatrix<REAL> resul_mult;
106  TransParametric.Mult().Multiply(TransElToSide.Mult(), resul_mult);
107  TransElToSide.Mult() = resul_mult;
108  TPZFMatrix<REAL> res1;
109  TransParametric.Mult().Multiply( TransElToSide.Sum(), res1);
110  TransElToSide.Sum() =res1;
111  TransElToSide.Sum() += TransParametric.Sum();
112 
113  }
114 
115  return TransElToSide;
116 
117 }
118 
119 
120 template void Shape<pzshape::TPZShapeLinear>(TPZVec<REAL> &pt, TPZVec<int> orders,TPZVec<TPZTransform<REAL> > &transvec, TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi);
121 template void Shape<pzshape::TPZShapeTriang>(TPZVec<REAL> &pt, TPZVec<int> orders,TPZVec<TPZTransform<REAL> > &transvec, TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi);
122 template void Shape<pzshape::TPZShapeQuad>(TPZVec<REAL> &pt, TPZVec<int> orders,TPZVec<TPZTransform<REAL> > &transvec, TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi);
123 template void Shape<pzshape::TPZShapePrism>(TPZVec<REAL> &pt, TPZVec<int> orders,TPZVec<TPZTransform<REAL> > &transvec, TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi);
124 template void Shape<pzshape::TPZShapePiram>(TPZVec<REAL> &pt, TPZVec<int> orders,TPZVec<TPZTransform<REAL> > &transvec, TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi);
125 template void Shape<pzshape::TPZShapeTetra>(TPZVec<REAL> &pt, TPZVec<int> orders,TPZVec<TPZTransform<REAL> > &transvec, TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi);
126 template void Shape<pzshape::TPZShapeCube>(TPZVec<REAL> &pt, TPZVec<int> orders,TPZVec<TPZTransform<REAL> > &transvec, TPZFMatrix<REAL> &phi,TPZFMatrix<REAL> &dphi);
127 
128 
129 
130 //void Shape(TPZVec<REAL> &pt, TPZVec<int> orders,TPZVec<TPZTransform<REAL> > &transvec, TPZFMatrix<REAL> phi,TPZFMatrix<REAL> dphi);
Contains TPZShapeTetra class which implements the shape functions of a tetrahedral element...
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
const TPZFMatrix< T > & Mult() const
Definition: pztrnsform.h:64
Contains TPZShapeLinear class which implements the shape functions of a linear one-dimensional elemen...
Contains TPZShapeCube class which implements the shape functions of a hexaedral element.
TPZTransform< REAL > GetSideTransform(int side, int trans_id)
static TPZTransform< REAL > ParametricTransform(int trans_id)
void Shape(TPZVec< REAL > &pt, TPZVec< int > orders, TPZVec< TPZTransform< REAL > > &transvec, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi)
const TPZFMatrix< T > & Sum() const
Definition: pztrnsform.h:66
static TPZTransform< REAL > ParametricTransform(int transid)
static TPZTransform< REAL > ParametricTransform(int trans_id)
Contains TPZShapePrism class which implements the shape functions of a prism element.
void ComputeTransforms(TPZVec< int64_t > &id, TPZVec< TPZTransform< REAL > > &transvec)
MElementType
Define the element types.
Definition: pzeltype.h:52
virtual void Multiply(const TPZFMatrix< TVar > &A, TPZFMatrix< TVar > &res, int opt=0) const
It mutiplies itself by TPZMatrix<TVar>A putting the result in res.
Definition: pzmatrix.cpp:1916
virtual void MultAdd(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha=1., const TVar beta=0., const int opt=0) const override
It computes z = beta * y + alpha * opt(this)*x but z and x can not overlap in memory.
Definition: pzfmatrix.cpp:757
Contains TPZShapePiram class which implements the shape functions of a pyramid element.
Implements an affine transformation between points in parameter space. Topology Utility.
Definition: pzmganalysis.h:14
Definition: pzeltype.h:55
Contains TPZShapeQuad class which implements the shape functions of a quadrilateral element...
void Apply(TPZVec< T > &vectorin, TPZVec< T > &vectorout)
Transforms the vector.
Definition: pztrnsform.cpp:121
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716