20 REAL TPZShapeTetra::gRibTrans3dTetr1d[6][3] = {
21 {2.,1.,1.} , {-1.,1.,0.} , {-1.,-2.,-1.} ,
22 {1.,1.,2.} , {-1.,0.,1.} , {0.,-1.,1.}
24 REAL TPZShapeTetra::gVet1dTetr[6] = { -1., 0., 1., -1., 0., 0. };
26 REAL TPZShapeTetra::gFaceTrans3dTetr2d[4][2][3] = {
27 { {2.,0.,0.},{0.,2.,0.} },
28 { {2.,0.,0.},{0.,0.,2.} },
29 { {-2./3.,4./3.,-2./3.},{-2./3.,-2./3.,4./3.} },
30 { {0.,2.,0.},{0.,0.,2.} }
33 REAL TPZShapeTetra::gVet2dTetr[4][2] = { {-1.,-1.},{-1.,-1.},{-1./3.,-1./3.},{-1.,-1.} };
35 REAL TPZShapeTetra::gFaceSum3dTetra2d[4][2] = {
36 {-1.,-1.},{-1.,-1.},{-1./3.,-1./3.},{-1.,-1.}
39 REAL TPZShapeTetra::gFaceTrans3dTetra2d[4][2][3] = {
40 { { 2.,0.,0.},{0.,2.,0.} },
41 { { 2.,0.,0.},{0.,0.,2.} },
42 { { -2./3.,4./3.,-2./3.},{-2./3.,-2./3.,4./3.} },
43 { { 0.,2.,0.},{0.,0.,2.} }
46 REAL TPZShapeTetra::gRibSum3dTetra1d[6] = {-1.,0.,1.,-1.,0.,0.};
48 REAL TPZShapeTetra::gRibTrans3dTetra1d[6][3] = {
49 {2.,1.,1.} , {-1.,1.,0. } , {-1.,-2.,-1.} ,
50 {1.,1.,2.} , {-1.,0.,1. } , {0.,-1.,1.}
54 phi(0,0) = 1-pt[0]-pt[1]-pt[2];
76 phi(0,0) = 1-pt[0]-pt[1]-pt[2];
105 for(is=4; is<NSides; is++)
107 int nsnodes = NSideNodes(is);
112 int is1 = SideNodeLocId(is,0);
113 int is2 = SideNodeLocId(is,1);
114 phi(is,0) = phi(is1,0)*phi(is2,0);
115 dphi(0,is) = dphi(0,is1)*phi(is2,0)+phi(is1,0)*dphi(0,is2);
116 dphi(1,is) = dphi(1,is1)*phi(is2,0)+phi(is1,0)*dphi(1,is2);
117 dphi(2,is) = dphi(2,is1)*phi(is2,0)+phi(is1,0)*dphi(2,is2);
123 int is1 = SideNodeLocId(is,0);
124 int is2 = SideNodeLocId(is,1);
125 int is3 = SideNodeLocId(is,2);
126 phi(is,0) = phi(is1,0)*phi(is2,0)*phi(is3,0);
127 dphi(0,is) = dphi(0,is1)*phi(is2,0)*phi(is3,0)+phi(is1,0)*dphi(0,is2)*phi(is3,0)+phi(is1,0)*phi(is2,0)*dphi(0,is3);
128 dphi(1,is) = dphi(1,is1)*phi(is2,0)*phi(is3,0)+phi(is1,0)*dphi(1,is2)*phi(is3,0)+phi(is1,0)*phi(is2,0)*dphi(1,is3);
129 dphi(2,is) = dphi(2,is1)*phi(is2,0)*phi(is3,0)+phi(is1,0)*dphi(2,is2)*phi(is3,0)+phi(is1,0)*phi(is2,0)*dphi(2,is3);
134 phi(is,0) = phi(0,0)*phi(1,0)*phi(2,0)*phi(3,0);
135 for(
int xj=0;xj<3;xj++) {
136 dphi(xj,is) = dphi(xj,0)* phi(1 ,0)* phi(2 ,0)* phi(3 ,0) +
137 phi(0, 0)*dphi(xj,1)* phi(2 ,0)* phi(3 ,0) +
138 phi(0, 0)* phi(1 ,0)*dphi(xj,2)* phi(3 ,0) +
139 phi(0, 0)* phi(1 ,0)* phi(2 ,0)*dphi(xj,3);
149 REAL mult[] = {1.,1.,1.,1.,4.,4.,4.,4.,4.,4.,27.,27.,27.,27.,54.};
150 for(is=4;is<NSides; is++)
152 phi(is,0) *= mult[is];
153 dphi(0,is) *= mult[is];
154 dphi(1,is) *= mult[is];
155 dphi(2,is) *= mult[is];
164 CornerShape(pt,phi,dphi);
167 for(is=NCornerNodes; is<NSides; is++)
if(order[is-NCornerNodes] > 1) linear =
false;
171 for(is=0; is<NCornerNodes; is++)
173 phiblend(is,0) = phi(is,0);
174 for(d=0; d<Dimension; d++)
176 dphiblend(d,is) = dphi(d,is);
179 ShapeGenerating(pt,phiblend,dphiblend);
184 for (
int rib = 0; rib < 6; rib++) {
186 ProjectPoint3dTetraToRib(rib,pt,outval);
190 id0 = SideNodes[rib][0];
191 id1 = SideNodes[rib][1];
194 REAL store1[20],store2[60];
195 int ordin = order[rib]-1;
199 TPZShapeLinear::ShapeInternal(outvalvec,order[rib],phin,dphin,TPZShapeLinear::GetTransformId1d(ids));
200 TransformDerivativeFromRibToTetra(rib,ordin,dphin);
201 for (
int i = 0; i < ordin; i++) {
202 phi(shape,0) = phiblend(rib+4,0)*phin(i,0);
203 for(
int xj=0;xj<3;xj++) {
204 dphi(xj,shape) = dphiblend(xj ,rib+4) * phin( i, 0) +
205 phiblend(rib+4, 0 ) * dphin(xj,i);
212 for (
int face = 0; face < 4; face++) {
213 if (order[6+face] < 3)
continue;
215 ProjectPoint3dTetraToFace(face,pt,outval);
216 REAL store1[20],store2[60];
219 ord1 = order[6+face];
222 int ordin = (ord1-2)*(ord1-1)/2;
229 for(i=0;i<3;i++) ids[i] =
id[FaceNodes[face][i]];
233 int transid = TPZShapeTriang::GetTransformId2dT(ids);
234 outval[0] = (outval[0]+1.)/2.;
235 outval[1] = (outval[1]+1.)/2.;
236 TPZShapeTriang::ShapeInternal(outval,ord1-2,phin,dphin,transid);
237 int c = dphin.
Cols();
243 TransformDerivativeFromFaceToTetra(face,ordin,dphin);
244 for(i=0;i<ordin;i++) {
245 phi(shape,0) = phiblend(face+10,0)*phin(i,0);
246 for(
int xj=0;xj<3;xj++) {
247 dphi(xj,shape) = dphiblend(xj,face+10) * phin(i ,0) +
248 phiblend(face+10, 0) * dphin(xj,i);
253 if(order[10]<4)
return;
257 for(i=0;i<order[10]-3;i++) {
258 sum = (i+1)*(i+2) / 2;
265 ShapeInternal(pt,order[10],phin,dphin);
267 phi(shape,0) = phiblend(NSides-1,0)*phin(i,0);
268 for(
int xj=0;xj<3;xj++) {
269 dphi(xj,shape) = dphiblend(xj,NSides-1) * phin(i ,0) +
270 phiblend(NSides-1, 0) * dphin(xj,i);
276 void TPZShapeTetra::ProjectPoint3dTetrSide(
int side,
TPZVec<REAL> &in, REAL &out) {
278 out = gRibTrans3dTetr1d[side][0]*in[0]+gRibTrans3dTetr1d[side][1]*in[1]+gRibTrans3dTetr1d[side][2]*in[2]+gVet1dTetr[side];
283 out[0] = gFaceTrans3dTetr2d[face][0][0]*in[0]+gFaceTrans3dTetr2d[face][0][1]*in[1]+gFaceTrans3dTetr2d[face][0][2]*in[2]+gVet2dTetr[face][0];
284 out[1] = gFaceTrans3dTetr2d[face][1][0]*in[0]+gFaceTrans3dTetr2d[face][1][1]*in[1]+gFaceTrans3dTetr2d[face][1][2]*in[2]+gVet2dTetr[face][1];
289 if(order < 4)
return;
292 TPZFNMatrix<100, REAL> phi0(ord,1),phi1(ord,1),phi2(ord,1),dphi0(1,ord),dphi1(1,ord),dphi2(1,ord);
293 TPZShapeLinear::fOrthogonal(2.*x[0]-1.,ord,phi0,dphi0);
294 TPZShapeLinear::fOrthogonal(2.*x[1]-1.,ord,phi1,dphi1);
295 TPZShapeLinear::fOrthogonal(2.*x[2]-1.,ord,phi2,dphi2);
299 for (
int i=0;i<ord;i++) {
300 for (
int j=0;j<ord;j++) {
301 for (
int k=0;k<ord;k++) {
304 phi(index,0) = phi0(i,0)* phi1(j,0)* phi2(k,0);
305 dphi(0,index) = 2.*dphi0(0,i)* phi1(j,0)* phi2(k,0);
306 dphi(1,index) = 2.* phi0(i,0)*dphi1(0,j)* phi2(k,0);
307 dphi(2,index) = 2.* phi0(i,0)* phi1(j,0)*dphi2(0,k);
315 void TPZShapeTetra::ShapeInternal(
int side,
TPZVec<REAL> &x,
int order,
317 if (side < 4 || side > 14) {
347 ShapeInternal(x, order, phi, dphi);
352 std::cout <<
"Wrong side parameter side " << side << std::endl;
359 void TPZShapeTetra::TransformDerivativeFromRibToTetra(
int rib,
int num,
TPZFMatrix<REAL> &dphi) {
360 for (
int j = 0;j<num;j++) {
361 dphi(2,j) = gRibTrans3dTetra1d[rib][2]*dphi(0,j);
362 dphi(1,j) = gRibTrans3dTetra1d[rib][1]*dphi(0,j);
363 dphi(0,j) = gRibTrans3dTetra1d[rib][0]*dphi(0,j);
367 void TPZShapeTetra::TransformDerivativeFromFaceToTetra(
int face,
int num,
TPZFMatrix<REAL> &dphi) {
369 for (
int j = 0;j<num;j++) {
370 dphi(2,j) = gFaceTrans3dTetra2d[face][0][2]*dphi(0,j)+gFaceTrans3dTetra2d[face][1][2]*dphi(1,j);
371 REAL dphi1j = dphi(1,j);
372 dphi(1,j) = gFaceTrans3dTetra2d[face][0][1]*dphi(0,j)+gFaceTrans3dTetra2d[face][1][1]*dphi(1,j);
373 dphi(0,j) = gFaceTrans3dTetra2d[face][0][0]*dphi(0,j)+gFaceTrans3dTetra2d[face][1][0]*dphi1j;
377 void TPZShapeTetra::ProjectPoint3dTetraToRib(
int rib,
TPZVec<REAL> &in, REAL &outval) {
378 outval = gRibTrans3dTetra1d[rib][0]*in[0]+gRibTrans3dTetra1d[rib][1]*in[1]+gRibTrans3dTetra1d[rib][2]*in[2]+gRibSum3dTetra1d[rib];
382 outval[0] = gFaceTrans3dTetra2d[face][0][0]*in[0]+gFaceTrans3dTetra2d[face][0][1]*in[1]+gFaceTrans3dTetra2d[face][0][2]*in[2]+gFaceSum3dTetra2d[face][0];
384 outval[1] = gFaceTrans3dTetra2d[face][1][0]*in[0]+gFaceTrans3dTetra2d[face][1][1]*in[1]+gFaceTrans3dTetra2d[face][1][2]*in[2]+gFaceSum3dTetra2d[face][1];
393 int TPZShapeTetra::NConnectShapeF(
int side,
int order) {
396 if(side<10)
return order-1;
399 for(
int i=0;i<order-1;i++) sum += i;
404 for(
int i=1;i<order-2;i++) {
410 PZError <<
"TPZCompElT3d::NConnectShapeF, bad parameter side " << side << endl;
415 int in,
res=NCornerNodes;
416 for(in=NCornerNodes;in<NSides;in++) res += NConnectShapeF(in,order[in-NCornerNodes]);
422 if(side<0 || side>15)
PZError <<
"TPZCompElT3d::SideShapeFunction. Bad paramenter side.\n";
423 else if(side==14)
Shape(point,
id,order,phi,dphi);
424 else if(side<4) phi(0,0)=1.;
438 int64_t nsides = TPZShapeTetra::NSides;
442 for (
int side = 0; side < nsides; side++)
446 if(side >= NCornerNodes) nshape = NConnectShapeF(side,order[side-NCornerNodes]);
448 if(side >= NCornerNodes) sideorder = order[side-NCornerNodes];
451 SideShapeOrder(side,
id, sideorder, locshapeorders);
453 int nlin = locshapeorders.
Rows();
454 int ncol = locshapeorders.
Cols();
456 for (
int il = 0; il<nlin; il++)
458 for (
int jc = 0; jc<ncol; jc++)
460 shapeorders(linha, jc) = locshapeorders(il, jc);
474 if (shapeorders.
Rows() != 1)
478 shapeorders(0,0) = 1;
479 shapeorders(0,1) = 0;
480 shapeorders(0,2) = 0;
482 else if (side>=4 && side<=9)
484 int nshape = order-1;
485 if (shapeorders.
Rows() != nshape)
489 for (
int ioy = 0; ioy < order-1; ioy++)
491 shapeorders(ioy,0) = ioy+2;
494 else if (side >= 10 && side <= 13)
496 int nshape = (order-2)*(order-1)/2;
497 if (shapeorders.
Rows() != nshape)
502 LowerDimensionSides(side, lowersides);
503 lowersides.
Push(side);
505 int nnodes = NSideNodes(side);
508 for (
int node=0; node<locid.
size(); node++) {
509 locid[node] =
id[ContainedSideLocId(side, node)];
515 TPZShapeTriang::SideShapeOrder(6,locid, order, locshapeorders);
517 for (
int il = 0; il<nshape; il++)
519 shapeorders(il, 0) = locshapeorders(il, 0);
520 shapeorders(il, 1) = locshapeorders(il, 1);
521 shapeorders(il, 2) = locshapeorders(il, 2);
528 for(i=0;i<order-3;i++) {
529 sum = (i+1)*(i+2) / 2;
534 if (shapeorders.
Rows() != nshape) {
539 for (
int i=0;i<ord;i++) {
540 for (
int j=0;j<ord;j++) {
541 for (
int k=0;k<ord;k++) {
547 shapeorders(count,0) = 4 + soma;
548 shapeorders(count,1) = 4 + soma;
549 shapeorders(count,2) = 4 + soma;
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.
static void ShapeInternal(TPZVec< REAL > &x, int ord, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, int transformation_index)
Computes the values of the orthogonal shapefunctions before multiplying them by the corner shapefunct...
groups all classes dedicated to the computation of shape functions
Contains TPZShapeLinear class which implements the shape functions of a linear one-dimensional elemen...
int Zero() override
Makes Zero all the elements.
int64_t size() const
Returns the number of elements of the vector.
void Push(const T object)
Pushes a copy of the object on the stack.
#define DebugStop()
Returns a message to user put a breakpoint in.
Free store vector implementation.
void Shape(TPZVec< REAL > &pt, TPZVec< int > orders, TPZVec< TPZTransform< REAL > > &transvec, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi)
Implements generic class which holds a matrix of objects. Matrix.
static void ShapeInternal(TPZVec< REAL > &x, int order, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, int triangle_transformation_index)
Compute the internal functions of the triangle shape function at a point.
int64_t Cols() const
Returns number of cols.
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
Contains TPZShapeTriang class which implements the shape functions of a triangular element...
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
#define PZError
Defines the output device to error messages and the DebugStop() function.