18 REAL TPZShapeCube::gRibTrans3dCube1d[12][3] = {
19 {1., 0.,0.} , { 0.,1.,0.} , {-1., 0.,0.} ,
20 {0.,-1.,0.} , { 0.,0.,1.} , { 0., 0.,1.} ,
21 {0., 0.,1.} , { 0.,0.,1.} , { 1., 0.,0.} ,
22 {0., 1.,0.} , {-1.,0.,0.} , { 0.,-1.,0.}
25 REAL TPZShapeCube::gFaceTrans3dCube2d[6][2][3] = {
26 { { 1.,0.,0.},{0.,1.,0.} },
27 { { 1.,0.,0.},{0.,0.,1.} },
28 { { 0.,1.,0.},{0.,0.,1.} },
29 { { 1.,0.,0.},{0.,0.,1.} },
30 { { 0.,1.,0.},{0.,0.,1.} },
31 { { 1.,0.,0.},{0.,1.,0.} }
36 REAL x[2],
dx[2],y[2],dy[2],z[2],dz[2];
50 phi(0,0) = x[0]*y[0]*z[0];
51 phi(1,0) = x[1]*y[0]*z[0];
52 phi(2,0) = x[1]*y[1]*z[0];
53 phi(3,0) = x[0]*y[1]*z[0];
54 phi(4,0) = x[0]*y[0]*z[1];
55 phi(5,0) = x[1]*y[0]*z[1];
56 phi(6,0) = x[1]*y[1]*z[1];
57 phi(7,0) = x[0]*y[1]*z[1];
58 dphi(0,0) = dx[0]*y[0]*z[0];
59 dphi(1,0) = x[0]*dy[0]*z[0];
60 dphi(2,0) = x[0]*y[0]*dz[0];
61 dphi(0,1) = dx[1]*y[0]*z[0];
62 dphi(1,1) = x[1]*dy[0]*z[0];
63 dphi(2,1) = x[1]*y[0]*dz[0];
64 dphi(0,2) = dx[1]*y[1]*z[0];
65 dphi(1,2) = x[1]*dy[1]*z[0];
66 dphi(2,2) = x[1]*y[1]*dz[0];
67 dphi(0,3) = dx[0]*y[1]*z[0];
68 dphi(1,3) = x[0]*dy[1]*z[0];
69 dphi(2,3) = x[0]*y[1]*dz[0];
70 dphi(0,4) = dx[0]*y[0]*z[1];
71 dphi(1,4) = x[0]*dy[0]*z[1];
72 dphi(2,4) = x[0]*y[0]*dz[1];
73 dphi(0,5) = dx[1]*y[0]*z[1];
74 dphi(1,5) = x[1]*dy[0]*z[1];
75 dphi(2,5) = x[1]*y[0]*dz[1];
76 dphi(0,6) = dx[1]*y[1]*z[1];
77 dphi(1,6) = x[1]*dy[1]*z[1];
78 dphi(2,6) = x[1]*y[1]*dz[1];
79 dphi(0,7) = dx[0]*y[1]*z[1];
80 dphi(1,7) = x[0]*dy[1]*z[1];
81 dphi(2,7) = x[0]*y[1]*dz[1];
94 for(is=8; is<20; is++)
97 is1 = ContainedSideLocId(is,0);
98 is2 = ContainedSideLocId(is,1);
99 phi(is,0) = phi(is1,0)*phi(is2,0);
100 dphi(0,is) = dphi(0,is1)*phi(is2,0)+phi(is1,0)*dphi(0,is2);
101 dphi(1,is) = dphi(1,is1)*phi(is2,0)+phi(is1,0)*dphi(1,is2);
102 dphi(2,is) = dphi(2,is1)*phi(is2,0)+phi(is1,0)*dphi(2,is2);
105 for(is=20; is<26; is++)
108 is1 = ContainedSideLocId(is,0);
109 is2 = ContainedSideLocId(is,2);
110 phi(is,0) = phi(is1,0)*phi(is2,0);
111 dphi(0,is) = dphi(0,is1)*phi(is2,0)+phi(is1,0)*dphi(0,is2);
112 dphi(1,is) = dphi(1,is1)*phi(is2,0)+phi(is1,0)*dphi(1,is2);
113 dphi(2,is) = dphi(2,is1)*phi(is2,0)+phi(is1,0)*dphi(2,is2);
116 for(is=26; is<27; is++)
121 phi(is,0) = phi(is1,0)*phi(is2,0);
122 dphi(0,is) = dphi(0,is1)*phi(is2,0)+phi(is1,0)*dphi(0,is2);
123 dphi(1,is) = dphi(1,is1)*phi(is2,0)+phi(is1,0)*dphi(1,is2);
124 dphi(2,is) = dphi(2,is1)*phi(is2,0)+phi(is1,0)*dphi(2,is2);
128 for(is=8; is<27; is++)
131 HigherDimensionSides(is,highsides);
135 int hs = highsides[
h];
136 phi(is,0) += phi(hs,0);
137 dphi(0,is) += dphi(0,hs);
138 dphi(1,is) += dphi(1,hs);
139 dphi(2,is) += dphi(2,hs);
141 int dim = SideDimension(is);
142 int mult = (dim == 1) ? 4 : (dim == 2) ? 16 : (dim ==3) ? 64 : 0;
153 ShapeCorner(pt,phi,dphi);
156 for(is=NCornerNodes; is<NSides; is++)
if(order[is-NCornerNodes] > 1) linear =
false;
160 for(is=0; is<NCornerNodes; is++)
162 phiblend(is,0) = phi(is,0);
163 for(d=0; d<Dimension; d++)
165 dphiblend(d,is) = dphi(d,is);
168 ShapeGenerating(pt,phiblend,dphiblend);
171 for (
int rib = 0; rib < 12; rib++) {
173 ProjectPoint3dCubeToRib(rib,pt,outval);
177 id0 = SideNodes[rib][0];
178 id1 = SideNodes[rib][1];
181 REAL store1[20],store2[60];
182 int nshape = order[rib]-1;
186 TPZShapeLinear::ShapeInternal(outvalvec,order[rib],phin,dphin,TPZShapeLinear::GetTransformId1d(ids));
187 TransformDerivativeFromRibToCube(rib,nshape,dphin);
188 for (
int i = 0; i < nshape; i++) {
189 phi(shape,0) = phiblend(rib+8,0)*phin(i,0);
190 for(
int xj=0;xj<3;xj++) {
191 dphi(xj,shape) = dphiblend(xj ,rib+8) * phin( i, 0) +
192 phiblend(rib+8, 0 ) * dphin(xj,i);
198 for (
int face = 0; face < 6; face++) {
201 ProjectPoint3dCubeToFace(face,pt,outval);
202 REAL store1[20],store2[60];
204 ord1 = order[12+face];
207 if(ord1<2 || ord2<2)
continue;
208 int ord = (ord1-1)*(ord2-1);
212 int ordin = (ord1 > ord2) ? ord1 : ord2;
218 for(i=0;i<4;i++) ids[i] =
id[FaceNodes[face][i]];
221 TPZShapeQuad::ShapeInternal(outval,ord1-2,phin,dphin,TPZShapeQuad::GetTransformId2dQ(ids));
222 TransformDerivativeFromFaceToCube(face,ord,dphin);
224 phi(shape,0) = phiblend(face+20,0)*phin(i,0);
225 for(
int xj=0;xj<3;xj++) {
226 dphi(xj,shape) = dphiblend(xj,face+20) * phin(i ,0) +
227 phiblend(face+20, 0)* dphin(xj,i);
233 REAL store1[20],store2[60];
234 int ordmin1 = (order[18]-1);
235 int ord = ordmin1*ordmin1*ordmin1;
239 ShapeInternal(pt,order[18],phin,dphin);
240 for(
int i=0;i<ord;i++) {
241 phi(shape,0) = phiblend(26,0)*phin(i,0);
242 for(
int xj=0;xj<3;xj++) {
243 dphi(xj,shape) = dphiblend(xj,26) * phin(i ,0) +
244 phiblend(26, 0)*dphin(xj,i);
251 if(side<0 || side>26)
PZError <<
"TPZCompElC3d::SideShapeFunction. Bad paramenter side.\n";
252 else if(side==26)
Shape(pt,
id,order,phi,dphi);
262 Shape(pt,
id,order,phi,dphi);
270 int64_t nsides = TPZShapeCube::NSides;
271 int nshape = NCornerNodes;
274 for (
int side = 0; side < nsides; side++)
278 if(side >= NCornerNodes) nshape = NConnectShapeF(side,order[side-NCornerNodes]);
280 if(side >= NCornerNodes) sideorder = order[side-NCornerNodes];
283 SideShapeOrder(side,
id, sideorder, locshapeorders);
285 int nlin = locshapeorders.
Rows();
286 int ncol = locshapeorders.
Cols();
288 for (
int il = 0; il<nlin; il++)
290 for (
int jc = 0; jc<ncol; jc++)
292 shapeorders(linha, jc) = locshapeorders(il, jc);
305 if (shapeorders.
Rows() != 1)
309 shapeorders(0,0) = 1;
310 shapeorders(0,1) = 0;
311 shapeorders(0,2) = 0;
315 int nsei = (order-1)*(order-1)*(order-1);
316 if (shapeorders.
Rows() != nsei) {
320 for (
int i=2; i<order+1; i++) {
321 for (
int j=2; j<order+1; j++) {
322 for (
int k=2; k<order+1; k++) {
326 shapeorders(count,0) = a;
327 shapeorders(count,1) = b;
328 shapeorders(count,2) = c;
336 else if (side>7 && side<20)
338 int nshape = order-1;
339 if (shapeorders.
Rows() != nshape)
343 for (
int ioy = 0; ioy < order-1; ioy++)
345 shapeorders(ioy,0) = ioy+2;
351 if (shapeorders.
Rows() != (order-1)*(order-1))
356 LowerDimensionSides(side, lowersides);
357 lowersides.
Push(side);
361 int nnodes = NSideNodes(side);
364 for (
int node=0; node<locid.
size(); node++) {
365 locid[node] =
id[ContainedSideLocId(side, node)];
368 int nshape = (order-1)*(order-1);
372 TPZShapeQuad::SideShapeOrder(8,locid, order, locshapeorders);
378 for (
int il = 0; il<nshape; il++)
380 shapeorders(il, 0) = locshapeorders(il, 0);
381 shapeorders(il, 1) = locshapeorders(il, 1);
382 shapeorders(il, 2) = locshapeorders(il, 2);
390 if((order-1) < 1)
return;
392 int nshape = ord*ord*ord;
395 REAL store1[20],store2[20],store3[20],store4[20],store5[20],store6[20];
397 dphi0(1,ord),dphi1(1,ord),dphi2(1,ord);
398 TPZShapeLinear::fOrthogonal(x[0],ord,phi0,dphi0);
399 TPZShapeLinear::fOrthogonal(x[1],ord,phi1,dphi1);
400 TPZShapeLinear::fOrthogonal(x[2],ord,phi2,dphi2);
401 for (
int i=0;i<ord;i++) {
402 for (
int j=0;j<ord;j++) {
403 for (
int k=0;k<ord;k++) {
404 int index = ord*(ord*i+j)+k;
405 phi(index,0) = phi0(i,0)* phi1(j,0)* phi2(k,0);
406 dphi(0,index) = dphi0(0,i)* phi1(j,0)* phi2(k,0);
407 dphi(1,index) = phi0(i,0)*dphi1(0,j)* phi2(k,0);
408 dphi(2,index) = phi0(i,0)* phi1(j,0)*dphi2(0,k);
417 if (side < 8 || side > 26) {
451 ShapeInternal(x, order, phi, dphi);
455 std::cout <<
"Wrong side parameter side " << side << std::endl;
463 void TPZShapeCube::TransformDerivativeFromRibToCube(
int rib,
int num,
TPZFMatrix<REAL> &dphi) {
464 for (
int j = 0;j<num;j++) {
465 dphi(2,j) = gRibTrans3dCube1d[rib][2]*dphi(0,j);
466 dphi(1,j) = gRibTrans3dCube1d[rib][1]*dphi(0,j);
467 dphi(0,j) = gRibTrans3dCube1d[rib][0]*dphi(0,j);
471 void TPZShapeCube::ProjectPoint3dCubeToRib(
int side,
TPZVec<REAL> &in, REAL &outval) {
472 outval = gRibTrans3dCube1d[side][0]*in[0]+gRibTrans3dCube1d[side][1]*in[1]+gRibTrans3dCube1d[side][2]*in[2];
476 outval[0] = gFaceTrans3dCube2d[face][0][0]*in[0]+gFaceTrans3dCube2d[face][0][1]*in[1]+gFaceTrans3dCube2d[face][0][2]*in[2];
477 outval[1] = gFaceTrans3dCube2d[face][1][0]*in[0]+gFaceTrans3dCube2d[face][1][1]*in[1]+gFaceTrans3dCube2d[face][1][2]*in[2];
480 void TPZShapeCube::TransformDerivativeFromFaceToCube(
int rib,
int num,
TPZFMatrix<REAL> &dphi) {
482 for (
int j = 0;j<num;j++) {
483 dphi(2,j) = gFaceTrans3dCube2d[rib][0][2]*dphi(0,j)+gFaceTrans3dCube2d[rib][1][2]*dphi(1,j);
484 REAL dphi1j = dphi(1,j);
485 dphi(1,j) = gFaceTrans3dCube2d[rib][0][1]*dphi(0,j)+gFaceTrans3dCube2d[rib][1][1]*dphi(1,j);
486 dphi(0,j) = gFaceTrans3dCube2d[rib][0][0]*dphi(0,j)+gFaceTrans3dCube2d[rib][1][0]*dphi1j;
490 void TPZShapeCube::ProjectPoint3dCubeSide(
int side,
TPZVec<REAL> &in, REAL &out) {
492 out = gRibTrans3dCube1d[side][0]*in[0]+gRibTrans3dCube1d[side][1]*in[1]+gRibTrans3dCube1d[side][2]*in[2];
497 out[0] = gFaceTrans3dCube2d[face][0][0]*in[0]+gFaceTrans3dCube2d[face][0][1]*in[1]+gFaceTrans3dCube2d[face][0][2]*in[2];
498 out[1] = gFaceTrans3dCube2d[face][1][0]*in[0]+gFaceTrans3dCube2d[face][1][1]*in[1]+gFaceTrans3dCube2d[face][1][2]*in[2];
501 int TPZShapeCube::NConnectShapeF(
int side,
int order){
503 if(side<20)
return (order-1);
505 return ((order-1)*(order-1));
508 return ((order-1)*(order-1)*(order-1));
510 PZError <<
"TPZShapeCube::NConnectShapeF, bad parameter side " << side << endl;
515 int in,
res = NCornerNodes;
516 for(in=NCornerNodes;in<NSides;in++) res += NConnectShapeF(in,order[in-NCornerNodes]);
536 ShapeCornerCube(pt,phi);
540 for (
int rib = 0; rib < 12; rib++) {
541 FADREAL outval(ndim, 0.0);
542 ProjectPoint3dCubeToRib(rib,pt,outval);
545 id0 = SideNodes[rib][0];
546 id1 = SideNodes[rib][1];
550 int ordin = order[rib]-1;
555 TPZShapeLinear::ShapeInternal(outval,ordin,phin,TPZShapeLinear::GetTransformId1d(ids));
557 for (
int i = 0; i < ordin; i++) {
559 phi[shape] = phi[id0] * phi[id1] * phin[i];
570 for (
int face = 0; face < 6; face++) {
574 ProjectPoint3dCubeToFace(face,pt,outval);
577 ord1 = order[12+face];
580 if(ord1<2 || ord2<2)
continue;
581 int ord = (ord1-1)*(ord2-1);
586 int ordin = (ord1 > ord2) ? ord1 : ord2;
591 for(i=0;i<4;i++) ids[i] =
id[FaceNodes[face][i]];
592 id0 = ShapeFaceId[face][0];
593 id1 = ShapeFaceId[face][1];
594 TPZShapeQuad::Shape2dQuadInternal(outval,ord1-2,phin,TPZShapeQuad::GetTransformId2dQ(ids));
598 phi[shape] = phi[id0] * phi[id1] * phin[i];
610 int ordmin1 = (order[18]-1);
611 int ord = ordmin1*ordmin1*ordmin1;
616 Shape3dCubeInternal(pt,ordmin1,phin);
617 for(
int i=0;i<ord;i++) {
619 phi[shape] = phi[0] * phi[6] * phin[i];
627 FADREAL x[2], y[2], z[2];
629 x[0] = (REAL(1.)-pt[0])/REAL(2.);
630 x[1] = (REAL(1.)+pt[0])/REAL(2.);
631 y[0] = (REAL(1.)-pt[1])/REAL(2.);
632 y[1] = (REAL(1.)+pt[1])/REAL(2.);
633 z[0] = (REAL(1.)-pt[2])/REAL(2.);
634 z[1] = (REAL(1.)+pt[2])/REAL(2.);
636 phi[0] = x[0]*y[0]*z[0];
637 phi[1] = x[1]*y[0]*z[0];
638 phi[2] = x[1]*y[1]*z[0];
639 phi[3] = x[0]*y[1]*z[0];
640 phi[4] = x[0]*y[0]*z[1];
641 phi[5] = x[1]*y[0]*z[1];
642 phi[6] = x[1]*y[1]*z[1];
643 phi[7] = x[0]*y[1]*z[1];
646 void TPZShapeCube::ProjectPoint3dCubeToRib(
int side,
TPZVec<FADREAL> &in, FADREAL &outval)
648 outval = gRibTrans3dCube1d[side][0]*in[0]+gRibTrans3dCube1d[side][1]*in[1]+gRibTrans3dCube1d[side][2]*in[2];
652 outval[0] = gFaceTrans3dCube2d[face][0][0]*in[0]+gFaceTrans3dCube2d[face][0][1]*in[1]+gFaceTrans3dCube2d[face][0][2]*in[2];
653 outval[1] = gFaceTrans3dCube2d[face][1][0]*in[0]+gFaceTrans3dCube2d[face][1][1]*in[1]+gFaceTrans3dCube2d[face][1][2]*in[2];
660 if(order < 1)
return;
662 order = order*order*order;
663 phi.
Resize(order, FADREAL(ndim, 0.0));
665 phi1(20, FADREAL(ndim, 0.0)),
666 phi2(20, FADREAL(ndim, 0.0));
667 TPZShapeLinear::FADfOrthogonal(x[0],ord,phi0);
668 TPZShapeLinear::FADfOrthogonal(x[1],ord,phi1);
669 TPZShapeLinear::FADfOrthogonal(x[2],ord,phi2);
670 for (
int i=0;i<ord;i++) {
671 for (
int j=0;j<ord;j++) {
672 for (
int k=0;k<ord;k++) {
673 int index = ord*(ord*i+j)+k;
675 phi[index] = phi0[i] * phi1[j] * phi2[k];
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
clarg::argBool h("-h", "help message", false)
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.
static int highsides[27][7]
For each side was stored the sides connected with it but of the higher dimension. ...
int Zero() override
Makes Zero all the elements.
int64_t size() const
Returns the number of elements of the vector.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
void Push(const T object)
Pushes a copy of the object on the stack.
expr_ dx(i) *cos(expr_.val())
#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)
Contains TPZShapePoint class which implements the shape function associated with a point...
static void ShapeInternal(TPZVec< REAL > &x, int order, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, int quad_transformation_index)
Compute the internal functions of the quadrilateral shape function at a point.
Implements generic class which holds a matrix of objects. Matrix.
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
int64_t NElements() const
Returns the number of elements of the vector.
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
Contains TPZShapeQuad class which implements the shape functions of a quadrilateral 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.