21 REAL TPZShapePrism::gRibTrans3dPrisma1d[9][3] = {
22 { 2., 1.,0.} , {-1., 1.,0.} ,
23 {-1.,-2.,0.} , { 0., 0.,1.} ,
24 { 0., 0.,1.} , { 0., 0.,1.} ,
25 { 2., 1.,0.} , {-1., 1.,0.} ,
29 REAL TPZShapePrism::gRibSum3dPrisma1d[9] = {-1.,0.,1.,0.,0.,0.,-1.,0.,1.};
32 REAL TPZShapePrism::gFaceTrans3dPrisma2d[5][2][3] = {
33 { { 2., 0., 0.},{ 0., 2., 0.} },
34 { { 2., 0., 0.},{ 0., 0., 1.} },
35 { {-1., 1., 0.},{ 0., 0., 1.} },
36 { { 0., 2., 0.},{ 0., 0., 1.} },
37 { { 2., 0., 0.},{ 0., 2., 0.} }
40 REAL TPZShapePrism::gFaceSum3dPrisma2d[5][2] = { {-1.,-1.},{-1.,0.},{0.,0.},{-1.,0.},{-1.,-1.} };
43 phi(0,0) = .5*(1.-pt[0]-pt[1])*(1.-pt[2]);
44 phi(1,0) = .5*pt[0]*(1.-pt[2]);
45 phi(2,0) = .5*pt[1]*(1.-pt[2]);
46 phi(3,0) = .5*(1.-pt[0]-pt[1])*(1.+pt[2]);
47 phi(4,0) = .5*pt[0]*(1.+pt[2]);
48 phi(5,0) = .5*pt[1]*(1.+pt[2]);
50 dphi(0,0) = -.5*(1.-pt[2]);
51 dphi(1,0) = -.5*(1.-pt[2]);
52 dphi(2,0) = -.5*(1.-pt[0]-pt[1]);
54 dphi(0,1) = .5*(1.-pt[2]);
56 dphi(2,1) = -.5*pt[0];
59 dphi(1,2) = .5*(1.-pt[2]);
60 dphi(2,2) = -.5*pt[1];
62 dphi(0,3) = -.5*(1.+pt[2]);
63 dphi(1,3) = -.5*(1.+pt[2]);
64 dphi(2,3) = .5*(1.-pt[0]-pt[1]);
66 dphi(0,4) = .5*(1.+pt[2]);
71 dphi(1,5) = .5*(1.+pt[2]);
76 phi(0,0) = .5*(1.-pt[0]-pt[1])*(1.-pt[2]);
77 phi(1,0) = .5*pt[0]*(1.-pt[2]);
78 phi(2,0) = .5*pt[1]*(1.-pt[2]);
79 phi(3,0) = .5*(1.-pt[0]-pt[1])*(1.+pt[2]);
80 phi(4,0) = .5*pt[0]*(1.+pt[2]);
81 phi(5,0) = .5*pt[1]*(1.+pt[2]);
83 dphi(0,0) = -.5*(1.-pt[2]);
84 dphi(1,0) = -.5*(1.-pt[2]);
85 dphi(2,0) = -.5*(1.-pt[0]-pt[1]);
87 dphi(0,1) = .5*(1.-pt[2]);
89 dphi(2,1) = -.5*pt[0];
92 dphi(1,2) = .5*(1.-pt[2]);
93 dphi(2,2) = -.5*pt[1];
95 dphi(0,3) = -.5*(1.+pt[2]);
96 dphi(1,3) = -.5*(1.+pt[2]);
97 dphi(2,3) = .5*(1.-pt[0]-pt[1]);
99 dphi(0,4) = .5*(1.+pt[2]);
101 dphi(2,4) = .5*pt[0];
104 dphi(1,5) = .5*(1.+pt[2]);
105 dphi(2,5) = .5*pt[1];
119 for(is=6; is<NSides; is++)
121 int nsnodes = NSideNodes(is);
126 int is1 = SideNodeLocId(is,0);
127 int is2 = SideNodeLocId(is,1);
128 phi(is,0) = phi(is1,0)*phi(is2,0);
129 dphi(0,is) = dphi(0,is1)*phi(is2,0)+phi(is1,0)*dphi(0,is2);
130 dphi(1,is) = dphi(1,is1)*phi(is2,0)+phi(is1,0)*dphi(1,is2);
131 dphi(2,is) = dphi(2,is1)*phi(is2,0)+phi(is1,0)*dphi(2,is2);
145 phi(is,0) = (phi(is0,0)+phi(is3,0))*(phi(is1,0)+phi(is4,0))*phi(is2,0);
150 (dphi(d,is0)+dphi(d,is3))*(phi(is1,0)+phi(is4,0))*phi(is2,0) +
151 (phi(is0,0)+phi(is3,0))*(dphi(d,is1)+dphi(d,is4))*phi(is2,0) +
152 (phi(is0,0)+phi(is3,0))*(phi(is1,0)+phi(is4,0))*dphi(d,is2);
158 int is1 = SideNodeLocId(is,0);
159 int is2 = SideNodeLocId(is,2);
160 phi(is,0) = phi(is1,0)*phi(is2,0);
161 dphi(0,is) = dphi(0,is1)*phi(is2,0)+phi(is1,0)*dphi(0,is2);
162 dphi(1,is) = dphi(1,is1)*phi(is2,0)+phi(is1,0)*dphi(1,is2);
163 dphi(2,is) = dphi(2,is1)*phi(is2,0)+phi(is1,0)*dphi(2,is2);
172 phi(is,0) = phi(is1,0)*phi(is2,0)*(phi(is3,0)+phi(is4,0));
173 dphi(0,is) = dphi(0,is1)*phi(is2,0)*(phi(is3,0)+phi(is4,0))+phi(is1,0)*dphi(0,is2)*(phi(is3,0)+phi(is4,0))+phi(is1,0)*phi(is2,0)*(dphi(0,is3)+dphi(0,is4));
174 dphi(1,is) = dphi(1,is1)*phi(is2,0)*(phi(is3,0)+phi(is4,0))+phi(is1,0)*dphi(1,is2)*(phi(is3,0)+phi(is4,0))+phi(is1,0)*phi(is2,0)*(dphi(1,is3)+dphi(1,is4));
175 dphi(2,is) = dphi(2,is1)*phi(is2,0)*(phi(is3,0)+phi(is4,0))+phi(is1,0)*dphi(2,is2)*(phi(is3,0)+phi(is4,0))+phi(is1,0)*phi(is2,0)*(dphi(2,is3)+dphi(2,is4));
183 for(is=6; is<NSides; is++)
186 HigherDimensionSides(is,highsides);
190 int hs = highsides[
h];
191 if(NSideNodes(hs) != 4)
continue;
192 phi(is,0) += phi(hs,0);
193 dphi(0,is) += dphi(0,hs);
194 dphi(1,is) += dphi(1,hs);
195 dphi(2,is) += dphi(2,hs);
198 REAL mult[] = {1.,1.,1.,1.,1.,1.,4.,4.,4.,4.,4.,4.,4.,4.,4.,27.,16.,16.,16.,27.,8.};
199 for(is=6;is<NSides; is++)
201 phi(is,0) *= mult[is];
202 dphi(0,is) *= mult[is];
203 dphi(1,is) *= mult[is];
204 dphi(2,is) *= mult[is];
211 CornerShape(pt,phi,dphi);
214 for(is=NCornerNodes; is<NSides; is++)
if(order[is-NCornerNodes] > 1) linear =
false;
218 for(is=0; is<NCornerNodes; is++)
220 phiblend(is,0) = phi(is,0);
221 for(d=0; d<Dimension; d++)
223 dphiblend(d,is) = dphi(d,is);
226 ShapeGenerating(pt,phiblend,dphiblend);
230 for (
int rib = 0; rib < 9; rib++) {
232 ProjectPoint3dPrismaToRib(rib,pt,outval);
236 id0 = SideNodes[rib][0];
237 id1 = SideNodes[rib][1];
240 REAL store1[20],store2[60];
241 int nshape = order[rib]-1;
245 TPZShapeLinear::ShapeInternal(outvalvec,order[rib],phin,dphin,TPZShapeLinear::GetTransformId1d(ids));
246 TransformDerivativeFromRibToPrisma(rib,nshape,dphin);
247 for (
int i = 0; i < nshape; i++) {
248 phi(shape,0) = phiblend(rib+6,0)*phin(i,0);
249 for(
int xj=0;xj<3;xj++) {
250 dphi(xj,shape) = dphiblend(xj ,rib+6) * phin( i, 0) +
251 phiblend(rib+6, 0 ) * dphin(xj,i);
258 for (
int face = 0; face < 5; face++) {
260 if((face==0 || face==4) && order[face+9]==2)
continue;
262 ProjectPoint3dPrismaToFace(face,pt,outval);
263 REAL store1[20],store2[60];
265 ord1 = order[face+9];
268 if((face==0 || face==4) && ord1<3)
continue;
270 if(face && face<4) ordin = (ord1-1)*(ord1-1);
271 else ordin = (ord1-2)*(ord1-1)/2;
278 if(face ==0 || face == 4)
for(i=0;i<3;i++) ids[i] =
id[FaceNodes[face][i]];
279 else for(i=0;i<4;i++) ids[i] =
id[FaceNodes[face][i]];
285 transid = TPZShapeQuad::GetTransformId2dQ(ids);
286 TPZShapeQuad::ShapeInternal(outval,ord1-2,phin,dphin,transid);
289 transid = TPZShapeTriang::GetTransformId2dT(ids);
290 outval[0] = (outval[0]+1.)/2.;
291 outval[1] = (outval[1]+1.)/2.;
292 TPZShapeTriang::ShapeInternal(outval,ord1-2,phin,dphin,transid);
293 int c = dphin.
Cols();
300 TransformDerivativeFromFaceToPrisma(face,ordin,dphin);
301 for(i=0;i<ordin;i++) {
302 phi(shape,0) = phiblend(face+15,0)*phin(i,0);
303 for(
int xj=0;xj<3;xj++) {
304 dphi(xj,shape) = dphiblend(xj,face+15) * phin(i ,0) +
305 phiblend(face+15, 0) * dphin(xj,i);
310 if(order[14]<3)
return;
313 ord = NConnectShapeF(20,order[20-NCornerNodes]);
317 ShapeInternal(pt,order[14],phin,dphin);
318 for(
int i=0;i<ord;i++) {
319 phi(shape,0) = phiblend(NSides-1,0)*phin(i,0);
320 for(
int xj=0;xj<3;xj++) {
321 dphi(xj,shape) = dphiblend(xj,NSides-1)* phin(i ,0) +
322 phiblend(NSides-1, 0)* dphin(xj,i);
332 if(side<0 || side>20)
PZError <<
"TPZCompElPr3d::SideShapeFunction. Bad paramenter side.\n";
334 Shape(pt,
id,order,phi,dphi);
337 }
else if(side < 15) {
339 }
else if(side == 15 || side == 19) {
350 int64_t nsides = TPZShapePrism::NSides;
354 for (
int side = 0; side < nsides; side++)
358 if(side >= NCornerNodes) nshape = NConnectShapeF(side,order[side-NCornerNodes]);
360 if(side >= NCornerNodes) sideorder = order[side-NCornerNodes];
363 SideShapeOrder(side,
id, sideorder, locshapeorders);
365 int nlin = locshapeorders.
Rows();
366 int ncol = locshapeorders.
Cols();
368 for (
int il = 0; il<nlin; il++)
370 for (
int jc = 0; jc<ncol; jc++)
372 shapeorders(linha, jc) = locshapeorders(il, jc);
386 if (shapeorders.
Rows() != 1)
390 shapeorders(0,0) = 1;
391 shapeorders(0,1) = 0;
392 shapeorders(0,2) = 0;
394 else if (side>5 && side<15)
396 int nshape = order-1;
397 if (shapeorders.
Rows() != nshape)
401 for (
int ioy = 0; ioy < order-1; ioy++)
403 shapeorders(ioy,0) = ioy+2;
406 else if (side == 15||side == 19)
408 int nshape = (order-2)*(order-1)/2;
409 if (shapeorders.
Rows() != nshape)
414 LowerDimensionSides(side, lowersides);
415 lowersides.
Push(side);
419 int nnodes = NSideNodes(side);
422 for (
int node=0; node<locid.
size(); node++) {
423 locid[node] =
id[ContainedSideLocId(side, node)];
429 TPZShapeTriang::SideShapeOrder(6,locid, order, locshapeorders);
435 for (
int il = 0; il<nshape; il++)
437 shapeorders(il, 0) = locshapeorders(il, 0);
438 shapeorders(il, 1) = locshapeorders(il, 1);
439 shapeorders(il, 2) = locshapeorders(il, 2);
444 else if (side >= 16 && side <=18)
446 if (shapeorders.
Rows() != (order-1)*(order-1))
451 LowerDimensionSides(side, lowersides);
452 lowersides.
Push(side);
456 int nnodes = NSideNodes(side);
459 for (
int node=0; node<locid.
size(); node++) {
460 locid[node] =
id[ContainedSideLocId(side, node)];
463 int nshape = (order-1)*(order-1);
467 TPZShapeQuad::SideShapeOrder(8,locid, order, locshapeorders);
473 for (
int il = 0; il<nshape; il++)
475 shapeorders(il, 0) = locshapeorders(il, 0);
476 shapeorders(il, 1) = locshapeorders(il, 1);
477 shapeorders(il, 2) = locshapeorders(il, 2);
483 int nshape = (order-2)*(order-1)*(order-1)/2;
484 if (shapeorders.
Rows() != nshape) {
488 int ord1 = order - 2;
489 int ord2 = order - 1;
490 for (
int i=0; i<ord1; i++) {
491 for (
int j=0; j<ord1; j++) {
492 for (
int k=0; k<ord2; k++) {
497 if ( ( (a+b)<ord1 ) && (c < ord2) )
499 shapeorders(count,0) = 3 + maxAB;
500 shapeorders(count,1) = 3 + maxAB;
501 shapeorders(count,2) = 2 + c;
539 if(order < 3)
return;
544 dphi0(1,ord1),dphi1(1,ord1),dphi2(1,ord2);
545 TPZShapeLinear::fOrthogonal(2.*x[0]-1.,ord1,phi0,dphi0);
546 TPZShapeLinear::fOrthogonal(2.*x[1]-1.,ord1,phi1,dphi1);
547 TPZShapeLinear::fOrthogonal(x[2],ord2,phi2,dphi2);
549 for (
int i=0;i<ord1;i++) {
550 for (
int j=0;j<ord1;j++) {
551 for (
int k=0;k<ord2;k++) {
552 if( i+j < ord1 && k < ord2) {
553 phi(index,0) = phi0(i,0)* phi1(j,0)* phi2(k,0);
554 dphi(0,index) = 2.*dphi0(0,i)* phi1(j,0)* phi2(k,0);
555 dphi(1,index) = 2.*phi0(i,0)*dphi1(0,j)* phi2(k,0);
556 dphi(2,index) = phi0(i,0)* phi1(j,0)*dphi2(0,k);
564 void TPZShapePrism::ShapeInternal(
int side,
TPZVec<REAL> &x,
int order,
566 if (side < 6 || side > 20) {
605 ShapeInternal(x, order, phi, dphi);
609 std::cout <<
"Wrong side parameter side " << side << std::endl;
617 void TPZShapePrism::TransformDerivativeFromRibToPrisma(
int rib,
int num,
TPZFMatrix<REAL> &dphi) {
618 for (
int j = 0;j<num;j++) {
619 dphi(2,j) = gRibTrans3dPrisma1d[rib][2]*dphi(0,j);
620 dphi(1,j) = gRibTrans3dPrisma1d[rib][1]*dphi(0,j);
621 dphi(0,j) = gRibTrans3dPrisma1d[rib][0]*dphi(0,j);
625 void TPZShapePrism::TransformDerivativeFromFaceToPrisma(
int face,
int num,
TPZFMatrix<REAL> &dphi) {
626 for (
int j = 0;j<num;j++) {
627 dphi(2,j) = gFaceTrans3dPrisma2d[face][0][2]*dphi(0,j)+gFaceTrans3dPrisma2d[face][1][2]*dphi(1,j);
628 REAL dphi1j = dphi(1,j);
629 dphi(1,j) = gFaceTrans3dPrisma2d[face][0][1]*dphi(0,j)+gFaceTrans3dPrisma2d[face][1][1]*dphi(1,j);
630 dphi(0,j) = gFaceTrans3dPrisma2d[face][0][0]*dphi(0,j)+gFaceTrans3dPrisma2d[face][1][0]*dphi1j;
634 void TPZShapePrism::TransformDerivativeFace3dPrisma(
int transid,
int face,
int num,
TPZFMatrix<REAL> &in) {
635 if (face==0 || face==4) TPZShapeTriang::TransformDerivative2dT(transid,num,in);
636 else TPZShapeQuad::TransformDerivative2dQ(transid,num,in);
641 void TPZShapePrism::ProjectPoint3dPrismaToRib(
int rib,
TPZVec<REAL> &in, REAL &outval) {
642 outval = gRibTrans3dPrisma1d[rib][0]*in[0]+gRibTrans3dPrisma1d[rib][1]*in[1]+gRibTrans3dPrisma1d[rib][2]*in[2]+gRibSum3dPrisma1d[rib];
647 outval[0] = gFaceTrans3dPrisma2d[face][0][0]*in[0]+gFaceTrans3dPrisma2d[face][0][1]*in[1]+gFaceTrans3dPrisma2d[face][0][2]*in[2]+gFaceSum3dPrisma2d[face][0];
648 outval[1] = gFaceTrans3dPrisma2d[face][1][0]*in[0]+gFaceTrans3dPrisma2d[face][1][1]*in[1]+gFaceTrans3dPrisma2d[face][1][2]*in[2]+gFaceSum3dPrisma2d[face][1];
653 if (face==0 || face==4) TPZShapeTriang::TransformPoint2dT(transid,in,out);
654 else TPZShapeQuad::TransformPoint2dQ(transid,in,out);
657 int TPZShapePrism::NConnectShapeF(
int side,
int order) {
659 if(side<15)
return (order-1);
660 if(side==15 || side==19) {
661 return ((order-2)*(order-1)/2);
663 if(side>15 && side<19) {
664 return ((order-1)*(order-1));
667 return ((order-2)*(order-1)*(order-1)/2);
669 PZError <<
"TPZShapePrism::NConnectShapeF, bad parameter side " << side << endl;
674 int in,
res=NCornerNodes;
675 for(in=NCornerNodes;in<NSides;in++) res += NConnectShapeF(in,order[in-NCornerNodes]);
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)
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Contains TPZShapeLinear class which implements the shape functions of a linear one-dimensional elemen...
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.
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)
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.
Contains TPZShapePrism class which implements the shape functions of a prism element.
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.
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...
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.