15 static LoggerPtr logger(Logger::getLogger(
"pz.shape.TPZShapeQuad"));
23 REAL TPZShapeQuad::gTrans2dQ[8][2][2] = {
24 { { 1., 0.},{ 0., 1.} },
25 { { 0., 1.},{ 1., 0.} },
26 { { 0., 1.},{-1., 0.} },
27 { {-1., 0.},{ 0., 1.} },
28 { {-1., 0.},{ 0.,-1.} },
29 { { 0.,-1.},{-1., 0.} },
30 { { 0.,-1.},{ 1., 0.} },
31 { { 1., 0.},{ 0.,-1.} }
34 REAL TPZShapeQuad::gRibTrans2dQ1d[4][2] = { {1.,0.},{0.,1.},{-1.,0.},{0.,-1.} };
38 REAL x[2],
dx[2],y[2],dy[2];
51 dphi(0,0) = dx[0]*y[0];
52 dphi(1,0) = x[0]*dy[0];
53 dphi(0,1) = dx[1]*y[0];
54 dphi(1,1) = x[1]*dy[0];
55 dphi(0,2) = dx[1]*y[1];
56 dphi(1,2) = x[1]*dy[1];
57 dphi(0,3) = dx[0]*y[1];
58 dphi(1,3) = x[0]*dy[1];
72 phi(is,0) = phi(is%4,0)*phi((is+1)%4,0);
73 dphi(0,is) = dphi(0,is%4)*phi((is+1)%4,0)+phi(is%4,0)*dphi(0,(is+1)%4);
74 dphi(1,is) = dphi(1,is%4)*phi((is+1)%4,0)+phi(is%4,0)*dphi(1,(is+1)%4);
76 phi(8,0) = phi(0,0)*phi(2,0);
77 dphi(0,8) = dphi(0,0)*phi(2,0)+phi(0,0)*dphi(0,2);
78 dphi(1,8) = dphi(1,0)*phi(2,0)+phi(0,0)*dphi(1,2);
83 phi(is,0) += phi(8,0);
84 dphi(0,is) += dphi(0,8);
85 dphi(1,is) += dphi(1,8);
97 ShapeCorner(pt,phi,dphi);
100 for(is=0; is<NCornerNodes; is++)
102 phiblend(is,0) = phi(is,0);
103 for(d=0; d<Dimension; d++)
105 dphiblend(d,is) = dphi(d,is);
108 ShapeGenerating(pt,phiblend,dphiblend);
111 for (
int rib = 0; rib < 4; rib++) {
113 ProjectPoint2dQuadToRib(rib,pt,out);
117 ids[1] =
id[(rib+1)%4];
118 REAL store1[20],store2[40];
119 int ord2 = order[rib]-1;
121 TPZShapeLinear::ShapeInternal(outvec,order[rib],phin,dphin,TPZShapeLinear::GetTransformId1d(ids));
122 TransformDerivativeFromRibToQuad(rib,ord2,dphin);
123 for (
int i = 0; i < ord2; i++) {
124 phi(shape,0) = phiblend(rib+4,0)*phin(i,0);
125 for(
int xj=0;xj<2;xj++) {
126 dphi(xj,shape) = dphiblend(xj,rib+4)*phin(i,0)+
127 phiblend(rib+4,0)*dphin(xj,i);
132 REAL store1[20],store2[40];
133 int ord = (order[4]-1)*(order[4]-1);
135 ShapeInternal(pt,order[4]-2,phin,dphin,GetTransformId2dQ(
id));
136 for(
int i=0;i<ord;i++) {
137 phi(shape,0) = phiblend(8,0)*phin(i,0);
138 for(
int xj=0;xj<2;xj++) {
139 dphi(xj,shape) = dphiblend(xj,8)*phin(i,0) +
140 phiblend(8,0)*dphin(xj,i);
162 Shape(pt,
id, order, phi, dphi);
168 int64_t nsides = TPZQuadrilateral::NSides;
173 int nshape = NCornerNodes;
175 for (
int is = NCornerNodes; is < nsides; is++)
177 nshape += NConnectShapeF(is,order[is-NCornerNodes]);
180 if (nshape!=shapeorders.
Rows())
187 for (
int side = 0; side < nsides; side++)
191 if(side >= NCornerNodes) nshape = NConnectShapeF(side,order[side-NCornerNodes]);
193 if(side >= NCornerNodes) sideorder = order[side-NCornerNodes];
196 SideShapeOrder(side,
id, sideorder, locshapeorders);
198 int nlin = locshapeorders.
Rows();
199 int ncol = locshapeorders.
Cols();
201 for (
int il = 0; il<nlin; il++)
203 for (
int jc = 0; jc<ncol; jc++)
205 shapeorders(linha, jc) = locshapeorders(il, jc);
219 if (shapeorders.
Rows() != 1)
223 shapeorders(0,0) = 1;
224 shapeorders(0,1) = 0;
225 shapeorders(0,2) = 0;
229 if (shapeorders.
Rows() != (order-1)*(order-1)) {
232 int transid = GetTransformId(
id);
234 for (
int i=2; i<order+1; i++) {
235 for (
int j=2; j<order+1; j++) {
260 shapeorders(count,0) = a;
261 shapeorders(count,1) = b;
268 int nshape = order-1;
269 if (shapeorders.
Rows() != nshape)
273 for (
int ioy = 0; ioy < order-1; ioy++)
275 shapeorders(ioy,0) = ioy+2;
284 if((order-2) < 0)
return;
285 int ord1 = order - 1;
286 int numshape = (order-1)*(order-1);
287 if(numshape > phi.
Rows() || phi.
Cols() < 1) phi.
Resize(numshape,1);
288 if(dphi.
Rows() < 2 || dphi.
Cols() < numshape) dphi.
Resize(2,numshape);
290 TPZShapeLinear::fOrthogonal(x[0],ord1,phi0,dphi0);
291 TPZShapeLinear::fOrthogonal(x[1],ord1,phi1,dphi1);
292 for (
int i=0;i<ord1;i++) {
293 for (
int j=0;j<ord1;j++) {
294 int index = i*ord1+j;
295 phi(index,0) = phi0(i,0)* phi1(j,0);
296 dphi(0,index) = dphi0(0,i)* phi1(j,0);
297 dphi(1,index) = phi0(i,0)*dphi1(0,j);
306 if(order < 0)
return;
308 int numshape = ord1*ord1;
310 TransformPoint2dQ(quad_transformation_index,x,out);
312 if(numshape > phi.
Rows() || phi.
Cols() < 1) phi.
Resize(numshape,1);
313 if(dphi.
Rows() < 2 || dphi.
Cols() < numshape) dphi.
Resize(2,numshape);
314 REAL store1[20],store2[20],store3[20],store4[20];
315 TPZFMatrix<REAL> phi0(ord1,1,store1,20),phi1(ord1,1,store2,20),dphi0(1,ord1,store3,20),dphi1(1,ord1,store4,20);
317 TPZShapeLinear::fOrthogonal(out[0],ord1,phi0,dphi0);
318 TPZShapeLinear::fOrthogonal(out[1],ord1,phi1,dphi1);
319 for (
int i=0;i<ord1;i++) {
320 for (
int j=0;j<ord1;j++) {
321 int index = i*ord1+j;
322 phi(index,0) = phi0(i,0)* phi1(j,0);
323 dphi(0,index) = dphi0(0,i)* phi1(j,0);
324 dphi(1,index) = phi0(i,0)*dphi1(0,j);
327 TransformDerivative2dQ(quad_transformation_index,numshape,dphi);
334 if (side < 4 || side > 8) {
350 ShapeInternal(x, order, phi, dphi);
365 for(
int i=0;i<num;i++) {
369 in(0,i) = gTrans2dQ[transid][0][0]*aux[0]+gTrans2dQ[transid][1][0]*aux[1];
370 in(1,i) = gTrans2dQ[transid][0][1]*aux[0]+gTrans2dQ[transid][1][1]*aux[1];
377 out[0] = gTrans2dQ[transid][0][0]*in[0]+gTrans2dQ[transid][0][1]*in[1];
378 out[1] = gTrans2dQ[transid][1][0]*in[0]+gTrans2dQ[transid][1][1]*in[1];
384 trans.
Mult()(0,0) = gTrans2dQ[trans_id][0][0];
385 trans.
Mult()(0,1) = gTrans2dQ[trans_id][0][1];
386 trans.
Mult()(1,0) = gTrans2dQ[trans_id][1][0];
387 trans.
Mult()(1,1) = gTrans2dQ[trans_id][1][1];
390 void TPZShapeQuad::ProjectPoint2dQuadToRib(
int rib,
TPZVec<REAL> &in, REAL &out) {
392 out = gRibTrans2dQ1d[rib][0]*in[0]+gRibTrans2dQ1d[rib][1]*in[1];
398 id0 = (
id[0] <
id[1]) ? 0 : 1;
399 id1 = (
id[2] <
id[3]) ? 2 : 3;
400 minid = (
id[id0] <
id[id1]) ? id0 : id1;
405 if (
id[id0] <
id[id1]) {
407 if (minid ==
id[0])
return 0;
408 if (minid ==
id[1])
return 2;
409 if (minid ==
id[2])
return 4;
410 if (minid ==
id[3])
return 6;
414 if (minid ==
id[0])
return 1;
415 if (minid ==
id[1])
return 3;
416 if (minid ==
id[2])
return 5;
417 if (minid ==
id[3])
return 7;
424 void TPZShapeQuad::TransformDerivativeFromRibToQuad(
int rib,
int num,
TPZFMatrix<REAL> &dphi) {
426 for (
int j = 0;j<num;j++) {
427 dphi(1,j) = gRibTrans2dQ1d[rib][1]*dphi(0,j);
428 dphi(0,j) = gRibTrans2dQ1d[rib][0]*dphi(0,j);
432 int TPZShapeQuad::NConnectShapeF(
int side,
int order) {
440 if(side<8)
return (order-1);
442 return ((order-1)*(order-1));
444 PZError <<
"TPZShapeQuad::NConnectShapeF, bad parameter side " << side << endl;
451 int in,
res=NCornerNodes;
452 for(in=NCornerNodes;in<NSides;in++) {
454 res += NConnectShapeF(in,order[in-NCornerNodes]);
467 if(order < 0)
return;
469 int numshape = ord1*ord1;
471 TransformPoint2dQ(quad_transformation_index,x,out);
473 if(numshape > phi.
NElements() || phi[0].
size() < ndim) phi.
Resize(numshape, FADREAL(ndim, 0.0));
478 phi1(20, FADREAL(ndim, 0.0));
480 TPZShapeLinear::FADfOrthogonal(out[0],ord1,phi0);
481 TPZShapeLinear::FADfOrthogonal(out[1],ord1,phi1);
482 for (
int i=0;i<ord1;i++) {
483 for (
int j=0;j<ord1;j++) {
484 int index = i*ord1+j;
486 phi[index] = phi0[i] * phi1[j];
496 out[0] = gTrans2dQ[transid][0][0]*in[0]+gTrans2dQ[transid][0][1]*in[1];
497 out[1] = gTrans2dQ[transid][1][0]*in[0]+gTrans2dQ[transid][1][1]*in[1];
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
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...
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...
expr_ dx(i) *cos(expr_.val())
#define DebugStop()
Returns a message to user put a breakpoint in.
Free store vector implementation.
int64_t Rows() const
Returns number of rows.
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...
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Implements generic class which holds a matrix of objects. Matrix.
int64_t Cols() const
Returns number of cols.
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.