NeoPZ
pzelchdivbound2.cpp
Go to the documentation of this file.
1 
7 #include "pzelchdivbound2.h"
8 #include "pzgeoel.h"
9 #include "TPZMaterial.h"
10 #include "pzlog.h"
11 #include "TPZShapeDisc.h"
12 #include "TPZCompElDisc.h"
13 #include "pzmaterialdata.h"
14 #include "pzelchdiv.h"
15 
16 
17 #ifdef LOG4CXX
18 static LoggerPtr logger(Logger::getLogger("pz.mesh.TPZCompElHDivBound2"));
19 #endif
20 
21 template<class TSHAPE>
24 TPZIntelGen<TSHAPE>(mesh,gel,index,1), fSideOrient(1){
25 
26  //int i;
28  //for(i=0; i<TSHAPE::NSides; i++) this->fConnectIndexes[i]=-1;
29  this->fConnectIndexes[0]=-1;
30  gel->SetReference(this);
32 
33  this->fConnectIndexes[0] = this->CreateMidSideConnect(TSHAPE::NSides-1);
34 #ifdef LOG4CXX
35  if (logger->isDebugEnabled())
36  {
37  std::stringstream sout;
38  sout << "After creating boundary flux connect " << this->fConnectIndexes[0] << std::endl;
39  // this->Print(sout);
40  LOGPZ_DEBUG(logger,sout.str())
41  }
42 #endif
43 
44  mesh.ConnectVec()[this->fConnectIndexes[0]].IncrementElConnected();
45 
46 
47  //TPZGeoElSide myInnerSide(gel,gel->NSides()-1);
48 // TPZGeoElSide neigh = myInnerSide.Neighbour();
49 // while(!neigh.Reference())
50 // {
51 // neigh = neigh.Neighbour();
52 // }
53 // if(neigh == myInnerSide)
54 // {
55 // /**
56 // O codigo pressupoe que os elementos computacionais 2D sao criados antes dos 1D.
57 // Quando serao criados os elementos computacionais 1D, os respectivos vizinhos 2D sao encontrados.
58 // Situacoes assim ocorrem (neste algoritmo) quando eh realizado refinamento uniforme, pois os primeiros elementos sem descendentes sao os 2D (e depois os descendentes 1D de contorno)
59 //
60 // Ocorreu o problema quando tentou-se realizar o refinamento do quadrilatero em 02 triangulos, em que o quadrilatero apresenta descendentes e as arestas nao.
61 // Neste caso a criacao de elementos computacionais eh iniciada pelos 1D, fazendo com que nao encontrem vizinhos computacionais 2D.
62 // Com isso a variavel int connectIndex0 eh setada com -1, dando o BUG observado.
63 // */
64 // std::cout << "Nao foi encontrado elemento 2D com elemento computacional inicializado!!!\n";
65 // DebugStop();
66 // }
67 // TPZCompElSide compneigh(neigh.Reference());
68 // fneighbour = compneigh;
69 // int sideoffset = neigh.Element()->NSides()-neigh.Side();
70 // int neighnconnects = compneigh.Element()->NConnects();
71 // int connectnumber = neighnconnects-sideoffset;
72 // TPZInterpolatedElement *intel = dynamic_cast<TPZInterpolatedElement *> (compneigh.Element());
73 // connectnumber = intel->SideConnectLocId(0,compneigh.Side());
74 // int connectIndex0 = compneigh.Element()->ConnectIndex(connectnumber);
75 //
76 // this->fConnectIndexes[0] = connectIndex0;
77 // mesh.ConnectVec()[connectIndex0].IncrementElConnected();
78 
79 #ifdef LOG4CXX
80  if (logger->isDebugEnabled())
81  {
82  std::stringstream sout;
83 
84  sout << std::endl<<" Criando Connects: "<< std::endl;
85  for(int j=0; j< NConnects();j++)
86  {
87  sout<<" "<< this->fConnectIndexes[j];
88 
89  }
90  LOGPZ_DEBUG(logger,sout.str())
91  }
92 #endif
93  int sideorder = EffectiveSideOrder(TSHAPE::NSides-1);
94  sideorder = 2*sideorder;
95  if (sideorder > this->fIntRule.GetMaxOrder()) sideorder = this->fIntRule.GetMaxOrder();
96  // TPZManVector<int,3> order(3,2*sideorder+2);
97  TPZManVector<int,3> order(3,sideorder);
98  //TPZManVector<int,3> order(3,20);
99  this->fIntRule.SetOrder(order);
100 
101 #ifdef LOG4CXX
102  if (logger->isDebugEnabled())
103  {
104  std::stringstream sout;
105  sout << "Finalizando criacao do elemento ";
106  this->Print(sout);
107  LOGPZ_DEBUG(logger,sout.str())
108  }
109 #endif
110 
111 }
112 
113 template<class TSHAPE>
117 {
118 // for(int i=0;i<TSHAPE::NSides;i++)
119 // {
120 // this-> fConnectIndexes[i] = copy.fConnectIndexes[i];
121 // }
122  if (copy.fneighbour)
123  {
124  int64_t index = copy.fneighbour.Element()->Index();
125  TPZCompEl *cel = this->Mesh()->ElementVec()[index];
126  if (!cel) {
127  DebugStop();
128  }
129  fneighbour = TPZCompElSide(cel,copy.fneighbour.Side());
130  }
131 }
132 
133 // NAO TESTADO
134 template<class TSHAPE>
136  const TPZCompElHDivBound2<TSHAPE> &copy,
137  std::map<int64_t,int64_t> & gl2lcConMap,
138  std::map<int64_t,int64_t> & gl2lcElMap) :
140 TPZIntelGen<TSHAPE>(mesh,copy,gl2lcConMap,gl2lcElMap), fSideOrient(copy.fSideOrient)
141 {
142 
143  this-> fPreferredOrder = copy.fPreferredOrder;
144  int i;
145  for(i=0;i<TSHAPE::NSides;i++)
146  {
147  int64_t lcIdx = -1;
148  int64_t glIdx = copy.fConnectIndexes[i];
149  if(glIdx == -1)
150  {
151  // nothing to clone
152  this->fConnectIndexes[i] = -1;
153  continue;
154  }
155  if (gl2lcConMap.find(glIdx) != gl2lcConMap.end())
156  {
157  lcIdx = gl2lcConMap[glIdx];
158  }
159  else
160  {
161  std::stringstream sout;
162  sout << "ERROR in : " << __PRETTY_FUNCTION__
163  << " trying to clone the connect index: " << glIdx
164  << " wich is not in mapped connect indexes!";
165  LOGPZ_ERROR(logger, sout.str().c_str());
166  this-> fConnectIndexes[i] = -1;
167  return;
168  }
169  this-> fConnectIndexes[i] = lcIdx;
170  }
171  // gl2lcElMap[copy.fIndex] = this->Index();
172 
173  int64_t neiIdx = copy.fneighbour.Element()->Index();
174  if(gl2lcElMap.find(neiIdx)==gl2lcElMap.end())
175  {
176  DebugStop();
177  }
178  TPZCompEl *cel = mesh.ElementVec()[gl2lcElMap[neiIdx]];
179  if (!cel) {
180  DebugStop();
181  }
182  fneighbour = TPZCompElSide(cel,copy.fneighbour.Side());
183 }
184 
185 // TESTADO
186 template<class TSHAPE>
189 TPZIntelGen<TSHAPE>(),fneighbour()
190 {
191  this->fPreferredOrder = -1;
192  int i;
193  for(i=0;i<TSHAPE::NSides;i++) {
194  this-> fConnectIndexes[i] = -1;
195  }
196 }
197 
198 // TESTADO
199 template<class TSHAPE>
201  TPZGeoEl *gel = this->Reference();
202  if (gel && gel->Reference() != this) {
203  return;
204  }
205  int side = TSHAPE::NSides-1;
206  TPZGeoElSide gelside(this->Reference(),side);
207  TPZStack<TPZCompElSide> celstack;
208  TPZCompElSide largecel = gelside.LowerLevelCompElementList2(0);
209  if (largecel) {
210  int cindex = SideConnectLocId(0, side);
211  TPZConnect &c = this->Connect(cindex);
212  c.RemoveDepend();
213  }
214  gelside.HigherLevelCompElementList3(celstack, 0, 1);
215  int64_t ncel = celstack.size();
216  for (int64_t el=0; el<ncel; el++) {
217  TPZCompElSide celsidesmall = celstack[el];
218  TPZGeoElSide gelsidesmall = celsidesmall.Reference();
219  if (gelsidesmall.Dimension() != gel->Dimension()) {
220  continue;
221  }
222  TPZCompEl *cel = celsidesmall.Element();
223  TPZInterpolatedElement *intel = dynamic_cast<TPZInterpolatedElement *>(cel);
224  if (!intel) {
225  DebugStop();
226  }
227  int cindex = intel->SideConnectLocId(0, celsidesmall.Side());
228  TPZConnect &c = intel->Connect(cindex);
229  c.RemoveDepend();
230  }
231  if (gel){
232  gel->ResetReference();
233  }
234 
235 }
236 
237 // NAO TESTADO
238 template<class TSHAPE>
240  return TSHAPE::Type();
241 }
242 
243 // NAO TESTADO
244 template<class TSHAPE>
245 void TPZCompElHDivBound2<TSHAPE>::SetSideOrient(int side, int sideorient)
246 {
247  if (side != TSHAPE::NSides - 1) {
248  DebugStop();
249  }
250  fSideOrient = sideorient;
251 }
252 
253 // NAO TESTADO
254 template<class TSHAPE>
256 {
257  if (side != TSHAPE::NSides - 1) {
258  DebugStop();
259  }
260  return fSideOrient;
261 }
262 
263 template<class TSHAPE>
265 
266  return 1;
267 }
268 
269 template<class TSHAPE>
270 void TPZCompElHDivBound2<TSHAPE>::SetConnectIndex(int i, int64_t connectindex)
271 {
272  if(i)
273  {
274  DebugStop();
275  }
276  this->fConnectIndexes[i] = connectindex;
277 
278 }
279 
280 template<class TSHAPE>
281 int TPZCompElHDivBound2<TSHAPE>::NConnectShapeF(int connect, int connectorder) const
282 {
283  if(connect == 0)
284  {
285 
286  TPZManVector<int,22> order(TSHAPE::NSides-TSHAPE::NCornerNodes,connectorder);
287  return TSHAPE::NShapeF(order);
288  }
289  return -1;
290 }
291 
292 template<class TSHAPE>
294 {
295  if(side == TSHAPE::NSides-1)
296  {
297  return 1;
298  }
299  return 0;
300 }
301 
302 template<class TSHAPE>
304 {
305  if(side == TSHAPE::NSides-1 && node == 0)
306  {
307  return 0;
308  }
309  else{
310  return -1;
311  }
312 
313 }
314 
315 //Identifies the interpolation order on the connects of the element
316 template<class TSHAPE>
318  int myorder = ConnectOrder(0);
319  ord.Resize(TSHAPE::NSides-TSHAPE::NCornerNodes, 0);
320  int i;
321  for(i=0; i<ord.size(); i++) {
322  ord[i] = myorder;
323  }
324 }
325 
326 //return the preferred order of the polynomial along connect connect
327 template<class TSHAPE>
329  if(side != TSHAPE::NSides-1)
330  {
331  PZError << __PRETTY_FUNCTION__ << " side " << side << std::endl;
332  }
333  int connect= 0;
334  int order =this->fPreferredOrder;
335  return this->AdjustPreferredSideOrder(connect,order);
336 }
337 
338 //sets the interpolation order of side to order
339 template<class TSHAPE>
340 void TPZCompElHDivBound2<TSHAPE>::SetSideOrder(int side, int order) {
341  int connectaux= SideConnectLocId(0,side);
342  if(connectaux<0 || connectaux > this-> NConnects()) {
343  PZError << "TPZCompElHDiv::SetSideOrder. Bad paramenter side " << side << " order " << order << std::endl;
344 #ifdef LOG4CXX
345  std::stringstream sout;
346  sout << __PRETTY_FUNCTION__ << " Bad side or order " << side << " order " << order;
347  LOGPZ_DEBUG(logger,sout.str())
348 #endif
349  return;
350  }
351  TPZConnect &c = this->Connect(connectaux);
352  c.SetOrder(order,this->fConnectIndexes[connectaux]);
353  int64_t seqnum = c.SequenceNumber();
354  int nvar = 1;
355  TPZMaterial * mat =this-> Material();
356  if(mat) nvar = mat->NStateVariables();
357  int nshape = NConnectShapeF(connectaux,order);
358  c.SetNShape(nshape);
359  c.SetNState(nvar);
360  this-> Mesh()->Block().Set(seqnum,nshape*nvar);
361  if(connectaux == NConnects()-1)
362  {
363  this->SetIntegrationRule(2*order);
364  }
365 }
366 
370 template<class TSHAPE>
372 {
373 
374  if (connect < 0 || connect >= this->NConnects())
375  {
376 #ifdef LOG4CXX
377  {
378  std::stringstream sout;
379  sout << "Connect index out of range connect " << connect <<
380  " nconnects " << NConnects();
381  LOGPZ_DEBUG(logger,sout.str())
382  }
383 #endif
384  return -1;
385  }
386 
387  if (this->fConnectIndexes[connect] == -1) {
388  std::stringstream sout;
389  sout << __PRETTY_FUNCTION__ << " connect " << connect
390  << " is not initialized" << std::endl;
391 #ifdef LOG4CXX
392  LOGPZ_ERROR(logger,sout.str());
393  DebugStop();
394 #else
395  std::cout << sout.str() << std::endl;
396 #endif
397  return -1;
398  }
399  const TPZConnect &c = this-> Connect(connect);
400  return c.Order();
401 }
402 
407 template<class TSHAPE>
409 {
412 
413 #ifdef LOG4CXX
414  if (logger->isDebugEnabled())
415  {
416  LOGPZ_DEBUG(logger,"Initializing normal vectors")
417  }
418 #endif
419 
420  //data.fVecShapeIndex=true;
421  /*
422  TPZGeoElSide gelside(this->Reference(),TSHAPE::NSides-1);
423  TPZGeoElSide neighbour = gelside.Neighbour();
424  while(gelside != neighbour && neighbour.Element()->Dimension() != TSHAPE::Dimension+1)
425  {
426  neighbour = neighbour.Neighbour();
427  }
428  if(neighbour.Element()->Dimension() != TSHAPE::Dimension+1)
429  {
430  DebugStop();
431  }
432  TPZGeoEl *neighel = neighbour.Element();
433  TPZManVector<int,9> normalsides;
434 // TPZFNMatrix<100,REAL> normalvec;
435  neighel->ComputeNormals(neighbour.Side(),data.fNormalVec, normalsides);
436 //#ifdef LOG4CXX
437 // {
438 // std::stringstream sout;
439 // sout << "normal side depois do ComputeNormals " << normalsides << std::endl;
440 // LOGPZ_DEBUG(logger,sout.str())
441 // }
442 //#endif
443 
444  // relate the sides indicated in vecindex to the sides of the current element
445  int64_t nvec = normalsides.NElements();
446  int64_t ivec;
447  for(ivec=0; ivec<nvec; ivec++)
448  {
449  TPZGeoElSide neigh(neighel,normalsides[ivec]);
450 //#ifdef LOG4CXX
451 // {
452 // std::stringstream sout;
453 // sout << "normal side depois do TPZGeoElSide " << normalsides << std::endl;
454 // LOGPZ_DEBUG(logger,sout.str())
455 // }
456 //#endif
457  while(neigh.Element() != this->Reference())
458  {
459 
460  neigh = neigh.Neighbour();
461  }
462 
463  normalsides[ivec]=neigh.Side();
464  }
465  IndexShapeToVec(normalsides,data.fVecShapeIndex);
466  data.numberdualfunctions = 0;
467 #ifdef LOG4CXX
468  {
469  std::stringstream sout;
470  data.fNormalVec.Print("Normal vectors", sout);
471  sout << "Vector/Shape indexes " << data.fVecShapeIndex << std::endl;
472  LOGPZ_DEBUG(logger,sout.str())
473  }
474 #endif
475  */
476 }
477 
478 template<class TSHAPE>
480 
481  TPZManVector<int64_t> firstshapeindex; // Para o que?
482  FirstShapeIndex(firstshapeindex); // se foram calculados os indices mas n�o utilizados?
483  int nshape = TPZIntelGen<TSHAPE>::NShapeF();
484  shapeindex.Resize(nshape);
485  int64_t nsides = sides.NElements();
486  int64_t is, count=0;
487  for(is=0 ; is<nsides; is++)
488  {
489  int side = sides[is];
490  int sideorder= this->EffectiveSideOrder(side);
491  int NShapeFace = TSHAPE::NConnectShapeF(side,sideorder);
492  int ishapeface;
493  for(ishapeface=0; ishapeface<NShapeFace; ishapeface++)
494  {
495  shapeindex[count++] = is;
496  }
497  }
498  shapeindex.Resize(count);
499  #ifdef LOG4CXXTPZCompElHDivBound2
500  {
501  std::stringstream sout;
502  sout << "count = " << count << " nshape " << nshape;
503  sout << std::endl<<"sides associated with the normals "<< sides <<
504  "\nnormal associated with each shape function : shape function indexes " << shapeindex;
505  LOGPZ_DEBUG(logger,sout.str())
506  }
507 #endif
508 
509 }
510 
512 template<class TSHAPE>
514 
515  Index.Resize(TSHAPE::NSides+1);
516  Index[0]=0;
517  int order = ConnectOrder(0);
518 
519  for(int iside=0;iside<TSHAPE::NSides;iside++)
520  {
521 
522  if(TSHAPE::Type()==EQuadrilateral){
523  Index[iside+1] = Index[iside] + TSHAPE::NConnectShapeF(iside,order);
524  }
525  else{
526  Index[iside+1] = Index[iside] + TSHAPE::NConnectShapeF(iside,order);
527  }
528  }
529 
530 #ifdef LOG4CXX
531  if (logger->isDebugEnabled())
532  {
533  std::stringstream sout;
534  sout << " FirsShapeIndex result " << Index;
535  LOGPZ_DEBUG(logger,sout.str())
536  }
537 #endif
538 
539 
540 }
541 
542 template<class TSHAPE>
544 
545  if(TSHAPE::SideDimension(side)!= TSHAPE::Dimension || point.size() != TSHAPE::Dimension ){
546  DebugStop() ;
547  }
548  TPZGeoEl *gel = this->Reference();
549  int nc = gel->NCornerNodes();
551  for (int ic=0; ic<nc; ic++) {
552  id[ic] = gel->Node(ic).Id();
553  }
555  this->GetInterpolationOrder(ord);
556 
557  TPZFNMatrix<50,REAL> philoc(phi.Rows(),phi.Cols()),dphiloc(dphi.Rows(),dphi.Cols());
558  TSHAPE::Shape(point,id,ord,philoc,dphiloc);
559 
560  //int idsize = id.size();
561  TPZManVector<int,9> permutegather(TSHAPE::NSides);
562  int transformid = TSHAPE::GetTransformId(id);
563  TSHAPE::GetSideHDivPermutation(transformid, permutegather);
564 
565  TPZManVector<int64_t,27> FirstIndex(TSHAPE::NSides+1);
566  FirstShapeIndex(FirstIndex);
567 
568  REAL detjac;
569  {
570  int dim = gel->SideDimension(side);
571  TPZFNMatrix<9,REAL> jac(dim,dim),jacinv(dim,dim),axes(dim,3);
572  gel->Jacobian(point, jac, axes, detjac, jacinv);
573  }
574 
575 
576  int order = this->Connect(0).Order();
577  for (int side=0; side < TSHAPE::NSides; side++) {
578  int ifirst = FirstIndex[side];
579  int kfirst = FirstIndex[permutegather[side]];
580  int nshape = TSHAPE::NConnectShapeF(side,order);
581  for (int i=0; i<nshape; i++) {
582  phi(ifirst+i,0) = philoc(kfirst+i,0)/detjac;
583  for (int d=0; d< TSHAPE::Dimension; d++) {
584  dphi(d,ifirst+i) = dphiloc(d,kfirst+i)/detjac;
585  }
586  }
587  }
588 
589  return;
590 }
591 
593 template<class TSHAPE>
595 {
597  this->GetInterpolationOrder(ordl);
598  TPZConnect &c = this->Connect(0);
599  int nshape = NConnectShapeF(0,c.Order());
600  phi.Resize(nshape, 1);
601  dphi.Resize(TSHAPE::Dimension, nshape);
602  SideShapeFunction(TSHAPE::NSides-1, pt, phi, dphi);
603 
604 
605  if (fSideOrient == -1) {
606  phi *= -1.;
607  dphi *= -1.;
608  }
609 
610 
611 
612  return;
613  /*
614  TPZCompElSide thisside(this,TSHAPE::NSides-1);
615  TPZGeoElSide thisgeoside(thisside.Reference());
616  TPZGeoElSide neighgeo(thisgeoside.Neighbour());
617  TPZCompElSide neigh(fneighbour);
618  TPZInterpolatedElement *neighel = dynamic_cast<TPZInterpolatedElement *> (neigh.Element());
619  if(!neighel)
620  {
621  LOGPZ_ERROR(logger,"Inconsistent neighbour")
622  DebugStop();
623  return;
624  }
625  int nshapeneigh = neighel->NSideShapeF(neighgeo.Side())+1;
626  phi.Redim(nshapeneigh, 1);
627  dphi.Redim(neighgeo.Element()->Dimension(), nshapeneigh);
628  TPZTransform<> tr(thisgeoside.Dimension()),tr2;
629  thisgeoside.SideTransform3(neighgeo, tr);
630  TPZManVector<REAL,3> pt2(neighgeo.Dimension()),pt3(neighel->Dimension());
631  tr.Apply(pt, pt2);
632  neighel->SideShapeFunction(neigh.Side(), pt2, phi, dphi);
633  */
634  //tentando reimplementar
635  TPZManVector<int64_t,TSHAPE::NSides-1> id(TSHAPE::NSides-1,0);
636 
637  TPZGeoEl *ref = this->Reference();
638  int nnodes= ref->NNodes();
639  for(int i=0; i<nnodes; i++) {
640  id[i] = ref->NodePtr(i)->Id();
641  }
642 
643 #ifdef LOG4CXX
644  {
645  std::stringstream sout;
646  sout<< "---Id local---"<<id<<std::endl;
647  LOGPZ_DEBUG(logger,sout.str())
648  }
649 #endif
650 
651  //-----ordenando os id's
652 // int i, j, min, x;
653 // for (i = 0; i < nnodes; ++i) {
654 // min = i;
655 // for (j = i+1; j < nnodes; ++j){
656 // if (id[j] < id[min]) min = j;
657 // x = id[i];
658 // id[i] = id[min];
659 // id[min] = x;
660 // }
661 // }
662 
663 #ifdef LOG4CXX
664  {
665  std::stringstream sout;
666  sout<< "---Id local Reordenado---"<<id<<std::endl;
667  LOGPZ_DEBUG(logger,sout.str())
668  }
669 #endif
670 
671  //-----
672 
673 
674  TPZCompElSide thisside(this,TSHAPE::NSides-1);
675  TPZGeoElSide thisgeoside(thisside.Reference());
676 // TPZGeoElSide neighgeo(thisgeoside.Neighbour());
677 // TPZCompElSide neigh(fneighbour);
678  TPZInterpolatedElement *neighel = dynamic_cast<TPZInterpolatedElement *> (thisside.Element());
679 // if(!neighel)
680 // {
681 // LOGPZ_ERROR(logger,"Inconsistent neighbour")
682 // DebugStop();
683 // return;
684 // }
685  int nshapeneigh = neighel->NSideShapeF(thisgeoside.Side());
686  phi.Redim(nshapeneigh, 1);
687  dphi.Redim(thisgeoside.Element()->Dimension(), nshapeneigh);
688  TPZVec<int> ord;
689  neighel->GetInterpolationOrder(ord);
690  TSHAPE::Shape(pt,id,ord,phi,dphi);
691 // if(id[0] > id[1])
692 // {
693 // REAL phival = phi(0,0);
694 // phi(0,0) = phi(1,0);
695 // phi(1,0) = phival;
696 // REAL dphival = dphi(0,0);
697 // dphi(0,0) = dphi(0,1);
698 // dphi(0,1) = dphival;
699 // }
700 
701 
702 // TPZTransform<> tr(thisgeoside.Dimension()),tr2;
703 // thisgeoside.SideTransform3(thisgeoside, tr);
704 // TPZManVector<REAL,3> pt2(thisgeoside.Dimension()),pt3(neighel->Dimension());
705 // tr.Apply(pt, pt2);
706 // neighel->SideShapeFunction(thisside.Side(), pt2, phi, dphi);
707 
708 #ifdef LOG4CXX
709  //if (logger->isDebugEnabled())
710  {
711  std::stringstream sout;
712  sout.precision(20);
713  sout<< "---Phi Novo---"<<phi<<std::endl;
714  sout<< "---Dphi Novo---"<<dphi<<std::endl;
715  LOGPZ_DEBUG(logger,sout.str())
716  }
717 #endif
718 }
719 
720 template<class TSHAPE>
722 
723  this->Shape(intpoint, data.phi, data.dphi);
724 
725  TPZGeoEl *ref = this->Reference();
726  ref->Jacobian(intpoint, data.jacobian, data.axes, data.detjac, data.jacinv);
727 
728 }
729 
730 template<class TSHAPE>
732  REAL &detjac, TPZFMatrix<REAL> &jacinv, TPZFMatrix<REAL> &phi, TPZFMatrix<REAL> &dphi, TPZFMatrix<REAL> &dphidx){
733 
734  std::cout << "Method not implement call the architec." << std::endl;
735  DebugStop();
736 
737 }
738 
740 template<class TSHAPE>
742 {
743  TPZIntelGen<TSHAPE>::Read(buf,context);
744  buf.Read(&fSideOrient);
745 }
746 
748 template<class TSHAPE>
749 void TPZCompElHDivBound2<TSHAPE>::Write(TPZStream &buf, int withclassid) const
750 {
751  TPZIntelGen<TSHAPE>::Write(buf,withclassid);
752  buf.Write(&fSideOrient);
753 }
754 
756 template<class TSHAPE>
757 void TPZCompElHDivBound2<TSHAPE>::Print(std::ostream &out) const
758 {
759  out << __PRETTY_FUNCTION__ << std::endl;
760  out << "Side orientation " << fSideOrient << std::endl;
761  if (fRestraint.IsInitialized()) {
762  fRestraint.Print(out);
763  }
765 
766 
767 }
768 
770 template<class TSHAPE>
772 {
773  if(side == TSHAPE::NSides-1)
774  {
775  return ConnectOrder(0);
776  }
777  else {
778  return -1;
779  }
780 }
781 
783 template<class TSHAPE>
784 void TPZCompElHDivBound2<TSHAPE>::IndexShapeToVec(TPZVec<int> &VectorSide,TPZVec<std::pair<int,int64_t> > & ShapeAndVec){
785 
786  // VectorSide indicates the side associated with each vector entry
787  TPZVec<int64_t> FirstIndex;
788  // the first index of the shape functions
789  FirstShapeIndex(FirstIndex);
790 #ifdef LOG4CXX
791  {
792  std::stringstream sout;
793  sout << "FirstIndex of shape functions " << FirstIndex;
794  LOGPZ_DEBUG(logger,sout.str())
795  }
796 #endif
797 
798  int tamanho= this->NShapeF();
799 
800  ShapeAndVec.Resize(tamanho);
801  int64_t count=0;
802  //for(int jvec=0;jvec< VectorSide.NElements();jvec++)
803  for(int64_t jvec=0;jvec< VectorSide.NElements();jvec++)//coloca-se -1 caso queira reduzir o espaco de fluxo
804  {
805  int lside=VectorSide[jvec];
806  int64_t fshape1= FirstIndex[lside];
807  int64_t fshape2= FirstIndex[lside+1];
808  for (int64_t ishape=fshape1; ishape<fshape2; ishape++)
809  {
810 
811 #ifdef LOG4CXX
812  std::stringstream sout;
813  sout << " <vec,shape> " << "< "<<jvec << " * "<<ishape << "> "<<std::endl;
814  LOGPZ_DEBUG(logger,sout.str())
815 #endif
816 
817 
818  ShapeAndVec[count++]=std::pair<int,int64_t>(jvec,ishape);
819  }
820 
821  }
822 
823 #ifdef LOG4CXX
824  std::stringstream sout;
825  sout << "VecShapeIndex " << ShapeAndVec;
826  LOGPZ_DEBUG(logger,sout.str())
827 #endif
828 
829 
830 }
831 
832 template<class TSHAPE>
835 }
836 
837 #include "pzshapetriang.h"
838 #include "pzshapepoint.h"
839 #include "pzshapelinear.h"
840 #include "pzshapequad.h"
841 
842 using namespace pzshape;
843 
848 
849 
853 template class TPZCompElHDivBound2<TPZShapeQuad>;
854 
855 #include "pzreferredcompel.h"
856 
858  return new TPZReferredCompEl<TPZCompElHDivBound2<TPZShapePoint>>(mesh,gel,index);
859 }
860 
862  return new TPZReferredCompEl<TPZCompElHDivBound2< TPZShapeLinear>>(mesh,gel,index);
863 }
864 
866  return new TPZReferredCompEl<TPZCompElHDivBound2< TPZShapeQuad>>(mesh,gel,index);
867 }
868 
871 }
872 
877 
878 
883 
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
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.
virtual void InitMaterialData(TPZMaterialData &data)
Initialize a material data and its attributes based on element dimension, number of state variables a...
virtual int NConnectShapeF(int connect, int order) const override
Returns the number of shapefunctions associated with a connect.
void ComputeShape(TPZVec< REAL > &intpoint, TPZMaterialData &data) override
Compute Shape for boundary of a hdiv computational element.
void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
TPZFNMatrix< 660, REAL > dphi
values of the derivative of the shape functions over the master element
TPZGeoElSide Reference() const
Reference to the geometric element.
Definition: pzcompel.cpp:748
groups all classes dedicated to the computation of shape functions
Definition: pzshapeextend.h:16
virtual MElementType Type() override
Return the type of the element.
TPZCompElHDivBound2()
Default constructor.
virtual void SetIntegrationRule(int ord) override
Definition: pzelctemp.cpp:150
virtual int NCornerNodes() const =0
Returns the number of corner nodes of the element.
virtual int SideConnectLocId(int node, int side) const override
Returns the local node number of icon along is.
int AdjustPreferredSideOrder(int side, int order)
Adjusts the preferredSideOrder for faces.
Definition: pzintel.cpp:1755
virtual void Print(std::ostream &out=std::cout) const override
Prints the relevant data of the element to the output stream.
Definition: pzintel.cpp:1528
TPZCompEl * CreateRefHDivBoundQuadEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational quadrilateral element for HDiv approximate space.
virtual int NStateVariables() const =0
Returns the number of state variables associated with the material.
MShapeFunctionType fShapeType
TPZCompElSide LowerLevelCompElementList2(int onlyinterpolated)
return the element/side pair which contains this/side and has a computational element associated ...
TPZFNMatrix< 9, REAL > jacinv
value of the inverse of the jacobian at the integration point
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Definition: pzgeoelside.h:83
Contains declaration of TPZCompElHDiv class which implements a generic computational element (HDiv sc...
virtual void SetSideOrient(int side, int sideorient) override
It set the normal orientation of the element by the side. Only side that has dimension equal to my di...
virtual void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
Definition: pzelctemp.cpp:363
virtual int64_t CreateMidSideConnect(int side)
Verify the neighbours of the element and create a node along this side.
Definition: pzintel.cpp:654
virtual int SideDimension(int side) const =0
Return the dimension of side.
TPZFNMatrix< 9, REAL > jacobian
value of the jacobian at the integration point
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
Contains TPZShapeLinear class which implements the shape functions of a linear one-dimensional elemen...
int NShapeF() const override
Returns the total number of shapefunctions.
Definition: pzintel.cpp:63
virtual int NSideConnects(int side) const override
Returns the number of dof nodes along side iside.
void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
virtual void GetInterpolationOrder(TPZVec< int > &ord) override
Identifies the interpolation order on the interior of the element.
TPZOneShapeRestraint fRestraint
Restraint on a single shape function for pyramid implementation.
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
Definition: pzcompel.cpp:959
void Shape(TPZVec< REAL > &pt, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi) override
Compute the shape function at the integration point.
virtual void SetConnectIndex(int i, int64_t connectindex) override
Sets the node pointer of node i to nod.
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
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
TPZCompEl * CreateRefHDivBoundLinearEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational linear element for HDiv approximate space.
unsigned char Order() const
Access function to return the order associated with the connect.
Definition: pzconnect.h:217
virtual int PreferredSideOrder(int iside) override
Returns the preferred order of the polynomial along side iside.
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
int ClassId() const override
Returns the unique identifier for reading/writing objects to streams.
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
virtual int SideConnectLocId(int icon, int is) const override=0
Returns the local node number of icon along is.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
TPZCompMesh * Mesh() const
Return a pointer to the grid of the element.
Definition: pzcompel.cpp:288
void SetAllCreateFunctionsHDiv()
Definition: pzcmesh.h:523
TPZCompEl * CreateRefHDivBoundPointEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational point element for HDiv approximate space.
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
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)
TPZCompElSide fneighbour
virtual int ConnectOrder(int connect) const override
virtual int EffectiveSideOrder(int side) const override
Returns the actual interpolation order of the polynomial along the side.
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
virtual void Print(std::ostream &out) const override
Prints the relevant data of the element to the output stream.
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
Definition: pzcmesh.h:213
Contains declaration of TPZCompelDisc class which implements a computational element for discontinuou...
TPZAdmChunkVector< TPZConnect > & ConnectVec()
Return a reference to the connect pointers vector.
Definition: pzcmesh.h:198
int64_t Index() const
Returns element index of the mesh fELementVec list.
Definition: pzcompel.h:821
Contains the TPZMaterialData class which implements an interface between TPZCompEl::CalcStiff and TPZ...
Implements a generic computational element to HDiv scope. Computational Element.
Contains TPZShapePoint class which implements the shape function associated with a point...
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Definition: pzlog.h:93
void FirstShapeIndex(TPZVec< int64_t > &Index)
Returns the vector index of the first index shape associate to element.
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Definition: pzfmatrix.h:616
TPZGeoNode & Node(int i) const
Returns the ith node of the element.
Definition: pzgeoel.cpp:2570
virtual TPZConnect & Connect(int i) const
Returns a pointer to the ith node.
Definition: pzcompel.cpp:298
virtual int NNodes() const =0
Returns the number of nodes of the element.
void Print(std::ostream &out) const
TPZManVector< int64_t, TSHAPE::NSides > fConnectIndexes
Indexes of the connects associated with the elements.
Definition: pzelctemp.h:25
virtual int GetSideOrient(int side) override
It returns the normal orientation of the reference element by the side. Only side that has dimension ...
int NSideShapeF(int side) const
Returns the number of shape functions on a side.
Definition: pzintel.cpp:73
virtual int Dimension() const =0
Returns the dimension of the element.
TPZCompEl * Element() const
Gives a pointer to the reference computational element.
Definition: pzcompel.h:675
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
Definition: pzcompel.cpp:1137
virtual void SideShapeFunction(int side, TPZVec< REAL > &point, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi) override
Compute the values of the shape function of the side.
MElementType
Define the element types.
Definition: pzeltype.h:52
int Dimension() const
the dimension associated with the element/side
void ResetReference()
Reset the element referenced by the geometric element to NULL.
Definition: pzgeoel.h:431
Contains declaration of TPZCompElHDivBound2 class which implements a generic computational element (H...
virtual void InitMaterialData(TPZMaterialData &data) override
Initialize a material data and its attributes based on element dimension, number of state variables a...
Template to generate computational elements. Computational Element.
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
TSHAPE::IntruleType fIntRule
Integration rule associated with the topology of the element.
Definition: pzelctemp.h:28
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Definition: pzcmesh.h:183
void SetReference(TPZCompEl *elp)
Make the current element reference to the computational element.
Definition: pzgeoel.h:746
void ComputeShapeIndex(TPZVec< int > &sides, TPZVec< int64_t > &shapeindex)
Compute the correspondence between the normal vectors and the shape functions.
Contains the declaration of the shape function discontinuous.
int Side() const
Returns the side index.
Definition: pzcompel.h:688
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
void RemoveDepend(int64_t myindex, int64_t dependindex)
Remove dependency between connects if exist.
Definition: pzconnect.cpp:178
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Definition: pzfmatrix.cpp:1016
TPZRegisterClassId()=default
int Id() const
Returns the identity of the current node.
Definition: pzgnode.h:68
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
void HigherLevelCompElementList3(TPZStack< TPZCompElSide > &elsidevec, int onlymultiphysicelement, int removeduplicates)
Returns all connected computational elements which have level higher to the current element if onlym...
Contains declaration of TPZReferredCompEl class which generates computational elements.
virtual void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
Definition: pzelctemp.cpp:349
virtual void SetSideOrder(int side, int order) override
Sets the interpolation order of side to order.
int fPreferredOrder
Preferred polynomial order.
TPZCompEl * CreateRefHDivBoundTriangleEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational triangular element for HDiv approximate space.
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
void IndexShapeToVec(TPZVec< int > &fVectorSide, TPZVec< std::pair< int, int64_t > > &IndexVecShape)
Returns a matrix index of the shape and vector associate to element.
int GetDefaultOrder()
Definition: pzcmesh.h:398
Contains TPZShapeQuad class which implements the shape functions of a quadrilateral element...
virtual ~TPZCompElHDivBound2()
Default destructor.
REAL detjac
determinant of the jacobian
virtual int NConnects() const override
Returns the number of connect objects of the element.
Contains TPZShapeTriang class which implements the shape functions of a triangular element...
Implements computational element based on an interpolation space. Computational Element.
Definition: pzintel.h:27
Implements an interface to register a class id and a restore function. Persistence.
Definition: TPZSavable.h:150
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
virtual void Read(bool &val)
Definition: TPZStream.cpp:91
Implements a generic computational element. Computational Element.
Definition: pzelctemp.h:20