NeoPZ
TPZCompElDisc.cpp
Go to the documentation of this file.
1 
6 #include "pztransfer.h"
7 #include "pzelmat.h"
8 #include "pzmatrix.h"
9 #include "pzelmat.h"
10 #include "pzquad.h"
11 #include "pzgeoel.h"
12 #include "pzcmesh.h"
13 #include "pzerror.h"
14 #include "pzconnect.h"
15 #include "TPZMaterial.h"
16 #include "pzbndcond.h"
17 #include "pzmanvector.h"
18 #include "TPZShapeDisc.h"
19 #include "TPZCompElDisc.h"
20 #include "TPZInterfaceEl.h"
21 #include "pzgraphel.h"
22 #include "pzgraphelq2dd.h"
23 #include "pzgraphelq3dd.h"
24 #include "pzgraphel1d.h"
25 #include "pzgraphel1dd.h"
26 #include "pztrigraphd.h"
27 #include "pztrigraph.h"
28 #include "tpzgraphelt2dmapped.h"
29 #include "tpzgraphelprismmapped.h"
31 #include "tpzgraphelt3d.h"
32 #include "pzgraphel.h"
33 #include "pzgraphmesh.h"
34 
35 #include <sstream>
36 #include <cmath>
37 #include <algorithm>
38 
39 #include "time.h"
40 #include "pzgeoel.h"
41 #include "pzcompel.h"
42 #include <math.h>
43 #include <stdio.h>
44 #include "pzmaterialdata.h"
45 #include "tpzautopointer.h"
46 
47 #include "pzlog.h"
48 
49 #ifdef LOG4CXX
50 static LoggerPtr logger(Logger::getLogger("pz.mesh.tpzcompeldisc"));
51 #endif
52 
53 
54 using namespace pzshape;
55 using namespace std;
56 
58  this->fShapefunctionType = pzshape::TPZShapeDisc::ETensorial;
59  this->SetDegree( this->Degree() );
60 }
61 
63  this->fShapefunctionType = pzshape::TPZShapeDisc::EOrdemTotal;
64  this->SetDegree( this->Degree() );
65 }
66 
68  this->fShapefunctionType = pzshape::TPZShapeDisc::ETensorialFull;
69  this->SetDegree( this->Degree() );
70 }
71 
73  this->fShapefunctionType = pzshape::TPZShapeDisc::EOrdemTotalFull;
74  this->SetDegree( this->Degree() );
75 }
76 
78  if(!cmesh) return;
79  int64_t nel = cmesh->NElements();
80  for(int64_t iel = 0; iel < nel; iel++){
81  TPZCompEl * cel = cmesh->ElementVec()[iel];
82  if(!cel) continue;
83  TPZCompElDisc * disc = dynamic_cast<TPZCompElDisc*>(cel);
84  if(!disc) continue;
85  disc->SetTensorialShape();
86  }
87 }
88 
90  if(!cmesh) return;
91  int64_t nel = cmesh->NElements();
92  for(int64_t iel = 0; iel < nel; iel++){
93  TPZCompEl * cel = cmesh->ElementVec()[iel];
94  if(!cel) continue;
95  TPZCompElDisc * disc = dynamic_cast<TPZCompElDisc*>(cel);
96  if(!disc) continue;
97  disc->SetTotalOrderShape();
98  }
99 }
100 
102  TPZGeoEl * ref = this->Reference();
103  if (ref){
104  if(ref->Reference() == this) ref->ResetReference();
105  }//if (ref)
106 }
107 
109 TPZInterpolationSpace(), fConnectIndex(-1), fExternalShape(), fCenterPoint(3,0.)
110 {
112  this->fIntRule = NULL;
113  fUseQsiEta = true;
114  fConstC = 1.;
115 
116 }
117 
120 {
122  this->fIntRule = this->CreateIntegrationRule();
123  this->SetTrueUseQsiEta();
124 }
125 
129  //TPZMaterial * mat = copy.Material();
130  if (copy.fIntRule){
131  this->fIntRule = copy.GetIntegrationRule().Clone();
132  }
133  else{
134  this->fIntRule = NULL;
135  }
136 
138  fUseQsiEta = copy.fUseQsiEta;
139 }
140 
142  const TPZCompElDisc &copy,
143  std::map<int64_t,int64_t> &gl2lcConMap,
144  std::map<int64_t,int64_t> &gl2lcElMap) :
146 {
148  //TPZMaterial * mat = copy.Material();
149  gl2lcElMap[copy.fIndex] = this->fIndex;
150 
151  if (copy.fIntRule){
152  this->fIntRule = copy.GetIntegrationRule().Clone();
153  }
154  else{
155  this->fIntRule = NULL;
156  }
157 
159  fUseQsiEta = copy.fUseQsiEta;
160 }
161 
162 TPZCompElDisc::TPZCompElDisc(TPZCompMesh &mesh, const TPZCompElDisc &copy,int64_t &index) :
164 TPZInterpolationSpace(mesh,copy,index), fConnectIndex(-1), fCenterPoint(copy.fCenterPoint) {
166  //criando nova malha computacional
167  Reference()->SetReference(this);
168  //TPZMaterial * mat = copy.Material();
169  fConstC = copy.fConstC;
171  this->SetDegree( copy.Degree() );
172  //as interfaces foram clonadas
173  if (copy.fIntRule){
174  this->fIntRule = copy.GetIntegrationRule().Clone();
175  }
176  else{
177  this->fIntRule = NULL;
178  }
180  fUseQsiEta = copy.fUseQsiEta;
181 }
182 
185 {
187  ref->SetReference(this);
189  this->SetDegree( fMesh->GetDefaultOrder() );
190 
191  //criando os elementos interface
192  //Now, the interface is created by calling the CreateIntefaces method in class TPZApproxSpace.
193  //CreateInterfaces();
194 
195  this->fIntRule = this->CreateIntegrationRule();
197 
198 }
199 
201 {
202  TPZGeoEl *ref = Reference();
203  //greater distance between the point and the vertices of the inner element
204  int nnodes = ref->NNodes(),i;
205  if(nnodes == 1) return 1.0;//point element
206  REAL maxdist,dist;
207  int64_t inode = ref->NodeIndex(0);//first node of the element
208  TPZGeoNode node = ref->Mesh()->NodeVec()[inode];
209  maxdist = pow(node.Coord(0)-fCenterPoint[0],(REAL)2.)+pow(node.Coord(1)-fCenterPoint[1],(REAL)2.); // I do casting because the developer use double exponent (2.) - I think better using int (2) - Jorge
210  maxdist += pow(node.Coord(2)-fCenterPoint[2],(REAL)2.);
211  maxdist = sqrt(maxdist);
212  for(i=1;i<nnodes;i++){
213  inode = ref->NodeIndex(i);//subsequent node
214  node = ref->Mesh()->NodeVec()[inode];
215  dist = pow(node.Coord(0)-fCenterPoint[0],(REAL)2.)+pow(node.Coord(1)-fCenterPoint[1],(REAL)2.);
216  dist += pow(node.Coord(2)-fCenterPoint[2],(REAL)2.);
217  dist = sqrt(dist);
218  if(maxdist < dist) maxdist = dist;
219  }
220  return maxdist;
221 }
222 
224  TPZFMatrix<REAL> &jacobian, TPZFMatrix<REAL> &axes,
225  REAL &detjac, TPZFMatrix<REAL> &jacinv,
227  TPZGeoEl * ref = this->Reference();
228  if (!ref){
229  PZError << "\nERROR AT " << __PRETTY_FUNCTION__ << " - this->Reference() == NULL\n";
230  return;
231  }//if
232  ref->Jacobian( intpoint, jacobian, axes, detjac , jacinv);
233 
234  if(fUseQsiEta==true){
235  this->Shape(intpoint,phi,dphi);
236  this->Convert2Axes(dphi,jacinv,dphix);
237  ref->X(intpoint, X);
238  }else{
239  dphi.Zero();
240  ref->X(intpoint, X);
241  this->ShapeX(X,phi,dphix);
242  //axes is identity in discontinuous elements
243  axes.Resize(dphix.Rows(), 3);
244  axes.Zero();
245  for(int i = 0; i < axes.Rows(); i++) axes(i,i) = 1.;
246  }
247 
248 }
249 
251  this->ComputeShape(intpoint, data.x, data.jacobian, data.axes,data.detjac, data.jacinv, data.phi, data.dphi, data.dphix);
252 }
253 
254 
256  if(fUseQsiEta==true){
257  this->ShapeX(qsi,phi,dphi);
258  }else{
259 
261  this->Reference()->X(qsi,x);
262  this->ShapeX(x,phi,dphi);
263  }
264 }
265 
266 
268  const int Degree = this->Degree();
269  if(Degree < 0) return;
270  const int dim = this->Dimension();
272 
273  //now appending external shape functions
274  this->AppendExternalShapeFunctions(X,phi,dphi);
275 }//method
276 
278 
279  //adding external shape functions whether they exist
280  if(!this->fExternalShape.operator ->()) return;
281 
282  TPZManVector<STATE> extPhi;
283  TPZFNMatrix<100,STATE> extDPhi;
284  TPZFNMatrix<100> ThisPhi, ThisDPhi;
285 
286  //computing external shape functions
287  this->fExternalShape->Execute(X, extPhi, extDPhi);
288 
289  //now appending all shape functions
290  {
291 
292  const int ndiscphi = TPZShapeDisc::NShapeF(this->Degree(),this->Dimension(),fShapefunctionType);
293  const int nextphi = this->fExternalShape->NFunctions();
294 
295 #ifdef PZDEBUG
296  if(phi.Cols() != 1){
297  PZError << "\nError at " << __PRETTY_FUNCTION__ << "\n";
298  DebugStop();
299  }
300 #endif
301 
302  ThisPhi = phi;
303  phi.Resize(ndiscphi+nextphi,1);
304  phi.Zero();
305  for(int i = 0; i < ndiscphi; i++) {
306  phi(i,0) = ThisPhi(i,0);
307  }
308  for(int i = 0; i < nextphi; i++) {
309 #ifdef STATE_COMPLEX
310  phi(i+ndiscphi,0) = extPhi[i].real();
311 #else
312  phi(i+ndiscphi,0) = (REAL)extPhi[i];
313 #endif
314  }
315 
316  }
317 
318  {
319 #ifdef PZDEBUG
320  if(dphi.Rows() > extDPhi.Rows()){
321  PZError << "\nError at " << __PRETTY_FUNCTION__ << "\n";
322  DebugStop();
323  }
324 #endif
325 
326  ThisDPhi = dphi;
327  const int ndiscdphi = TPZShapeDisc::NShapeF(this->Degree(),this->Dimension(),fShapefunctionType);
328  const int nextdphi = this->fExternalShape->NFunctions();
329  const int64_t nderiv = ThisDPhi.Rows();
330  dphi.Resize(nderiv, ndiscdphi+nextdphi);
331  dphi.Zero();
332  for(int64_t i = 0; i < nderiv; i++){
333  for(int j = 0; j < ndiscdphi; j++){
334  dphi(i,j) = ThisDPhi(i,j);
335  }
336  }
337  for(int64_t i = 0; i < nderiv; i++){
338  for(int j = 0; j < nextdphi; j++){
339 #ifdef STATE_COMPLEX
340  dphi(i,j+ndiscdphi) = extDPhi(i,j).real();
341 #else
342  dphi(i,j+ndiscdphi) = (REAL)extDPhi(i,j);
343 #endif
344  }
345  }
346  }
347 }
348 
349 void TPZCompElDisc::Print(std::ostream &out) const{
350 
351  out << "\nDiscontinous element : \n";
352  TPZCompEl::Print(out);
353  if(Reference()) out << "\tGeometric reference index : " << Reference()->Index() << endl;
354  out << "\tMaterial id : " << Reference()->MaterialId() << endl
355  << "\tDegree of interpolation : " << this->Degree() << endl
356  << "\tConnect index : " << fConnectIndex << endl
357  << "\tNormalizing constant : " << fConstC << endl
358  << "\tCenter point of the element : ";
359  if(fUseQsiEta == false)
360  {
361  int size = fCenterPoint.NElements(),i;
362  for(i=0;i<size-1;i++) out << fCenterPoint[i] << " , ";
363  out << fCenterPoint[i] << endl;
364  }
365  else
366  {
367  TPZGeoEl *Ref = Reference();
368  if (Ref) {
369  TPZManVector<REAL,3> xcenter(3),loccenter(fCenterPoint);
370  Ref->X(loccenter, xcenter);
371  out << xcenter << std::endl;
372  }
373  }
374  out << "\tDimension : " << this->Dimension() << endl;
375 }
376 
377 int64_t TPZCompElDisc::ConnectIndex(int side) const{
378  return fConnectIndex;
379 }
380 
382  return (fConnectIndex !=-1);
383 }
384 
386  // primeiro sao criados os elementos de volume depois os elementos BC associados aos seus lados
387  // num estagio inicial o elemento BC eh acoplado ao elemento ELV de volume de tal forma
388  // que ambos sao vizinhos
389  // o elemento BC nao pode ser dividido se o elemento ELV associado nao for dividido primeiro
390  // caso o elemento ELV for dividido, entao o elemento BC associado deveria ser dividido
391  // tambem para manter a CC consistente com a malha
392  // caso ELV for dividido e BC nao eh entao ELV sera LowerLevelElement do elemento BC
393  TPZMaterial * material = Material();
394  if(!material){
395  PZError << "\nTPZCompElDisc::CreateMidSideConnect Material nulo\n";
396  return -1;
397  }
398 
399  TPZGeoEl *ref = Reference();
401  int nsides = ref->NSides();
402  int dimgrid = Mesh()->Dimension();
403  int dim = Dimension();
404  int existsconnect = 0;
405 
406  if(dimgrid == dim){
407  //este eh um elemento de volume
408  //procura-se elemento superposto
409  TPZCompElSide(this,nsides-1).EqualLevelElementList(list,0,0);
410  int64_t size = list.NElements(), i;
411  for(i=0;i<size;i++){
412  int dimel = list[i].Element()->Reference()->Dimension();
413  if(dimel == dimgrid){
414  int64_t connectindex = list[i].Element()->ConnectIndex(0);
415  list[i].Element()->SetConnectIndex(0,connectindex);
416  existsconnect = 1;
417  break;
418  }
419  }
420  }
421 
422  if(dim != dimgrid/* - 1*/){ //dimgrid - 1 = interface dimension
423  // o atual eh um elemento BC
424  fConnectIndex = -1;//=> return NshapeF() = 0
425  return fConnectIndex;
426  }
427 
428  if(!existsconnect){
429  //o atual eh um elemento de volume e
430  //nao achou-se um elemento superposto
431  int nvar = Material()->NStateVariables();
432  int nshape = 1;
433  int64_t newnodeindex = Mesh()->AllocateNewConnect(nshape,nvar,0);
435  SetConnectIndex(0,newnodeindex);
436  TPZConnect &newnod = Mesh()->ConnectVec()[newnodeindex];
437  newnod.IncrementElConnected();
438  nshape = this->NShapeF();
439  newnod.SetNShape(nshape);
440  int64_t seqnum = newnod.SequenceNumber();
441  Mesh()->Block().Set(seqnum,nvar*nshape);
442  Mesh()->ConnectVec()[fConnectIndex].IncrementElConnected();
443  }
444 
445  return fConnectIndex;
446 }
447 
449  if(fConnectIndex == -1) return 0;
450  //deve ter pelo menos um connect
451 
452  int nExtShape = 0;
453  if(fExternalShape) nExtShape = fExternalShape->NFunctions();
454 
455  int dim = Dimension();
456  const int discShape = TPZShapeDisc::NShapeF(this->Degree(),dim,fShapefunctionType);
457  return (discShape + nExtShape);
458 
459 }
460 
461 int TPZCompElDisc::NConnectShapeF(int inod, int order) const {
462 #ifdef PZDEBUG2
463  if (inod != 0){
464  PZError << "\nFATAL ERROR AT " << __PRETTY_FUNCTION__
465  << " - TPZCompElDisc has only one connect and inod = " << inod << "\n";
466  }
467 #endif
468  if (order != Degree()) {
469  DebugStop();
470  }
471  return this->NShapeF();
472 }
473 
475  //ponto deformado
476  point.Resize(3,0.);
477  point[0] = fCenterPoint[0];
478  point[1] = fCenterPoint[1];
479  point[2] = fCenterPoint[2];
480 }
481 
483 {
484  TPZGeoEl *ref = Reference();
485 
486  int dim = ref->Dimension();
487  int side = ref->NSides()-1;
488  if(dim == 2) ref->SideArea(side);
489  if(!dim || dim > 2){
490  PZError << "TPZCompElDisc::SizeOfElement case not permited\n";
491  return 0.;
492  }
493  if(dim == 1){
494  TPZGeoNode node0 = Mesh()->Reference()->NodeVec()[ref->NodeIndex(0)];
495  TPZGeoNode node1 = Mesh()->Reference()->NodeVec()[ref->NodeIndex(1)];
496  TPZVec<REAL> no0(3),no1(3);
497  for(int i=0;i<3;i++){
498  no0[i] = node0.Coord(i);
499  no1[i] = node1.Coord(i);
500  }
501  return ref->Distance(no0,no1);
502  }
503  PZError << "TPZCompElDisc::SizeOfElement this in case that it is not contemplated\n";
504  return 0.;
505 }
506 
507 void TPZCompElDisc::Divide(int64_t index,TPZVec<int64_t> &subindex,int interpolatesolution){
508 
509  Mesh()->SetAllCreateFunctions(*this);
510 
511  if (Mesh()->ElementVec()[index] != this) {
512  PZError << "TPZInterpolatedElement::Divide index error";
513  subindex.Resize(0);
514  return;
515  }
516  TPZMaterial * material = Material();
517  if(!material)
518  {
519  PZError << __PRETTY_FUNCTION__ << " no material\n";
520  return;
521  }
522 
523  TPZGeoEl *ref = Reference();
525 
526 #ifdef PZDEBUG2
527  if(0){//TESTE
528  ofstream mesh("MALHADIV.out");//TESTE
529  Mesh()->Reference()->Print(mesh);//TESTE
530  Mesh()->Print(mesh);//TESTE
531  mesh.flush(); //TESTE
532  mesh.close();//TESTE
533  }//TESTE
534 #endif
535 
536  //divide o elemento geom�rico
537  int nsubs = ref->NSubElements();
538  subindex.Resize(nsubs);
539  TPZManVector<TPZGeoEl *> geosubs(nsubs);
540  ref->Divide(geosubs);
541  if(!geosubs.NElements()) {
542  subindex.Resize(0);
543  return;
544  }
545 
546  // The refinement pattern may be adjusted during the division process. 02/25/2013
547  nsubs = ref->NSubElements();
548  subindex.Resize(nsubs);
549 
550  this->Mesh()->ElementVec()[index] = NULL;
551  ref->ResetReference();
552  TPZCompElDisc *discel;
553  int i,deg;
554  deg = this->Degree();
555 
556  for (i=0;i<nsubs;i++){
557  Mesh()->CreateCompEl(geosubs[i],subindex[i]);//aqui
558  //new TPZCompElDisc(*Mesh(),geosubs[i],subindex[i]);
559  discel = dynamic_cast<TPZCompElDisc *> (Mesh()->ElementVec()[subindex[i]]);
560  if (!discel){
561  std::stringstream mess;
562  mess << __PRETTY_FUNCTION__ << " - discel is NULL ";
563  LOGPZ_ERROR(logger, mess.str() );
564  continue;
565  }
566  discel->fShapefunctionType = this->fShapefunctionType;
567  discel->SetDegree(deg);
568  }
569 
570  if (interpolatesolution){
571  Mesh()->ExpandSolution();
572  for(i=0; i<nsubs; i++) {
573  discel = dynamic_cast<TPZCompElDisc *> ( Mesh()->ElementVec()[subindex[i]] );
574  if (!discel){
575  std::stringstream mess;
576  mess << __PRETTY_FUNCTION__ << " - discel is NULL ";
577  LOGPZ_ERROR(logger, mess.str() );
578  continue;
579  }
580  if(discel->Dimension() < material->Dimension()) continue;//elemento BC
581  discel->InterpolateSolution(*this);
582  }
583  }//if interpolate
584 
585  delete this;
586 }
587 
589  TPZCompMesh *finemesh = Mesh();
590  TPZBlock<STATE> &fineblock = finemesh->Block();
591  int nstate = Material()->NStateVariables();
592  TPZFMatrix<STATE> &FineMeshSol = finemesh->Solution();
593  int matsize = NShapeF(),dim = Dimension();
594  TPZFMatrix<REAL> phix(matsize,1,0.);
595  TPZFMatrix<REAL> dphix(dim,matsize,0.);
596  ShapeX(x,phix,dphix);
597  TPZConnect *df = &Connect(0);
598  int64_t dfseq = df->SequenceNumber();
599  int dfvar = fineblock.Size(dfseq);
600  int64_t pos = fineblock.Position(dfseq);
601  int iv = 0,d;
602  uh.Fill(0.);
603  for(d=0; d<dfvar; d++) {
604  uh[iv%nstate] += (STATE)phix(iv/nstate,0)*FineMeshSol(pos+d,0);
605  iv++;
606  }
607 }
608 
610 {
611  TPZGeoEl *ref = Reference();
612  int matid = Material()->Id();
613  int nsides = ref->NSides();
614  bool to_postpro = grmesh.Material_Is_PostProcessed(matid);
615  if(dimension == 2 && to_postpro){
616  if(nsides == 9){
617  new TPZGraphElQ2dd(this,&grmesh);
618  return;
619  }
620  if(nsides == 7){
621  new TPZGraphElT2dMapped(this,&grmesh);
622  return;
623  }
624  }//2d
625 
626  if(dimension == 3 && to_postpro){
627  if(nsides == 27){
628  new TPZGraphElQ3dd(this,&grmesh);
629  return;
630  }//cube
631  if(nsides == 21){
632  new TPZGraphElPrismMapped(this,&grmesh);
633  return;
634  }//prism
635  if(nsides == 15){
636  new TPZGraphElT3d(this,&grmesh);
637  return;
638  }//tetra
639  if(nsides == 19){
640  new TPZGraphElPyramidMapped(this,&grmesh);
641  return;
642  }//pyram
643  }//3d
644 
645  if(dimension == 1 && this->NConnects() /* && mat > 0 */){
646  if(nsides == 3){
647  new TPZGraphEl1dd(this,&grmesh);
648  return;
649  }
650  }//1d
651 }
652 
654 
655  return Reference()->NSides();
656 }
657 
659 
660  int nsides = this->NSides();
661 
662  switch( nsides )
663  {
664  case 3: //line
665  return 2;
666  // break;
667 
668  case 7: //triangle
669  return 3;
670  // break;
671 
672  case 9: //square
673  return 4;
674 
675  case 15: // Tetrahedra.
676  return 4;
677  // break;
678 
679  case 19: // Prism.
680  return 5;
681  // break;
682 
683  case 21: // Pyramid.
684  return 6;
685  // break;
686 
687  case 27: // Hexaedra.
688  return 8;
689  // break;
690 
691  default:
692  PZError << "TPZCompElDisc::NFaces() - Unknown element shape!" << endl;
693  DebugStop();
694  }
695  return 0;
696 }
697 
698 //#include "TPZAgglomerateEl.h"
700 
701  int i,npoints;
702  TPZVec<REAL> pt(3),x(3,0.0);
703  TPZFMatrix<REAL> jacobian(3,3),jacinv(3,3),axes(3,3);
704  REAL detjac,wt;
705 
706  TPZGeoEl *subgel = Reference();
707  if(!subgel) PZError << "TPZCompElDisc::AccumulateIntegrationRule data error, null geometric reference\n";
708  TPZIntPoints *rule = subgel->CreateSideIntegrationRule(subgel->NSides()-1,degree);
709  npoints = rule->NPoints();
710 
711  for(i=0;i<npoints;i++){
712 
713  rule->Point(i,pt,wt);
714  subgel->Jacobian(pt,jacobian,axes,detjac,jacinv);
715  subgel->X(pt, x);
716 
717  point.Push(x[0]);
718  point.Push(x[1]);
719  point.Push(x[2]);
720 
721  weight.Push(wt * fabs(detjac));
722  }
723  delete rule;
724 }
725 
726 
728 
729  TPZGeoEl *ref = Reference();
730  if(ref || Type() == EDiscontinuous){
731  ref->CenterPoint(ref->NSides()-1,center);
732  return;
733  } else {//aglomerado
734  // TPZStack<TPZCompEl *> elvec;
735  // dynamic_cast<TPZAgglomerateElement *>(this)->ListOfDiscEl(elvec);
736  // TPZGeoEl *ref = elvec[0]->Reference();
737  // ref->CenterPoint(ref->NSides()-1,center);
738  PZError << "TPZCompElDisc::CenterPoint center points not exists!\n";
739  }
740 }
741 
743  // accumulates the transfer coefficients between the current element and the
744  // coarse element into the transfer matrix, using the transformation t
745 
746  int locnshape = NShapeF();
747  int cornshape = coarsel.NShapeF();
748 
749  // compare interpolation orders
750  // the interpolation order of this >= that interpolation order of coarse
751  int locdeg = Degree(), coarsedeg = coarsel.Degree();
752  if(coarsedeg > locdeg) {
753  SetDegree(coarsedeg);
754  }
755 
756  TPZFNMatrix<500,STATE> loclocmat(locnshape,locnshape);
757  TPZFNMatrix<200,STATE> loccormat(locnshape,cornshape);
758  loclocmat.Zero();
759  loccormat.Zero();
760 
761  TPZGeoEl *ref = Reference();
762  int integdeg = locdeg >= coarsedeg ? locdeg : coarsedeg;
763  TPZIntPoints *intrule = ref->CreateSideIntegrationRule(ref->NSides()-1,2*integdeg);
764  int dimension = Dimension();
765 
766  TPZFNMatrix<50> locphi(locnshape,1);
767  TPZFNMatrix<150> locdphi(dimension,locnshape);
768  locphi.Zero();
769  locdphi.Zero();
770  // derivative of the shape function
771  // in the master domain
772 
773  TPZFMatrix<REAL> corphi(cornshape,1);
774  TPZFMatrix<REAL> cordphi(dimension,cornshape);
775  // derivative of the shape function
776  // in the master domain
777 
778  TPZManVector<REAL> int_point(dimension);
779  TPZFNMatrix<9> jacobian(dimension,dimension);
780  TPZFMatrix<REAL> jacinv(dimension,dimension);
781  TPZFNMatrix<9> axes(3,3);
782  TPZManVector<REAL> x(3);
783 
784  int_point.Fill(0.,0);
785  REAL jac_det = 1.;
786  ref->Jacobian( int_point, jacobian , axes, jac_det, jacinv);
787  REAL multiplier = 1./jac_det;
788 
789  int numintpoints = intrule->NPoints();
790  REAL weight;
791  int lin,ljn,cjn;
792 
793  for(int int_ind = 0; int_ind < numintpoints; ++int_ind) {
794 
795  intrule->Point(int_ind,int_point,weight);
796  ref->Jacobian( int_point, jacobian , axes, jac_det, jacinv);
797  ref->X(int_point, x);
798  Shape(int_point,locphi,locdphi);
799  weight *= jac_det;
800  corphi.Zero();
801  cordphi.Zero();
802  coarsel.Shape(int_point,corphi,cordphi);
803 
804  for(lin=0; lin<locnshape; lin++) {
805  for(ljn=0; ljn<locnshape; ljn++) {
806  loclocmat(lin,ljn) += weight*locphi(lin,0)*locphi(ljn,0)*multiplier;
807  }
808  for(cjn=0; cjn<cornshape; cjn++) {
809  loccormat(lin,cjn) += weight*locphi(lin,0)*corphi(cjn,0)*multiplier;
810  }
811  }
812  jacobian.Zero();
813  }
814  loclocmat.SolveDirect(loccormat,ELDLt);
815 
816 
817  int64_t locblockseq = Connect(0).SequenceNumber();
818  TPZStack<int> globblockvec;
819  int numnonzero = 0;
820  int cind = coarsel.ConnectIndex(0);
821  TPZConnect &con = coarsel.Mesh()->ConnectVec()[cind];
822  int corblockseq = con.SequenceNumber();
823  if(locnshape == 0 || cornshape == 0)
824  PZError << "TPZCompElDisc::BuilTransferMatrix error I\n";
825  TPZFMatrix<STATE> smalll(locnshape,cornshape,0.);
826  loccormat.GetSub(0,0,locnshape,cornshape,smalll);
827  REAL tol = Norm(smalll);
828  if(tol >= 1.e-10) {
829  globblockvec.Push(corblockseq);
830  numnonzero++;
831  }
832  if(!numnonzero)
833  PZError << "TPZCompElDisc::BuilTransferMatrix error II\n";
834  if(transfer.HasRowDefinition(locblockseq))
835  PZError << "TPZCompElDisc::BuilTransferMatrix error III\n";
836  transfer.AddBlockNumbers(locblockseq,globblockvec);
837  if(cornshape == 0 || locnshape == 0)
838  PZError << "TPZCompElDisc::BuilTransferMatrix error IV\n";
839  loccormat.GetSub(0,0,locnshape,cornshape,smalll);
840  transfer.SetBlockMatrix(locblockseq,globblockvec[0],smalll);
841 
842  SetDegree(locdeg);
843  delete intrule;
844 }
845 
847  TPZGeoEl *geo = Reference();
848 
849  //Code isnt place to chat
850  //#warning "Este metodo nao funciona para aglomerados contendo aglomerados"
851  if(!geo) {
852  PZError << "TPZCompElDisc::AccumulateVertices null reference\n";
853  return;
854  }
855  int nvertices = geo->NNodes();
856  int l;
857  for(l=0;l<nvertices;l++) nodes.Push( geo->NodePtr(l) );
858 }
859 
861  this->fPreferredOrder = degree;
862  if (fConnectIndex < 0) return;
864  c.SetOrder(degree,fConnectIndex);
865  int64_t seqnum = c.SequenceNumber();
866  int nvar = 1;
867  TPZMaterial * mat = Material();
868  if(mat) nvar = mat->NStateVariables();
869  int nshapef = this->NShapeF();
870  c.SetNShape(nshapef);
871  c.SetNState(nvar);
872  Mesh()->Block().Set(seqnum,nshapef*nvar);
873 }
874 
876  this->fExternalShape = externalShapes;
877  //in order of ajust block size because NShapeF may have changed
878  if (fConnectIndex < 0) return;
880  int64_t seqnum = c.SequenceNumber();
881  int nvar = 1;
882  TPZMaterial * mat = Material();
883  if(mat) nvar = mat->NStateVariables();
884  int nshapef = this->NShapeF();
885  c.SetNShape(nshapef);
886  c.SetNState(nvar);
887  Mesh()->Block().Set(seqnum,nshapef*nvar);
888 }
889 
891  return (this->fExternalShape);
892 }
893 
898  return Hash("TPZCompElDisc") ^ TPZInterpolationSpace::ClassId() << 1;
899 }
900 
901 #ifndef BORLAND
902 template class
904 #endif
905 
909 void TPZCompElDisc::Write(TPZStream &buf, int withclassid) const
910 {
911  TPZInterpolationSpace::Write(buf,withclassid);
912  buf.Write(fCenterPoint);
913  buf.Write(&fConnectIndex,1);
914  buf.Write(&fConstC,1);
915  int matid = Material()->Id();
916  buf.Write(&matid,1);
917  int shapetype = fShapefunctionType;
918  buf.Write(&shapetype,1);
919  if(this->fExternalShape.operator ->()){
920  int um = 1;
921  buf.Write(&um,1);
922  this->fExternalShape->Write(buf,withclassid);
923  }
924  else{
925  int zero = 0;
926  buf.Write(&zero,1);
927  }
928  int hasIntRule = this->fIntRule ? 1 : 0;
929  buf.Write(&hasIntRule,1);
930  if( this->fIntRule){
931  TPZManVector<int> pOrder(3);
932  this->fIntRule->GetOrder(pOrder);
933  buf.Write(pOrder);
934  TPZGeoEl *gel = this->Reference();
935  int hasAssociatedGel = gel ? 1 : 0;
936  buf.Write(&hasAssociatedGel);
937  if(gel){
939  }
940  }
941 }
942 
946 void TPZCompElDisc::Read(TPZStream &buf, void *context)
947 {
948  TPZInterpolationSpace::Read(buf,context);
949  buf.Read<3>(fCenterPoint);
950  buf.Read(&fConnectIndex,1);
951  buf.Read(&fConstC,1);
952  int matid;
953  buf.Read(&matid,1);
954  // fMaterial = Mesh()->FindMaterial(matid);
955  int shapetype;
956  buf.Read(&shapetype,1);
958  int hasExternalShape;
959  buf.Read(&hasExternalShape,1);
960  if(hasExternalShape == 1){
961 // #warning Como faz?
962 // #warning this->fExternalShape->
963  }
964  int hasIntRule;
965  buf.Read(&hasIntRule,1);
966  if( hasIntRule ){
967  TPZManVector<int> pOrder(3);
968  buf.Read(pOrder);
969  int hasAssociatedGel;
970  buf.Read(&hasAssociatedGel,1);
971  if(hasAssociatedGel){
972  TPZGeoEl *gel = dynamic_cast<TPZGeoEl *>(TPZPersistenceManager::GetInstance(&buf));
974  result->SetOrder(pOrder);
975  this->fIntRule = result;
976  }
977  else{
978  this->fIntRule = nullptr;
979  }
980  }
981  else{
982  this->fIntRule = nullptr;
983  }
984 
985 }
986 
987 
989 
990 // this->InitMaterialData(data);
991 // this->ComputeShape(qsi, data);
992  this->ComputeSolution(qsi, data.phi, data.dphix, data.axes, data.sol, data.dsol);
993 }
994 
996  TPZGeoEl * ref = this->Reference();
997  const int nshape = this->NShapeF();
998  const int dim = ref->Dimension();
999 
1000  TPZMaterialData data;
1001  data.phi.Resize(nshape, 1);
1002  data.dphix.Resize(dim, nshape);
1003  data.jacobian.Resize(dim, dim);
1004  data.jacinv.Resize(dim, dim);
1005  data.x.Resize(3, 0.);
1006 
1007  //this->ComputeShape(qsi,x,jacobian,axes,detjac,jacinv,phix,dphix);
1008  //this->ComputeSolution(qsi, phix, dphix, axes, sol, dsol);
1009 
1010  this->ComputeShape(qsi, data);
1011  this->ComputeSolution(qsi, data.phi, data.dphix, data.axes, data.sol, data.dsol);
1012 
1013 }//method
1014 
1016  const TPZFMatrix<REAL> &axes, TPZSolVec &sol, TPZGradSolVec &dsol){
1017 
1018  const int nstate = this->Material()->NStateVariables();
1019  const int ncon = this->NConnects();
1020  TPZBlock<STATE> &block = Mesh()->Block();
1021  TPZFMatrix<STATE> &MeshSol = Mesh()->Solution();
1022  int64_t numbersol = MeshSol.Cols();
1023 
1024  int solVecSize = nstate;
1025  if(!ncon) solVecSize = 0;
1026 
1027  sol.resize(numbersol);
1028  dsol.resize(numbersol);
1029  for (int is = 0; is<numbersol; is++) {
1030  sol[is].Resize(solVecSize);
1031  sol[is].Fill(0.);
1032  dsol[is].Redim(dphix.Rows(), solVecSize);
1033  dsol[is].Zero();
1034  }
1035  int64_t iv = 0, d;
1036  for(int in=0; in<ncon; in++) {
1037  TPZConnect *df = &Connect(in);
1038  int64_t dfseq = df->SequenceNumber();
1039  int dfvar = block.Size(dfseq);
1040  int64_t pos = block.Position(dfseq);
1041  for(int jn=0; jn<dfvar; jn++) {
1042  for (int64_t is=0; is<numbersol; is++) {
1043  sol[is][iv%nstate] += (STATE)phi(iv/nstate,0)*MeshSol(pos+jn,is);
1044  for(d=0; d<dphix.Rows(); d++){
1045  dsol[is](d,iv%nstate) += (STATE)dphix(d,iv/nstate)*MeshSol(pos+jn,is);
1046  }
1047  }
1048  iv++;
1049  }
1050  }
1051 
1052 }//method
1053 
1055  TPZVec<REAL> &normal,
1056  TPZSolVec &leftsol, TPZGradSolVec &dleftsol,TPZFMatrix<REAL> &leftaxes,
1057  TPZSolVec &rightsol, TPZGradSolVec &drightsol,TPZFMatrix<REAL> &rightaxes){
1058  //TPZCompElDisc has no left/right elements. Only interface elements have it.
1059  leftsol.resize(0);
1060  dleftsol.resize(0);
1061  leftaxes.Zero();
1062  rightsol.Resize(0);
1063  drightsol.Resize(0);
1064  rightaxes.Zero();
1065  normal.Resize(0);
1066 }//method
1067 
1069  TPZGeoEl * gel = this->Reference();
1070  if(gel){
1071  const int integ = Max( 2 * this->Degree()+1, 0);
1072  TPZAutoPointer<TPZIntPoints> result = gel->CreateSideIntegrationRule(gel->NSides()-1,integ);
1073  return result;
1074  }
1075  else{
1076  return NULL;
1077  }
1078 }
1079 
1081  if(this->fIntRule == 0){
1082  DebugStop();
1083  }
1084  if (fIntegrationRule) {
1085  return *fIntegrationRule;
1086  }
1087  else
1088  {
1089  return *(fIntRule.operator->());
1090  }
1091 }
1092 
1094  if(this->fIntRule == 0){
1095  DebugStop();
1096  }
1097  if (fIntegrationRule)
1098  {
1099  return *fIntegrationRule;
1100  }
1101  else
1102  {
1103  return *(fIntRule.operator->());
1104  }
1105 }
1106 
1109 }
1110 
1112  int result = TPZInterpolationSpace::MaxOrder();
1113  if(this->fExternalShape.operator ->()){
1114  int extOrder = this->fExternalShape->PolynomialOrder();
1115  if(extOrder > result) result = extOrder;
1116  }
1117  return result;
1118 }
1119 
1121 
1122  if (cel->NConnects() == 0) return 0.;//boundary discontinuous elements have this characteristic
1123 
1124  cel->LoadElementReference();
1125 
1126  //creating discontinuous element
1127  TPZCompMesh tempMesh(cel->Mesh()->Reference());
1128  tempMesh.InsertMaterialObject( cel->Material() );
1129 
1130  int64_t index;
1131  TPZCompElDisc * disc = new TPZCompElDisc(tempMesh, cel->Reference(), index);
1132  disc->SetTensorialShapeFull();
1133  disc->SetDegree(2*cel->MaxOrder());
1134  TPZCompElDisc * celdisc = dynamic_cast<TPZCompElDisc*>(cel);
1135  if(celdisc){
1136  disc->fExternalShape = celdisc->fExternalShape;
1137  }
1138  tempMesh.InitializeBlock();
1139 
1140  //interpolating solution
1141  disc->InterpolateSolution(*cel);
1142 
1143  //integrating residual
1144  TPZMaterial * material = disc->Material();
1145  if(!material){
1146  PZError << "Error at " << __PRETTY_FUNCTION__ << " this->Material() == NULL\n";
1147  DebugStop();
1148  return -1.;
1149  }
1150 
1151  TPZMaterialData data;
1152  disc->InitMaterialData(data);
1153  data.p = disc->MaxOrder();
1154  const int dim = disc->Dimension();
1155 
1157  int intorder = material->IntegrationRuleOrder(data.p);
1158  if(material->HasForcingFunction())
1159  {
1160  intorder = intrule->GetMaxOrder();
1161  }
1162  TPZManVector<int,3> order(dim,intorder);
1163  intrule->SetOrder(order);
1164  // material->SetIntegrationRule(intrule, data.p, dim);
1165 
1166  TPZManVector<REAL,3> intpoint(dim,0.);
1167  REAL weight = 0.;
1168 
1169  REAL SquareResidual = 0.;
1170  int intrulepoints = intrule->NPoints();
1171  for(int int_ind = 0; int_ind < intrulepoints; ++int_ind){
1172  intrule->Point(int_ind,intpoint,weight);
1173  //disc->ComputeShape(intpoint,data.x,data.jacobian,data.axes,data.detjac,data.jacinv,data.phi,data.dphix);
1174  disc->ComputeShape(intpoint, data);
1175  disc->ComputeSolution(intpoint,data.phi,data.dphix,data.axes,data.sol,data.dsol);
1176  weight *= fabs(data.detjac);
1177  SquareResidual += material->ComputeSquareResidual(data.x,data.sol[0],data.dsol[0]) * weight;
1178  }//loop over integration points
1179 
1180  delete disc;
1181  cel->LoadElementReference();
1182  cel->Mesh()->LoadReferences();
1183 
1184  return SquareResidual;
1185 
1186 }
1187 
1189 
1190  const int64_t nel = cmesh.NElements();
1191  error.Resize(nel);
1192  error.Fill(-1.);
1193  double elerror;
1194  for(int64_t iel = 0; iel < nel; iel++){
1195  if(verbose){
1196  std::cout << "Evaluating square residual of element " << iel << "\n";
1197  std::cout.flush();
1198  }
1199  TPZCompEl * cel = cmesh.ElementVec()[iel];
1200  if(!cel) continue;
1201  TPZInterpolationSpace * sp = dynamic_cast< TPZInterpolationSpace * > (cel);
1202  if(!sp) continue;
1203  if(sp->Reference()->Dimension() != 2) continue;
1205  error[iel] = elerror;
1206  }//for
1207 
1208  if(verbose){
1209  std::cout << "Evaluation of square residual completed." << "\n";
1210  std::cout.flush();
1211  }
1212 
1213 }
1214 
1216 void TPZCompElDisc::BuildCornerConnectList(std::set<int64_t> &connectindexes) const
1217 {
1218  connectindexes.insert(ConnectIndex(0));
1219 }
1220 
1223 }
1224 
1226  if (fConnectIndex < 0) {
1227  return -1;
1228  }
1229  return this->Connect(0).Order();
1230 }
int64_t NElements() const
Number of computational elements allocated.
Definition: pzcmesh.h:169
bool Material_Is_PostProcessed(int matid)
Return a directive if the material id is being postprocessed.
virtual void GetOrder(TPZVec< int > &ord) const =0
Gets the order of the integration rule for each dimension of the master element.
TPZGeoMesh * Reference() const
Returns a pointer to the geometrical mesh associated.
Definition: pzcmesh.h:209
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
Definition: pzfunction.h:38
Represents a graphical mesh used for post processing purposes. Post processing.
Definition: pzgraphmesh.h:34
virtual int ClassId() const override
Define the class id associated with the class.
Contains the TPZGraphElTd class which implements the graphical discontinuous triangular element...
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
Definition: tfadfunc.h:140
virtual void AccumulateIntegrationRule(int degree, TPZStack< REAL > &point, TPZStack< REAL > &weight)
Contains the TPZInt1d, TPZIntTriang, TPZIntQuad, TPZIntCube3D, TPZIntTetra3D, TPZIntPyram3D and TPZIn...
REAL CenterPoint(int index) const
int Position(const int block_diagonal) const
Returns the position of first element block dependent on matrix diagonal.
Definition: pzblock.h:177
virtual int NPoints() const =0
Returns number of points for the cubature rule related.
void IncrementElConnected()
Increment fNElConnected.
Definition: pzconnect.h:260
void AppendExternalShapeFunctions(TPZVec< REAL > &X, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi)
Add extenal shape function into already computed phi and dphi discontinuous functions.
virtual int NShapeF() const override
Returns the shapes number of the element.
Implements computational element and a side. Computational Element.
Definition: pzcompel.h:632
int Set(const int index, const int dim, const int pos=-1)
Modifies existing block dimensions or creates a new block with given index.
Definition: pzblock.cpp:104
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
Definition: pzconnect.h:30
TPZGeoNode * NodePtr(int i) const
Returns a pointer to the ith node of the element.
Definition: pzgeoel.cpp:2566
Definition: pzmatrix.h:52
void SolutionX(TPZVec< REAL > &x, TPZVec< STATE > &uh)
Computes the solution in function of a point in cartesian space.
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.
TPZManVector< REAL, 3 > x
value of the coordinate at the integration point
To export a graphical one dimensional discontinuous element. Post processing.
Definition: pzgraphel1dd.h:22
virtual void InitMaterialData(TPZMaterialData &data)
Initialize a material data and its attributes based on element dimension, number of state variables a...
virtual void SetCreateFunctions(TPZCompMesh *mesh) override
Set create function in TPZCompMesh to create elements of this type.
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
int MaterialId() const
Returns the material index of the element.
Definition: pzgeoel.h:250
virtual int NConnects() const override
Returns the number of connects.
void SetBlockMatrix(int row, int col, TPZFMatrix< TVar > &mat)
Sets the row,col block equal to matrix mat if row col was not specified by AddBlockNumbers, an error will be issued and exit.
Definition: pztransfer.cpp:153
virtual void resize(const int64_t newsize)
Definition: pzvec.h:213
virtual REAL ComputeSquareResidual(TPZVec< REAL > &X, TPZVec< STATE > &sol, TPZFMatrix< STATE > &dsol)
Computes square of residual of the differential equation at one integration point.
Definition: TPZMaterial.h:551
REAL Coord(int i) const
Returns i-th coordinate of the current node.
Definition: pzgnode.h:99
void SetOrder(int order, int64_t index)
Set the order of the shapefunction associated with the connect.
Definition: pzconnect.h:168
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
virtual int64_t AllocateNewConnect(int nshape, int nstate, int order)
Returns an index to a new connect.
Definition: pzcmesh.h:693
void AddBlockNumbers(int row, TPZVec< int > &colnumbers)
Will specify the sparsity pattern of row.
Definition: pztransfer.cpp:121
TPZFNMatrix< 660, REAL > dphi
values of the derivative of the shape functions over the master element
static REAL Distance(TPZVec< REAL > &centel, TPZVec< REAL > &centface)
Definition: pzgeoel.cpp:936
Contains declaration of TPZCompEl class which defines the interface of a computational element...
bool fUseQsiEta
Variable to choose the qsi point or the X point in the calculus of the phis and dphis.
Definition: TPZCompElDisc.h:79
void Read(TPZStream &buf, void *context) override
Read the element data from a stream.
groups all classes dedicated to the computation of shape functions
Definition: pzshapeextend.h:16
virtual int64_t CreateMidSideConnect()
It creates new conect that it associates the degrees of freedom of the element and returns its index...
To export a graphical two-dimensional discontinuous element. Post processing.
Definition: pzgraphelq2dd.h:16
To export a graphical three dimensional discontinuous element. Post processing.
Definition: pzgraphelq3dd.h:20
virtual const TPZIntPoints & GetIntegrationRule() const override
Returns a reference to an integration rule suitable for integrating the interior of the element...
Defines PZError.
virtual void ComputeShape(TPZVec< REAL > &intpoint, TPZVec< REAL > &X, TPZFMatrix< REAL > &jacobian, TPZFMatrix< REAL > &axes, REAL &detjac, TPZFMatrix< REAL > &jacinv, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi, TPZFMatrix< REAL > &dphidx) override
Compute shape functions based on master element in the classical FEM manner.
void degree(int root, int adj_num, int adj_row[], int adj[], int mask[], int deg[], int *iccsze, int ls[], int node_num)
Definition: rcm.cpp:875
void InternalPoint(TPZVec< REAL > &point)
Returns the center point.
virtual int Dimension() const =0
Returns the integrable dimension of the material.
Contains the TPZGraphEl class which implements the graphical one-, two- and three-dimensional element...
virtual int NStateVariables() const =0
Returns the number of state variables associated with the material.
TPZGradSolVec dsol
vector of the derivatives of the solution at the integration point
TPZFNMatrix< 9, REAL > jacinv
value of the inverse of the jacobian at the integration point
Implements the graphical element for a pyramid using a map to the cube element. Post processing...
void BuildTransferMatrix(TPZCompElDisc &coarsel, TPZTransfer< STATE > &transfer)
void SetExternalShapeFunction(TPZAutoPointer< TPZFunction< STATE > > externalShapes)
Define external shape functions which are stored in class attribute fExternalShape.
TPZGeoMesh * Mesh() const
Returns the mesh to which the element belongs.
Definition: pzgeoel.h:220
virtual int NSides() const =0
Returns the number of connectivities of the element.
virtual const TPZIntPoints & GetIntegrationRule() const override=0
Returns a reference to an integration rule suitable for integrating the interior of the element...
virtual void Divide(TPZVec< TPZGeoEl *> &pv)
Divides the element and puts the resulting elements in the vector.
Definition: pzgeoel.h:742
Contains the TPZGraphEl1d class which implements the graphical one dimensional element.
static TPZSavable * GetInstance(const int64_t &objId)
virtual int64_t NodeIndex(int i) const =0
Returns the index of the ith node the index is the location of the node in the nodevector of the mesh...
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Definition: pzmanvector.h:426
TPZFNMatrix< 9, REAL > jacobian
value of the jacobian at the integration point
virtual void ComputeSolution(TPZVec< REAL > &qsi, TPZSolVec &sol, TPZGradSolVec &dsol, TPZFMatrix< REAL > &axes) override
Computes solution and its derivatives in the local coordinate qsi.
Contains the TPZTransfer class which implements a rectangular sparse block matrix.
void LoadReferences()
Map this grid in the geometric grid.
Definition: pzcmesh.cpp:482
virtual void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
virtual void LoadElementReference()
Loads the geometric element reference.
Definition: pzcompel.cpp:601
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
int p
maximum polinomial order of the shape functions
virtual int GetSub(const int64_t sRow, const int64_t sCol, const int64_t rowSize, const int64_t colSize, TPZFMatrix< TVar > &Target) const
Gets submatrix storing it on Target.
Definition: pzmatrix.cpp:602
void CreateGraphicalElement(TPZGraphMesh &grmesh, int dimension) override
Creates corresponding graphical element(s) if the dimension matches graphical elements are used to ge...
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
Abstract class defining integration rules. Numerical Integration.
Definition: tpzintpoints.h:19
void SetConnectIndex(int, int64_t index) override
Set the index i to node inode.
void error(char *string)
Definition: testShape.cc:7
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
virtual REAL NormalizeConst()
Calculates the normalizing constant of the bases of the element.
virtual void CenterPoint(int side, TPZVec< REAL > &masscent) const =0
It returns the coordinates from the center of the side of the element in the element coordinate space...
virtual TPZIntPoints * CreateSideIntegrationRule(int side, int order)=0
Creates an integration rule for the topology of the corresponding side and able to integrate a polyno...
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
Definition: pzcompel.cpp:959
void Write(TPZStream &buf, int withclassid) const override
Save the element data to a stream.
TPZCompElDisc()
Default constructor.
Implements a graphical element for a triangle mapped into de quadrilateral element. Post processing.
bool HasExternalShapeFunction()
Return whether element has external shape functions set to.
TPZCompEl * CreateCompEl(TPZGeoEl *gel, int64_t &index)
Create a computational element based on the geometric element.
Definition: pzcmesh.h:462
int Zero() override
Makes Zero all the elements.
Definition: pzfmatrix.h:651
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Definition: pzfunction.h:86
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...
Definition: pzvec.h:373
virtual int IntegrationRuleOrder(int elPMaxOrder) const
Gets the order of the integration rule necessary to integrate an element with polinomial order p...
unsigned char Order() const
Access function to return the order associated with the connect.
Definition: pzconnect.h:217
void SetTensorialShape()
Set tensorial shape functions.
int64_t SequenceNumber() const
Returns the Sequence number of the connect object.
Definition: pzconnect.h:158
static void SetTensorialShape(TPZCompMesh *cmesh)
Sets tensorial shape functions for all Discontinuous elements in cmesh.
static const double tol
Definition: pzgeoprism.cpp:23
void Push(const T object)
Pushes a copy of the object on the stack.
Definition: pzstack.h:80
void RemoveInterfaces()
Remove interfaces connected to this element.
void EqualLevelElementList(TPZStack< TPZCompElSide > &elsidevec, int onlyinterpolated, int removeduplicates)
Returns all connected elements which have equal level to the current element This method will not put...
Definition: pzcompel.cpp:771
void SetTotalOrderShape()
Set total order shape functions.
Contains the TPZGraphElT3d class which implements the graphical representation of a tetrahedra elemen...
Implements the graphical element for a prism using a degenerated cube element. Post processing...
TPZAutoPointer< TPZIntPoints > CreateIntegrationRule() const
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
virtual void Print(std::ostream &out=std::cout) const
Print the information of the grid to an ostream.
Definition: pzgmesh.cpp:130
int HasRowDefinition(int row)
Returns 1 if the row is defined (i.e. has column entries)
Definition: pztransfer.cpp:114
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
Contains the TPZGraphElQ2dd class which implements the graphical two-dimensional discontinuous elemen...
const T & Max(const T &a, const T &b)
Returns the maximum value between a and b.
Definition: pzreal.h:724
Implements the graphical representation of a tetrahedra element. Post processing. ...
Definition: tpzgraphelt3d.h:16
int64_t Index() const
Returns the index of the element within the element vector of the mesh.
Definition: pzgeoel.h:730
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
void SetAllCreateFunctionsDiscontinuous()
Definition: pzcmesh.h:503
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
Contains declaration of TPZInterfaceElement class which computes the contribution over an interface b...
virtual void SetOrder(TPZVec< int > &ord, int type=0)=0
Sets the order of the cubature rule.
void SetAllCreateFunctions(TPZCompEl &cel)
Definition: pzcmesh.h:537
virtual void ExpandSolution()
Adapt the solution vector to new block dimensions.
Definition: pzcmesh.cpp:396
Contains the TPZGraphElPrismMapped class which implements the graphical element for a prism using a d...
static void Convert2Axes(const TPZFMatrix< REAL > &dphi, const TPZFMatrix< REAL > &jacinv, TPZFMatrix< REAL > &dphidx)
convert a shapefunction derivative in xi-eta to a function derivative in axes
TPZCompMesh * Mesh() const
Return a pointer to the grid of the element.
Definition: pzcompel.cpp:288
Contains declaration of TPZConnect class which represents a set of shape functions associated with a ...
Free store vector implementation.
int ClassId() const override
Returns the unique identifier for reading/writing objects to streams.
void SetNState(int nstate)
Set the number of state variables.
Definition: pzconnect.h:196
int Dimension() const
Returns the dimension of the simulation.
Definition: pzcmesh.h:148
TPZAutoPointer< TPZFunction< STATE > > fExternalShape
A pz function to allow the inclusion of extra shape functions which are defined externally.
Definition: TPZCompElDisc.h:82
void Jacobian(TPZVec< REAL > &qsi, TPZFMatrix< REAL > &jac, TPZFMatrix< REAL > &axes, REAL &detjac, TPZFMatrix< REAL > &jacinv) const
Compute a decomposition of the gradient of the mapping function, as a rotation matrix (Jacobian) and ...
Definition: pzgeoel.cpp:1144
int64_t fConnectIndex
It preserves index of connect associated to the element.
Definition: TPZCompElDisc.h:73
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
Definition: pzgmesh.h:140
TPZCompEl * Reference() const
Return a pointer to the element referenced by the geometric element.
Definition: pzgeoel.h:750
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
void Shape(TPZVec< REAL > &pt, TPZVec< int > orders, TPZVec< TPZTransform< REAL > > &transvec, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi)
void SetNShape(int nshape)
Set the number of shape functions associated with the connect.
Definition: pzconnect.h:205
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
Definition: tfadfunc.h:120
Contains the TPZGraphElT class which implements the graphical triangular element. ...
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
Definition: pzcmesh.h:213
Contains declaration of the TPZAutoPointer class which has Increment and Decrement actions are mutexe...
Contains the TPZGraphMesh class which represents a graphical mesh used for post processing purposes...
virtual int NFunctions() const
number of values returned by this function
Definition: pzfunction.h:71
virtual void AccumulateVertices(TPZStack< TPZGeoNode *> &nodes)
Accumulates the vertices of the agglomerated elements.
virtual int NConnectShapeF(int inod, int order) const override
Returns the number of shapefunctions associated with a connect.
Contains the TPZGraphElPyramidMapped class which implements the graphical element for a pyramid using...
Contains declaration of TPZCompelDisc class which implements a computational element for discontinuou...
TPZIntPoints * fIntegrationRule
Integration rule established by the user.
Definition: pzcompel.h:590
TPZAdmChunkVector< TPZConnect > & ConnectVec()
Return a reference to the connect pointers vector.
Definition: pzcmesh.h:198
Contains the TPZMaterialData class which implements an interface between TPZCompEl::CalcStiff and TPZ...
virtual int HasForcingFunction()
Directive that gives true if the material has a forcing function.
Definition: TPZMaterial.h:472
int MaxOrderExceptExternalShapes()
Returns the max order of interpolation excluding external shape order.
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Definition: pzlog.h:93
Contains declaration of TPZCompMesh class which is a repository for computational elements...
pzshape::TPZShapeDisc::MShapeType fShapefunctionType
Shape function type used by the element.
Definition: TPZCompElDisc.h:46
virtual TPZConnect & Connect(int i) const
Returns a pointer to the ith node.
Definition: pzcompel.cpp:298
void InterpolateSolution(TPZInterpolationSpace &coarsel)
Interpolates the solution into the degrees of freedom nodes from the degrees of freedom nodes from th...
int64_t ConnectIndex(int side=0) const override
Returns the connect index from the element.
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
Contains TPZMatrix<TVar>class, root matrix class.
TPZManVector< REAL, 3 > fCenterPoint
It keeps the interior point coordinations of the element.
Definition: TPZCompElDisc.h:87
virtual ~TPZCompElDisc()
Default destructor.
virtual int NNodes() const =0
Returns the number of nodes of the element.
Implements the interfaces for TPZCompElDisc, TPZInterfaceElement and TPZInterpolatedElement. Computational element.
virtual int NConnects() const =0
Returns the number of nodes of the element.
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
Definition: pzreal.h:487
void SetTensorialShapeFull()
Set tensorial shape functions with many derivatives.
int InsertMaterialObject(TPZMaterial *mat)
Insert a material object in the datastructure.
Definition: pzcmesh.cpp:287
virtual void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
static void SetTotalOrderShape(TPZCompMesh *cmesh)
Set total order shape functions for all Discontinuous elements in cmesh.
virtual int MaxOrder() override
Returns the max order of interpolation.
virtual int Dimension() const =0
Returns the dimension of the element.
virtual void Print(std::ostream &out=std::cout) const override
Prints the features of the element.
REAL dist(TPZVec< T1 > &vec1, TPZVec< T1 > &vec2)
Definition: pzvec_extras.h:124
virtual void Shape(TPZVec< REAL > &qsi, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphidxi) override
Computes the shape function set at the point x. This method uses the order of interpolation of the el...
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
Definition: pzcompel.cpp:1137
Implements a geometric node in the pz environment. Geometry.
Definition: pzgnode.h:31
virtual void X(TPZVec< REAL > &qsi, TPZVec< REAL > &result) const =0
Return the coordinate in real space of the point coordinate in the master element space...
virtual REAL SideArea(int side)
Returns the area from the face.
Definition: pzgeoel.cpp:1064
virtual int GetMaxOrder() const
Returns the minimum order to integrate polinomials exactly for all implemented cubature rules...
Definition: pzquad.cpp:30
int verbose
Definition: decompose.cpp:67
void ResetReference()
Reset the element referenced by the geometric element to NULL.
Definition: pzgeoel.h:431
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
int Size(const int block_diagonal) const
Returns block dimension.
Definition: pzblock.h:171
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Definition: pzcmesh.h:183
virtual void Print(std::ostream &out=std::cout) const
Prints element data.
Definition: pzcompel.cpp:322
void SetReference(TPZCompEl *elp)
Make the current element reference to the computational element.
Definition: pzgeoel.h:746
Contains the TPZGraphElT2dMapped class which implements a graphical element for a triangle mapped int...
int Id() const
Definition: TPZMaterial.h:170
void Fill(const T &copy, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
Definition: pzvec.h:460
Contains the declaration of the shape function discontinuous.
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
virtual void SetDegree(int degree)
Assigns the degree of the element.
virtual int MaxOrder()
Returns the max order of interpolation.
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Definition: pzfmatrix.cpp:1016
virtual int Degree() const
Returns the degree of interpolation of the element.
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
REAL fConstC
Normalizing constant for shape functions.
Definition: TPZCompElDisc.h:76
Contains the TPZGraphEl1dd class which implements the graphical one dimensional discontinuous element...
void Divide(int64_t index, TPZVec< int64_t > &subindex, int interpolate=0) override
Divide the computational element.
virtual TPZIntPoints * Clone() const =0
Make a clone of the related cubature rule.
void SetTrueUseQsiEta()
This class implements a discontinuous element (for use with discontinuous Galerkin). Computational Element.
Definition: TPZCompElDisc.h:35
virtual void ShapeX(TPZVec< REAL > &X, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi)
Implements rectangular matrix which extends a solution vector of the coarse mesh to a solution vector...
Definition: pzcmesh.h:33
virtual int NInterfaces()
Returns the number of interfaces.
int fPreferredOrder
Preferred polynomial order.
int Dimension() const override
Returns dimension from the element.
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
TPZSolVec sol
vector of the solutions at the integration point
virtual int NSubElements() const =0
Returns the number of subelements of the element independent of the fact whether the element has alr...
int GetDefaultOrder()
Definition: pzcmesh.h:398
void SetTotalOrderShapeFull()
Set total order shape functions.
Contains the TPZGraphElQ3dd class which implements the graphical three dimensional discontinuous elem...
virtual void BuildCornerConnectList(std::set< int64_t > &connectindexes) const override
adds the connect indexes associated with base shape functions to the set
int64_t fIndex
Element index into mesh element vector.
Definition: pzcompel.h:67
TPZFMatrix< STATE > & Solution()
Access the solution vector.
Definition: pzcmesh.h:219
REAL detjac
determinant of the jacobian
virtual int PolynomialOrder() const
Polynomial order of this function. In case of non-polynomial function it can be a reasonable approxim...
Definition: pzfunction.h:66
static void WritePointer(const TPZSavable *obj, TPZStream *stream)
virtual MElementType Type() override
Type of the element.
Implements an interface to register a class id and a restore function. Persistence.
Definition: TPZSavable.h:150
virtual int SolveDirect(TPZFMatrix< TVar > &F, const DecomposeType dt, std::list< int64_t > &singular)
Solves the linear system using Direct methods.
Definition: pzmatrix.cpp:710
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716
virtual void Point(int i, TPZVec< REAL > &pos, REAL &w) const =0
Returns i-th point at master element and related weight.
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
TPZCompMesh * fMesh
Computational mesh to which the element belongs.
Definition: pzcompel.h:64
static REAL EvaluateSquareResidual2D(TPZInterpolationSpace *cel)
Compute the integral of the square residual over the element domain.
virtual void Print(std::ostream &out=std::cout) const
Prints mesh data.
Definition: pzcmesh.cpp:236
virtual void Read(bool &val)
Definition: TPZStream.cpp:91
This class implements a reference counter mechanism to administer a dynamically allocated object...
TPZAutoPointer< TPZIntPoints > fIntRule
Definition: TPZCompElDisc.h:43