NeoPZ
pzelchdiv.cpp
Go to the documentation of this file.
1 
6 #include "pzcmesh.h"
7 #include "pzelchdiv.h"
8 #include "pzquad.h"
9 #include "pzgeoel.h"
10 #include "TPZMaterial.h"
11 #include "pzlog.h"
12 #include "pzgeoquad.h"
13 #include "TPZShapeDisc.h"
14 #include "TPZCompElDisc.h"
15 #include "pzmaterialdata.h"
16 #include "pzhdivpressure.h"
17 #include "pzshapepiram.h"
18 
19 
20 
21 #include "pzshtmat.h"
22 
23 #ifdef LOG4CXX
24 static LoggerPtr logger(Logger::getLogger("pz.mesh.TPZCompElHDiv"));
25 static LoggerPtr loggerdiv(Logger::getLogger("pz.mesh.tpzinterpolatedelement.divide"));
26 #endif
27 
28 using namespace std;
29 
30 
31 template<class TSHAPE>
34 TPZIntelGen<TSHAPE>(mesh,gel,index,1), fSideOrient(TSHAPE::NFaces,1) {
36  int nconflux= TPZCompElHDiv::NConnects();
37  this->fConnectIndexes.Resize(nconflux);
38  gel->SetReference(this);
39 
40 // int nfaces = TSHAPE::NumSides(TSHAPE::Dimension-1);
41  TPZStack<int> facesides;
42  TSHAPE::LowerDimensionSides(TSHAPE::NSides-1,facesides,TSHAPE::Dimension-1);
43  facesides.Push(TSHAPE::NSides-1);
44  for(int i=0;i< facesides.size(); i++)
45  {
46  int sideaux= facesides[i];
47  this->fConnectIndexes[i] = this->CreateMidSideConnect(sideaux);
48 #ifdef LOG4CXX
49  if (logger->isDebugEnabled())
50  {
51  std::stringstream sout;
52  sout << "After creating last flux connect " << i << std::endl;
53  // this->Print(sout);
54  LOGPZ_DEBUG(logger,sout.str())
55  }
56 #endif
57 
58  mesh.ConnectVec()[this->fConnectIndexes[i]].IncrementElConnected();
59  this->IdentifySideOrder(sideaux);
60  }
61 
62 
63  int sideorder = EffectiveSideOrder(TSHAPE::NSides-1);
64 // if(TSHAPE::Type()==EQuadrilateral)
65 // {
66 // sideorder++;
67 // }
68 
69  sideorder++;
70 
71  sideorder = 2*sideorder;
72  if (sideorder > this->fIntRule.GetMaxOrder()) sideorder = this->fIntRule.GetMaxOrder();
73  TPZManVector<int,3> order(3,sideorder);
74  this->fIntRule.SetOrder(order);
75  int firstside = TSHAPE::NSides-TSHAPE::NFaces-1;
76  for(int side = firstside ; side < TSHAPE::NSides-1; side++ )
77  {
78  fSideOrient[side-firstside] = this->Reference()->NormalOrientation(side);
79  }
80  TPZMaterial *mat = this->Material();
81  if (mat)
82  {
83  int order = mat->IntegrationRuleOrder(MaxOrder());
84  TPZManVector<int,3> ord(gel->Dimension(),order);
85  this->fIntRule.SetOrder(ord);
86  }
87 
88 
89 }
90 
91 template<class TSHAPE>
94 TPZIntelGen<TSHAPE>(mesh,copy), fSideOrient(copy.fSideOrient)
95 {
96  this-> fPreferredOrder = copy.fPreferredOrder;
97  this->fConnectIndexes = copy.fConnectIndexes;
98 
99 }
100 
101 template<class TSHAPE>
103  const TPZCompElHDiv<TSHAPE> &copy,
104  std::map<int64_t,int64_t> & gl2lcConMap,
105  std::map<int64_t,int64_t> & gl2lcElMap) :
107 TPZIntelGen<TSHAPE>(mesh,copy,gl2lcConMap,gl2lcElMap), fSideOrient(copy.fSideOrient)
108 {
109  this-> fPreferredOrder = copy.fPreferredOrder;
110  int i;
111  for(i=0;i<NConnects();i++)
112  {
113  int lcIdx = -1;
114  int glIdx = copy.fConnectIndexes[i];
115  if (gl2lcConMap.find(glIdx) != gl2lcConMap.end()) lcIdx = gl2lcConMap[glIdx];
116  else
117  {
118  std::stringstream sout;
119  sout << "ERROR in : " << __PRETTY_FUNCTION__
120  << " trying to clone the connect index: " << glIdx
121  << " wich is not in mapped connect indexes!";
122  LOGPZ_ERROR(logger, sout.str().c_str());
123  this-> fConnectIndexes[i] = -1;
124  return;
125  }
126  this-> fConnectIndexes[i] = lcIdx;
127  }
128 }
129 
130 template<class TSHAPE>
133 TPZIntelGen<TSHAPE>()
134 {
135  this->fPreferredOrder = -1;
136  int i;
137  for(i=0;i<TSHAPE::NSides;i++) {
138  this-> fConnectIndexes[i] = -1;
139  }
140 
141 }
142 
143 template<class TSHAPE>
145  TPZGeoEl *gel = this->Reference();
146  if (gel && gel->Reference() != this) {
147  return;
148  }
149  for (int side=TSHAPE::NCornerNodes; side < TSHAPE::NSides; side++) {
150  if (TSHAPE::SideDimension(side) != TSHAPE::Dimension-1) {
151  continue;
152  }
153  TPZGeoElSide gelside(this->Reference(),side);
154  TPZStack<TPZCompElSide> celstack;
155  TPZCompElSide largecel = gelside.LowerLevelCompElementList2(0);
156  if (largecel) {
157  int cindex = SideConnectLocId(0, side);
158  TPZConnect &c = this->Connect(cindex);
159  c.RemoveDepend();
160  }
161  if (gelside.Element()){
162  gelside.HigherLevelCompElementList3(celstack, 0, 1);
163  }
164  int64_t ncel = celstack.size();
165  for (int64_t el=0; el<ncel; el++) {
166  TPZCompElSide celside = celstack[el];
167  TPZCompEl *celsmall = celside.Element();
168  TPZGeoEl *gelsmall = celsmall->Reference();
169  if (gelsmall->SideDimension(celside.Side()) != gel->Dimension()-1) {
170  continue;
171  }
172  TPZInterpolatedElement *intelsmall = dynamic_cast<TPZInterpolatedElement *>(celsmall);
173  if (!intelsmall) {
174  DebugStop();
175  }
176  int cindex = intelsmall->SideConnectLocId(0, celside.Side());
177  TPZConnect &c = intelsmall->Connect(cindex);
178  c.RemoveDepend();
179  }
180  }
181  if (gel){
182  gel->ResetReference();
183  }
184 }
185 
186 template<class TSHAPE>
188  return TSHAPE::Type();
189 }
190 
191 
192 template<class TSHAPE>
194  int dimension = Dimension()-1;
195 
196  return TSHAPE::NumSides(dimension) + 1;
197 }
198 
199 template<class TSHAPE>
200 void TPZCompElHDiv<TSHAPE>::SetConnectIndex(int i, int64_t connectindex){
201 #ifndef NODEBUG
202  if(i<0 || i>= this->NConnects()) {
203  std::cout << " TPZCompElHDiv<TSHAPE>::SetConnectIndex index " << i <<
204  " out of range\n";
205  DebugStop();
206  return;
207  }
208 #endif
209  this-> fConnectIndexes[i] = connectindex;
210 #ifdef LOG4CXX
211  if (logger->isDebugEnabled())
212  {
213  std::stringstream sout;
214  sout << endl<<"Setting Connect : " << i << " to connectindex " << connectindex<<std::endl;
215  LOGPZ_DEBUG(logger,sout.str())
216  }
217 #endif
218 }
219 
220 template<class TSHAPE>
221 int TPZCompElHDiv<TSHAPE>::NConnectShapeF(int connect, int order)const
222 {
223 #ifdef DEBUG
224  if (connect < 0 || connect >= NConnects()) {
225  DebugStop();
226  }
227 #endif
228  if (connect < TPZCompElHDiv<TSHAPE>::NConnects()-1) {
229  int64_t connectindex = ConnectIndex(connect);
230 // int order = 0;
231 // if (connectindex >= 0) {
232 // order = this->Connect(connect).Order();
233 // }
234 // else
235 // {
236 // order = this->fPreferredOrder;
237 // }
238  const int nfaces = TSHAPE::NumSides(TSHAPE::Dimension-1);
239  int face = TSHAPE::NSides-nfaces+connect-1;
240  TPZStack<int> lowerdimensionsides;
241  TSHAPE::LowerDimensionSides(face,lowerdimensionsides);
242  int nshape = TSHAPE::NConnectShapeF(face,order);
243  for (int is=0; is<lowerdimensionsides.size(); is++) {
244  nshape += TSHAPE::NConnectShapeF(lowerdimensionsides[is],order);
245  }
246  return nshape;
247  }
248 
249  const int nfaces = TSHAPE::NumSides(TSHAPE::Dimension-1);
250  int face = TSHAPE::NSides-nfaces-1;
251  int nvecignore = 0;
252  for (int side = face; side < TSHAPE::NSides-1; side++) {
253  nvecignore += TSHAPE::NContainedSides(side);
254  }
255 
256 
257  TPZManVector<int,TSHAPE::Dimension*TSHAPE::NSides+1> vecside(TSHAPE::Dimension*TSHAPE::NSides),bilinear(TSHAPE::Dimension*TSHAPE::NSides),directions(TSHAPE::Dimension*TSHAPE::NSides);
258  TSHAPE::GetSideHDivDirections(vecside,directions,bilinear);
259 // if (TSHAPE::Type()==ETriangle||TSHAPE::Type()==ETetraedro) {
261 // }
262 // else if (TSHAPE::Type()==ECube||TSHAPE::Type()==EQuadrilateral||TSHAPE::Type()==EPrisma) {
263 // pressureorder=this->fPreferredOrder;
264 // }
265 // else
266 // {
267 // // Tipo nao implementado
268 // DebugStop();
269 // }
270  TPZManVector<int,27> orders(TSHAPE::NSides-TSHAPE::NCornerNodes,0);
271  FillOrder(orders);
272  int nshape = TSHAPE::NShapeF(orders);
273 
274  TPZManVector<int64_t, TSHAPE::NCornerNodes> id(TSHAPE::NCornerNodes);
275  for (int i=0; i<id.size(); i++) {
276  id[i] = this->Reference()->NodePtr(i)->Id();
277  }
278 
279 
280  int nexternalvectors = 0;
281  nexternalvectors = nvecignore;
282 
283  TPZGenMatrix<int> shapeorders(nshape,3);
284  TSHAPE::ShapeOrder(id, orders, shapeorders);
285  {
286  static int first = 0;
287  if (first==0) {
288  shapeorders.Print("ShapeOrders");
289  first++;
290  }
291  }
292  // VectorSide indicates the side associated with each vector entry
293  TPZManVector<int64_t,30> FirstIndex(TSHAPE::NSides+1);
294  // the first index of the shape functions
295  FirstShapeIndex(FirstIndex);
296  //FirstIndex.Print();
297 
298 #ifdef LOG4CXX
299  if (logger->isDebugEnabled())
300  {
301  std::stringstream sout;
302  sout << "FirstIndex "<<FirstIndex << std::endl;
303  LOGPZ_DEBUG(logger,sout.str())
304  }
305 #endif
306 
307  int count = 0;
308 
309  int internalorder = this->Connect(connect).Order();
310 
311  int64_t nvec = vecside.NElements();
312  for (int locvec = nexternalvectors; locvec<nvec; locvec++)
313  {
314  int side = vecside[locvec];
315  int bil = bilinear[locvec];
316  int dir = directions[locvec];
317 
318  MElementType tipo = TSHAPE::Type(side);
319 
320  int firstshape = FirstIndex[side];
321  int lastshape = FirstIndex[side+1];
322 
323  for (int ish = firstshape; ish<lastshape; ish++)
324  {
325  int sidedimension = TSHAPE::SideDimension(side);
326  int maxorder[3] = {internalorder,internalorder,internalorder};
327  if (bil) {
328  maxorder[dir]++;
329  }
330  int include=true;
331  for (int d=0; d<sidedimension; d++)
332  {
333  if (tipo==ETriangle||tipo==ETetraedro)//
334  {
335  if (shapeorders(ish,d) > maxorder[d]+1) {
336  include = false;
337  }
338  }
339  else if(tipo==EQuadrilateral)
340  {
341  if (shapeorders(ish,d) > maxorder[d]) {
342  include = false;
343  }
344  }
345  else if(tipo==ECube)
346  {
347  if (shapeorders(ish,d) > maxorder[d]) {
348  include = false;
349  }
350  }
351  else if (tipo==EPrisma)
352  {
353  //DebugStop();
354  if (shapeorders(ish,d) > maxorder[d]) {
355  include = false;
356  }
357  }
358  else if (tipo == EOned)
359  {
360  if (shapeorders(ish,0) > maxorder[d]) {
361  include = false;
362  }
363  }
364  else if (tipo == EPoint)
365  {
366  DebugStop();
367  }
368  else if (tipo == EPiramide)
369  {
370  if (shapeorders(ish,d) > maxorder[d]) {
371  include = false;
372  }
373  }
374  else
375  {
376  DebugStop();
377  }
378  }
379  if (include)
380  {
381  count++;
382  }
383  }
384  }
385  return count;
386 
387 
388  #ifdef LOG4CXX
389  {
390  std::stringstream sout;
391  sout <<__PRETTY_FUNCTION__<< "unhandled case ";
392  LOGPZ_ERROR(logger,sout.str())
393  }
394  #endif
395  return -1;
396 
397  }
398 
399 
400 
401 
403 template<class TSHAPE>
405  TPZManVector<int,3> order(TSHAPE::Dimension,ord);
406  this->fIntRule.SetOrder(order);
407 }
408 
409 
410 template<class TSHAPE>
412  if(TSHAPE::SideDimension(side)<= Dimension()-2) return 0;
413  if(TSHAPE::SideDimension(side)==Dimension()-1) return 1;
414  if(TSHAPE::SideDimension(side)== Dimension()) {
415  int ncon = 1;
416  return ncon;
417  }
418 #ifdef LOG4CXX
419  {
420  std::stringstream sout;
421  sout << __PRETTY_FUNCTION__ << "Side: " << side <<"unhandled case ";
422  LOGPZ_ERROR(logger,sout.str())
423  }
424 #endif
425  return -1;
426 
427 }
428 
429 template<class TSHAPE>
430 int TPZCompElHDiv<TSHAPE>::SideConnectLocId(int node,int side) const {
431 #ifdef PZDEBUG
432  if(TSHAPE::SideDimension(side)<= TSHAPE::Dimension - 2 || node >= NSideConnects(side)) {
433  PZError << "TPZCompElHDiv<TSHAPE>::SideConnectLocId no connect associate " << endl;
434  return -1;
435  }
436 #endif
437 
438  return node+side-(TSHAPE::NSides-TSHAPE::NumSides(TSHAPE::Dimension-1)-1);
439 }
440 
441 template<class TSHAPE>
443 
444  int side = connect+TSHAPE::NSides-TSHAPE::NumSides(TSHAPE::Dimension-1)-1 ;
445  return side;
446 }
447 
448 template<class TSHAPE>
450  ord.Resize(NConnects());
451  int i;
452  for(i=0; i<NConnects(); i++) {
453  ord[i] = ConnectOrder(i);
454  }
455 }
456 
457 
458 template<class TSHAPE>
460  if(TSHAPE::SideDimension(side) < Dimension()-1)
461  {
462  PZError << __PRETTY_FUNCTION__ << " side " << side << std::endl;
463  }
464  int connect= SideConnectLocId(0,side);
465  if(connect<0 || connect > NConnects()) {
466  PZError << "TPZCompElHDiv<TSHAPE>::PreferredSideOrder no polynomial associate " << endl;
467  return -1;
468  }
469  if(connect<NConnects()) {
470  int order =this->fPreferredOrder;
471  return order;//this->AdjustPreferredSideOrder(side,order);
472  }
473  PZError << "TPZCompElHDiv<TSHAPE>::PreferredSideOrder called for connect = " << connect << "\n";
474  return 0;
475 
476 }
477 
478 template<class TSHAPE>
479 int64_t TPZCompElHDiv<TSHAPE>::ConnectIndex(int con) const{
480 #ifndef NODEBUG
481  if(con<0 || con>= this->NConnects()) {
482  std::cout << "TPZCompElHDiv::ConnectIndex wrong parameter connect " << con <<
483  " NConnects " << this-> NConnects() << std::endl;
484  DebugStop();
485  return -1;
486  }
487 
488 #endif
489 
490 // #ifndef NODEBUG
491 // if(con<0) {
492 // std::cout << "TPZCompElHDiv::ConnectIndex wrong parameter connect " << con <<
493 // " NConnects " << this-> NConnects() << std::endl;
494 // DebugStop();
495 // return -1;
496 // }
497 //
498 // #endif
499 //
500 //
501 // if(con>= this->NConnects())
502 // {
503 // int con2= con-TSHAPE::NCornerNodes;
504 // return this->fConnectIndexes[con2];
505 // }
506 
507  return this->fConnectIndexes[con];
508 }
509 
510 
511 template<class TSHAPE>
513 {
515  //this->fPreferredOrder = order;
516 }
517 
518 template<class TSHAPE>
519 void TPZCompElHDiv<TSHAPE>::SetSideOrder(int side, int order){
520  int connectaux= SideConnectLocId(0,side);
521  if(connectaux<0 || connectaux > this-> NConnects()) {
522  PZError << "TPZCompElHDiv::SetSideOrder. Bad paramenter side " << side << " order " << order << std::endl;
523 #ifdef LOG4CXX
524  std::stringstream sout;
525  sout << __PRETTY_FUNCTION__ << " Bad side or order " << side << " order " << order;
526  LOGPZ_DEBUG(logger,sout.str())
527 #endif
528  return;
529  }
530  TPZConnect &c = this->Connect(connectaux);
531  c.SetOrder(order,this->fConnectIndexes[connectaux]);
532  int64_t seqnum = c.SequenceNumber();
533  int nvar = 1;
534  TPZMaterial * mat =this-> Material();
535  if(mat) nvar = mat->NStateVariables();
536  c.SetNState(nvar);
537  int nshape =this->NConnectShapeF(connectaux,order);
538  c.SetNShape(nshape);
539  this-> Mesh()->Block().Set(seqnum,nshape*nvar);
540 }
541 
542 
543 template<class TSHAPE>
544 int TPZCompElHDiv<TSHAPE>::ConnectOrder(int connect) const{
545  if (connect < 0 || connect >= this->NConnects()){
546 #ifdef LOG4CXX
547  {
548  std::stringstream sout;
549  sout << "Connect index out of range connect " << connect <<
550  " nconnects " << NConnects();
551  LOGPZ_DEBUG(logger,sout.str())
552  }
553 #endif
554  return -1;
555  }
556 
557  if (this->fConnectIndexes[connect] == -1) {
558  std::stringstream sout;
559  sout << __PRETTY_FUNCTION__ << " connect " << connect
560  << " is not initialized" << std::endl;
561 #ifdef LOG4CXX
562  LOGPZ_ERROR(logger,sout.str());
563 #else
564  std::cout << sout.str() << std::endl;
565 #endif
566  return 0;
567  }
568 
569  TPZConnect &c = this-> Connect(connect);
570  return c.Order();
571 }
572 
573 template<class TSHAPE>
575 {
576  if(!NSideConnects(side)) return -1;
577  int corder =SideConnectLocId(0, side);
578  int maxorder = 0;
579  int conectaux;
580  if(corder>=0 || corder <= NConnects()) return ConnectOrder(corder);
581 
582  DebugStop();
583  TPZStack< int > high;
584  TSHAPE::HigherDimensionSides(side, high);
585  int highside= high.NElements();
586 
587 
588  for(int j=0;j<highside;j++)
589  {
590  conectaux =SideConnectLocId(0, high[j]);
591  maxorder = (ConnectOrder(conectaux) > maxorder) ? ConnectOrder(conectaux) : maxorder;
592  }
593 
594  return maxorder;
595 }
596 
598 template<class TSHAPE>
600 
601  TPZManVector<int> orders(TSHAPE::NSides-TSHAPE::NCornerNodes);
602  FillOrder(orders);
603  Index[0] = 0;
604  for(int iside=0;iside<TSHAPE::NSides;iside++)
605  {
606  int sideorder = 1;
607  if (iside >= TSHAPE::NCornerNodes) {
608  sideorder = orders[iside-TSHAPE::NCornerNodes];
609  }
610  int temp = Index[iside] + TSHAPE::NConnectShapeF(iside,sideorder);
611  Index[iside+1] = temp;
612  }
613 
614 #ifdef LOG4CXX
615  if (logger->isDebugEnabled()) {
616  std::stringstream sout;
617  sout << "First Index " << Index;
618  LOGPZ_DEBUG(logger,sout.str())
619  }
620 #endif
621 }
622 
623 
624 template<class TSHAPE>
626  int in,result=0;
627  int nn=TPZCompElHDiv::NConnects();
628  for(in=0;in<nn;in++){
629 //#ifdef LOG4CXX
630 // std::stringstream sout;
631 // sout << "conect " << in<< " seq number "<<seqnum<<" num func "<<TPZCompElHDiv::NConnectShapeF(in);
632 // LOGPZ_DEBUG(logger,sout.str())
633 //#endif
634  int order = this->Connect(in).Order();
635  result += TPZCompElHDiv::NConnectShapeF(in,order);
636  }
637 
638 
639 //#ifdef LOG4CXX
640 // std::stringstream sout;
641 // sout << "Num funcoes associada ao fluxo " << result;
642 // LOGPZ_DEBUG(logger,sout.str())
643 //#endif
644  return result;
645 
646 
647 }
648 
655 template<class TSHAPE>
656 void TPZCompElHDiv<TSHAPE>::IndexShapeToVec(TPZVec<int> &VectorSide, TPZVec<int> &bilinear, TPZVec<int> &direction, TPZVec<std::pair<int,int64_t> > & IndexVecShape, int pressureorder)
657 {
658 
659  DebugStop();
660 
661 }
662 
663 template<class TSHAPE>
664 void TPZCompElHDiv<TSHAPE>::IndexShapeToVec2(TPZVec<int> &VectorSide, TPZVec<int> &bilinear, TPZVec<int> &direction, TPZVec<std::pair<int,int64_t> > & IndexVecShape, int pressureorder)
665 {
666  TPZManVector<int,27> order(TSHAPE::NSides-TSHAPE::NCornerNodes,0);
667  FillOrder(order); // aqui incrementa a ordem p do lado bilinear
668  int nshape = TSHAPE::NShapeF(order);
669 
670  TPZManVector<int64_t, TSHAPE::NCornerNodes> id(TSHAPE::NCornerNodes);
671  for (int i=0; i<id.size(); i++) {
672  id[i] = this->Reference()->NodePtr(i)->Id();
673  }
674 
675  int nexternalvectors = 0;
676  TPZManVector<int> facevector(VectorSide.size(),TSHAPE::NSides-1);
677  // compute the permutation which needs to be applied to the vectors to enforce compatibility between neighbours
678  TPZManVector<int,81> vecpermute(TSHAPE::NSides*TSHAPE::Dimension);
679  if (TSHAPE::Type() == EPiramide) {
680  vecpermute.resize(TSHAPE::NSides*TSHAPE::Dimension+1);
681  }
682  int count = 0;
683  for (int side = 0; side < TSHAPE::NSides; side++) {
684  if (TSHAPE::SideDimension(side) != TSHAPE::Dimension -1) {
685  continue;
686  }
687  TPZGeoElSide gelside(this->Reference(),side);
688  int nlowdim = gelside.NSides();
689  TPZManVector<int,27> permgather(nlowdim);
690  this->Reference()->HDivPermutation(side,permgather);
691  int counthold = count;
692  for (int i=0; i<nlowdim; i++) {
693  vecpermute[counthold+i] = permgather[i]+counthold;
694  facevector[count] = side;
695  count++;
696  }
697  }
698 
699  nexternalvectors = count;
700  for (; count < vecpermute.size(); count++) {
701  vecpermute[count] = count;
702  }
703  TPZGenMatrix<int> shapeorders(nshape,3);
704  TSHAPE::ShapeOrder(id, order, shapeorders);
705 
706  int nshapeflux = NFluxShapeF();
707  IndexVecShape.Resize(nshapeflux);
708 
709  // VectorSide indicates the side associated with each vector entry
710  TPZManVector<int64_t,27> FirstIndex(TSHAPE::NSides+1);
711  // the first index of the shape functions
712  FirstShapeIndex(FirstIndex);
713  //FirstIndex.Print();
714 
715 #ifdef LOG4CXX
716  if(logger->isDebugEnabled())
717  {
718  std::stringstream sout;
719  sout << "FirstIndex "<<FirstIndex << std::endl;
720  LOGPZ_DEBUG(logger,sout.str())
721  }
722 #endif
723 
724 
725 
726  int64_t nvec = VectorSide.NElements();
727  count = 0;
728 
729  for (int locvec = 0; locvec<nexternalvectors; locvec++) {
730  int ivec = vecpermute[locvec];
731  int side = VectorSide[ivec];
732  int face = facevector[locvec];
733  int connectindex = SideConnectLocId(0, face);
734  int order = this->Connect(connectindex).Order();
735 
736  int firstshape = FirstIndex[side];
737  int lastshape = FirstIndex[side+1];
738 
739  for (int ish = firstshape; ish<lastshape; ish++) {
740  int sidedimension = TSHAPE::SideDimension(side);
741  int include=true;
742  for (int d=0; d<sidedimension; d++)
743  {
744  if (shapeorders(ish,d) > order) {
745  include = false;
746  }
747  }
748  if (include)
749  {
750  IndexVecShape[count] = std::make_pair(ivec, ish);
751  count++;
752  }
753  }
754  }
755 
756 
757  for (int locvec = nexternalvectors; locvec<nvec; locvec++) {
758  int ivec = vecpermute[locvec];
759  int side = VectorSide[ivec];
760  int bil = bilinear[ivec];
761  int dir = direction[ivec];
762  MElementType tipo = TSHAPE::Type(side);
763 
764  int firstshape = FirstIndex[side];
765  int lastshape = FirstIndex[side+1];
766 
767  for (int ish = firstshape; ish<lastshape; ish++) {
768  int sidedimension = TSHAPE::SideDimension(side);
769  int maxorder[3] = {pressureorder,pressureorder,pressureorder};
770  if (bil) {
771  maxorder[dir]++;
772  }
773  int shord[3] = {0};
774  int include=true;
775  for (int d=0; d<sidedimension; d++)
776  {
777  if (tipo==ETriangle||tipo==ETetraedro)//
778  {
779  shord[d] = shapeorders(ish,d);
780  int maxd = maxorder[d]+1;
781  if (shord[d] > maxd) {
782  include = false;
783  }
784  }
785  else if(tipo==EQuadrilateral)
786  {
787  shord[d] = shapeorders(ish,d);
788  int maxd = maxorder[d];
789  if (shord[d] > maxd) {
790  include = false;
791  }
792  }
793  else if(tipo==ECube)
794  {
795  shord[d] = shapeorders(ish,d);
796  if (shord[d] > maxorder[d]) {
797  include = false;
798  }
799  }
800  else if (tipo==EPrisma)
801  {
802  //DebugStop();
803  if (shapeorders(ish,d) > maxorder[d]) {
804  include = false;
805  }
806  }
807  else if (tipo == EOned)
808  {
809  shord[0] = shapeorders(ish,0);
810  if (shord[0] > maxorder[d]) {
811  include = false;
812  }
813  }
814  else if (tipo == EPiramide)
815  {
816  shord[d] = shapeorders(ish,d);
817  if (shord[d] > maxorder[d]) {
818  include = false;
819  }
820  }
821  else
822  {
823  DebugStop();
824  }
825  }
826  if (include)
827  {
828  IndexVecShape[count] = std::make_pair(ivec, ish);
829  count++;
830  }
831  }
832  }
833 // //shapeorders.Print("shapeorders");
834 // cout << "vec|shapeindex|ordem" << endl;
835 // for (int i=0; i< count; i++)
836 // {
837 // if (IndexVecShape[i].second<nshape)
838 // {
839 // cout << IndexVecShape[i] << " ( ";
840 // for (int j=0; j<3; j++)
841 // {
842 // cout << shapeorders(IndexVecShape[i].second,j) << " " ;
843 // }
844 // cout << ") " << i << endl;
845 // }
846 // else
847 // {cout<<"opa"<< i << endl;}
848 //
849 // }
850  int ivs = IndexVecShape.size();
851  if (count != ivs) {
852  DebugStop();
853  }
854 
855 // cout << " foi " << endl;
856 }
857 
858 
859 
860 template<class TSHAPE>
861 void TPZCompElHDiv<TSHAPE>::IndexShapeToVec(TPZVec<int> &VectorSide,TPZVec<std::pair<int,int64_t> > & ShapeAndVec, int pressureorder)
862 {
863  DebugStop();
864 }
865 
866 
872 template<class TSHAPE>
874 
875  int firstside = TSHAPE::NSides-TSHAPE::NFaces-1;
876  if (side < firstside || side >= TSHAPE::NSides - 1) {
877  DebugStop();
878  }
879  return fSideOrient[side-firstside];
880 }
881 
887 template<class TSHAPE>
888 void TPZCompElHDiv<TSHAPE>::SetSideOrient(int side, int sideorient){
889 
890  int firstside = TSHAPE::NSides-TSHAPE::NFaces-1;
891  if (side < firstside || side >= TSHAPE::NSides - 1) {
892  DebugStop();
893  }
894  fSideOrient[side-firstside] = sideorient;
895 }
896 
897 //compute the values of the shape function of the side
898 template<class TSHAPE>
900 
901  if(side==TSHAPE::NSides || point.size() != TSHAPE::Dimension-1){
902  std::cout<<"Don't have side shape associated to this side";
903  DebugStop();
904  }
905  if(TSHAPE::SideDimension(side)!= TSHAPE::Dimension -1 ){
906  return ;
907  }
908  int ncontained = TSHAPE::NContainedSides(side);
909  int nsideshape = 0;
910  int connectlocid = SideConnectLocId(0, side);
911  int order = this->Connect(connectlocid).Order();
912  int is;
913  for (is=0; is<ncontained; is++) {
914  int ic = TSHAPE::ContainedSideLocId(side,is);
915  nsideshape += TSHAPE::NConnectShapeF(ic,order);
916  }
917 #ifdef PZDEBUG
918  if (nsideshape != this->NSideShapeF(side)) {
919  DebugStop();
920  }
921 #endif
922 
923  TPZGeoEl *gel = this->Reference();
924  //int nc = gel->NCornerNodes();
925  int nsn = TSHAPE::NSideNodes(side);
926  TPZManVector<int64_t,8> id(nsn);
927  for (int ic=0; ic<nsn; ic++) {
928  int locid = TSHAPE::SideNodeLocId(side,ic);
929  id[ic] = gel->Node(locid).Id();
930  }
931 
932  //int idsize = id.size();
933  TPZManVector<int,9> permutegather(ncontained);
934  int transformid;
935 
936 
937  MElementType sidetype = TSHAPE::Type(side);
938  switch (sidetype) {
939  case EOned:
940  transformid = pztopology::TPZLine::GetTransformId(id);
941  pztopology::TPZLine::GetSideHDivPermutation(transformid, permutegather);
942  break;
943  case EQuadrilateral:
945  pztopology::TPZQuadrilateral::GetSideHDivPermutation(transformid, permutegather);
946  break;
947  case ETriangle:
948  transformid = pztopology::TPZTriangle::GetTransformId(id);
949  pztopology::TPZTriangle::GetSideHDivPermutation(transformid, permutegather);
950  break;
951  default:
952  DebugStop();
953  break;
954  }
955 
956  TPZManVector<int,TSHAPE::NSides> ord(TSHAPE::NSides,order);
957 
958  int sidedimension = TSHAPE::SideDimension(side);
959  TPZFNMatrix<50,REAL> philoc(nsideshape,1),dphiloc(sidedimension,nsideshape);
960 
961  TSHAPE::SideShape(side,point,id,ord,philoc,dphiloc);
962 
963  int ncs = TSHAPE::NContainedSides(side);
964  TPZManVector<int64_t,28> FirstIndex(ncs+1,0);
965  for (int ls=0; ls<ncs; ls++) {
966  int localside = TSHAPE::ContainedSideLocId(side,ls);
967  FirstIndex[ls+1] = FirstIndex[ls]+TSHAPE::NConnectShapeF(localside,order);
968  }
969 
970  REAL detjac = 1.;
971  {
972  TPZGeoElSide gelside = TPZGeoElSide(this->Reference(),side);
973  int dim = gel->SideDimension(side);
974  TPZFNMatrix<9,REAL> jac(dim,dim),jacinv(dim,dim),axes(dim,3);
975  gelside.Jacobian(point, jac, axes, detjac, jacinv);
976  }
977 
978  for (int side=0; side < ncs; side++) {
979  int ifirst = FirstIndex[side];
980  int kfirst = FirstIndex[permutegather[side]];
981  int nshape = FirstIndex[side+1]-FirstIndex[side];
982  for (int i=0; i<nshape; i++) {
983  phi(ifirst+i,0) = philoc(kfirst+i,0)/detjac;
984  for (int d=0; d< sidedimension; d++) {
985  dphi(d,ifirst+i) = dphiloc(d,kfirst+i)/detjac;
986  }
987  }
988  }
989 
990 }
991 
992 template<class TSHAPE>
994 {
995  if (var == 99) {
996  return TPZIntelGen<TSHAPE>::Solution(qsi,var,sol);
997  }
998  TPZMaterialData data;
999  InitMaterialData(data);
1000  //this->ComputeSolutionHDiv(data);
1001  this->ComputeRequiredData(data,qsi);
1002  this->ComputeSolutionHDiv(qsi,data);
1003  this->Material()->Solution(data,var,sol);
1004 }
1005 
1006 template<class TSHAPE>
1008 {
1009 // this->ComputeShape(qsi, data.x,data.jacobian,data.axes, data.detjac,data.jacinv,data.phi, data.dphix);
1010  this->ComputeShape(qsi,data);
1011  this->ComputeSolutionHDiv(data);
1012 }
1013 
1014 template<class TSHAPE>
1016  const TPZFMatrix<REAL> &axes, TPZSolVec &sol, TPZGradSolVec &dsol){
1017  TPZMaterialData data;
1018  InitMaterialData(data);
1019  data.phi = phi;
1020  data.dphix = dphix;
1021  data.axes = axes;
1022  this->ComputeSolutionHDiv(data);
1023  sol = data.sol;
1024  dsol = data.dsol;
1025 }
1026 
1027 template<class TSHAPE>
1029 
1030  this->ComputeSolutionHDiv(data);
1031 
1032 }
1033 
1034 template<class TSHAPE>
1036 
1037  TPZGeoEl * ref = this->Reference();
1038  const int nshape = this->NShapeF();
1039  const int dim = ref->Dimension();
1040 
1041  TPZMaterialData data;
1042  InitMaterialData(data);
1043  data.fNeedsSol = true;
1044  ComputeRequiredData(data,qsi);
1045  sol = data.sol;
1046  dsol = data.dsol;
1047  axes = data.axes;
1048 }
1049 
1050 template<class TSHAPE>
1052 {
1053  const int dim = 3; // Hdiv vectors are always in R3
1054  const int nstate = this->Material()->NStateVariables();
1055  const int ncon = this->NConnects();
1056 
1057  TPZFMatrix<STATE> &MeshSol = this->Mesh()->Solution();
1058 
1059  int64_t numbersol = MeshSol.Cols();
1060  if(numbersol != 1)
1061  {
1062  DebugStop();
1063  }
1064  data.sol.Resize(numbersol);
1065  data.dsol.Resize(numbersol);
1066  data.divsol.Resize(numbersol);
1067 
1068  for (int64_t is=0; is<numbersol; is++)
1069  {
1070  data.sol[is].Resize(dim*nstate);
1071  data.sol[is].Fill(0);
1072  data.dsol[is].Redim(dim*nstate, dim);
1073  data.divsol[is].Resize(nstate);
1074  data.divsol[is].Fill(0.);
1075  }
1076  TPZFNMatrix<220,REAL> dphix(3,data.dphix.Cols());
1077  TPZFMatrix<REAL> &dphi = data.dphix;;
1078 
1079  TPZAxesTools<REAL>::Axes2XYZ(dphi, dphix, data.axes);
1080 
1081  TPZFMatrix<STATE> GradOfPhiHdiv(dim,dim);
1082  GradOfPhiHdiv.Zero();
1083 
1084 
1085  int normvecRows = data.fNormalVec.Rows();
1086  int normvecCols = data.fNormalVec.Cols();
1087  TPZFNMatrix<3,REAL> Normalvec(normvecRows,normvecCols,0.);
1088  TPZManVector<TPZFNMatrix<9,REAL>,18> GradNormalvec(normvecCols);
1089  for (int i=0; i<GradNormalvec.size(); i++) {
1090  GradNormalvec[i].Redim(dim,dim);
1091  }
1092 
1093  if (data.fNeedsNormalVecFad) {
1094 #ifdef _AUTODIFF
1095  for (int e = 0; e < normvecRows; e++) {
1096  for (int s = 0; s < normvecCols; s++) {
1097  Normalvec(e,s)=data.fNormalVecFad(e,s).val();
1098  }
1099  }
1100 
1101  TPZFNMatrix<4,REAL> Grad0(3,3,0.);
1102 
1103  for (int s = 0; s < normvecCols; s++) {
1104 
1105  if (data.fNormalVecFad(0,s)>0||data.fNormalVecFad(1,s)>0) {
1106  Grad0(0,0)=data.fNormalVecFad(0,s).fastAccessDx(0);
1107  Grad0(0,1)=data.fNormalVecFad(0,s).fastAccessDx(1);
1108  Grad0(1,0)=data.fNormalVecFad(1,s).fastAccessDx(0);
1109  Grad0(1,1)=data.fNormalVecFad(1,s).fastAccessDx(1);
1110  }
1111 
1112  GradNormalvec[s] = Grad0;
1113  }
1114 
1115 #else
1116  DebugStop();
1117 #endif
1118  }else{
1119  Normalvec=data.fNormalVec;
1120  }
1121 
1122  TPZBlock<STATE> &block =this->Mesh()->Block();
1123  int ishape=0,ivec=0,counter=0;
1124 
1125  int nshapeV = data.fVecShapeIndex.NElements();
1126 
1127  for(int in=0; in<ncon; in++)
1128  {
1129  TPZConnect *df = &this->Connect(in);
1130  int64_t dfseq = df->SequenceNumber();
1131  int dfvar = block.Size(dfseq);
1132  // pos : position of the block in the solution matrix
1133  int64_t pos = block.Position(dfseq);
1134 
1136  for(int ish=0; ish<dfvar/nstate; ish++)
1137  {
1138  ivec = data.fVecShapeIndex[counter].first;
1139  ishape = data.fVecShapeIndex[counter].second;
1140 
1141 
1142  // portion of the gradient coming from the gradient of the scalar function
1143  for (int e = 0; e < dim; e++) {
1144  for (int f = 0; f< dim; f++) {
1145  GradOfPhiHdiv(e,f) = Normalvec(e,ivec)*dphix(f,ishape);
1146  }
1147  }
1148 
1149  for (int64_t is=0; is<numbersol; is++)
1150  {
1151  for(int idf=0; idf<nstate; idf++)
1152  {
1153  STATE meshsol = MeshSol(pos+ish*nstate+idf,is);
1154  REAL phival = data.phi(ishape,0);
1155  TPZManVector<REAL,3> normal(3);
1156 
1157  for (int i=0; i<3; i++)
1158  {
1159  if (data.fNeedsNormalVecFad) {
1160 #ifdef _AUTODIFF
1161  normal[i] = data.fNormalVecFad(i,ivec).val();
1162 #else
1163  DebugStop();
1164 #endif
1165  }else{
1166  normal[i] = data.fNormalVec(i,ivec);
1167  }
1168  }
1169 
1170 #ifdef LOG4CXX
1171  if(logger->isDebugEnabled() && abs(meshsol) > 1.e-6)
1172  {
1173  std::stringstream sout;
1174  sout << "meshsol = " << meshsol << " ivec " << ivec << " ishape " << ishape << " x " << data.x << std::endl;
1175  sout << " phi = " << data.phi(ishape,0) << " dphix " << dphix(0,ishape) << " " << dphix(1,ishape) << std::endl;
1176  sout << "normal = " << normal << std::endl;
1177  sout << "GradOfPhiHdiv " << GradOfPhiHdiv << std::endl;
1178  sout << "GradNormalVec " << GradNormalvec[ivec] << std::endl;
1179  LOGPZ_DEBUG(logger,sout.str())
1180  }
1181 #endif
1182  data.divsol[is][idf] += data.divphi(counter,0)*meshsol;
1183  for (int ilinha=0; ilinha<dim; ilinha++) {
1184  data.sol[is][ilinha+dim*idf] += normal[ilinha]*phival*meshsol;
1185  for (int kdim = 0 ; kdim < dim; kdim++) {
1186  data.dsol[is](ilinha+dim*idf,kdim)+= meshsol * GradOfPhiHdiv(ilinha,kdim);
1187  if(data.fNeedsNormalVecFad){
1188  data.dsol[is](ilinha+dim*idf,kdim)+=meshsol *GradNormalvec[ivec](ilinha,kdim)*data.phi(ishape,0);
1189  }
1190  }
1191  }
1192 
1193  }
1194  }
1195  counter++;
1196  }
1197  }
1198 
1199 #ifdef LOG4CXX
1200  if(logger->isDebugEnabled())
1201  {
1202  std::stringstream sout;
1203  sout << "x " << data.x << " sol " << data.sol[0] << std::endl;
1204  data.dsol[0].Print("dsol",sout);
1205  sout << "divsol" << data.divsol[0] << std::endl;
1206  LOGPZ_DEBUG(logger,sout.str())
1207  }
1208 #endif
1209 
1210 }
1211 
1212 template<class TSHAPE>
1214 {
1215 
1216  bool Is_u1PHI = (u1.Cols() == 1) ? true : false;
1217  bool Is_u2PHI = (u2.Cols() == 1) ? true : false;
1218 
1219  if(Is_u1PHI && Is_u2PHI)
1220  {
1221  int64_t nu1 = u1.Rows(),nu2 = u2.Rows();
1222  u12.Redim(nu1+nu2,1);
1223  int64_t i;
1224  for(i=0; i<nu1; i++) u12(i,0) = u1(i,0);
1225  for(i=0; i<nu2; i++) u12(i+nu1,0) = u2(i,0);
1226 
1227 
1228  }
1229  else if(!Is_u1PHI || !Is_u2PHI)
1230  {
1231  int64_t ru1 = u1.Rows(), cu1 = u1.Cols(), ru2 = u2.Rows(), cu2 = u2.Cols();
1232  int64_t ru12 = ru1 < ru2 ? ru2 : ru1;
1233  int64_t cu12 = cu1+cu2;
1234  u12.Redim(ru12,cu12);
1235  int64_t i,j;
1236  for(i=0; i<ru1; i++) for(j=0; j<cu1; j++) u12(i,j) = u1(i,j);
1237  for(i=0; i<ru2; i++) for(j=0; j<cu2; j++) u12(i,j+cu1) = u2(i,j);
1238  }
1239  else
1240  {
1241  PZError << "TPZCompElHDiv::Append. Bad input parameters " << std::endl;
1242 
1243  }
1244 
1245 }
1246 
1247 template<class TSHAPE>
1249 {
1250  int nvecs = TSHAPE::Dimension*TSHAPE::NSides;
1251  TPZManVector<int,3*27> associated_side(nvecs),bilinear(nvecs),direction(nvecs);
1252  TSHAPE::GetSideHDivDirections(associated_side,direction,bilinear);
1253  TPZManVector<int,27> sideinc(TSHAPE::NSides,0);
1254  for (int iv=0; iv<nvecs; iv++) {
1255  int side = associated_side[iv];
1256  int bil = bilinear[iv];
1257  if (bil) {
1258  sideinc[side] = 1;
1259  }
1260  }
1261  order.resize(TSHAPE::NSides-TSHAPE::NCornerNodes);
1262  int ncon = NConnects();
1263 
1264  TPZConnect &c = this->Connect(ncon-1);
1265  int internalorder = c.Order();
1266  int nsides = TSHAPE::NSides;
1267  for (int is=0; is<nsides; is++) {
1268  if (TSHAPE::SideDimension(is) ==0) {
1269  continue;
1270  }
1271  else if(TSHAPE::SideDimension(is) == TSHAPE::Dimension -1)
1272  {
1273  int intorder = internalorder;
1274  if (sideinc[is]) {
1275  intorder++;
1276  }
1277  int connectindex = SideConnectLocId(0, is);
1278  if (connectindex < 0) {
1279  DebugStop();
1280  }
1281  TPZConnect &c = this->Connect(connectindex);
1282  if (c.Order() > intorder) {
1283  intorder = c.Order();
1284  }
1285  order[is-TSHAPE::NCornerNodes] = intorder;
1286  }
1287  else
1288  {
1289  int intorder = internalorder;
1290  if (sideinc[is]) {
1291  intorder++;
1292  }
1293  order[is-TSHAPE::NCornerNodes] = intorder;
1294  }
1295  }
1296 }
1297 
1298 
1299 template<class TSHAPE>
1301  TPZManVector<int64_t,TSHAPE::NCornerNodes> id(TSHAPE::NCornerNodes,0);
1302  TPZManVector<int, TSHAPE::NSides-TSHAPE::NCornerNodes+1> ord(TSHAPE::NSides-TSHAPE::NCornerNodes,0);
1303  int i;
1304  TPZGeoEl *ref = this->Reference();
1305  for(i=0; i<TSHAPE::NCornerNodes; i++) {
1306  id[i] = ref->NodePtr(i)->Id();
1307  }
1308 
1309 
1310  FillOrder(ord);
1311  int nshape= this->NShapeContinuous(ord);
1312 
1313  phi.Redim(nshape, 1);
1314  dphi.Redim(TSHAPE::Dimension, nshape);
1315  TSHAPE::Shape(pt,id,ord,phi,dphi);
1316 
1317 }
1318 
1319 template<class TSHAPE>
1321 
1322  return TSHAPE::NShapeF(order);
1323 //#ifdef LOG4CXX
1324 // {
1325 // std::stringstream sout;
1326 // sout << "ordem max "<<maxorder<< " vec order " << order<<" num func cont "<< nshape<<std::endl;
1327 // LOGPZ_DEBUG(logger,sout.str())
1328 // }
1329 //#endif
1330 
1331 
1332 }
1333 
1334 
1335 template<class TSHAPE>
1337  return TSHAPE::TransformSideToElement(side);
1338 }
1339 
1340 template<class TSHAPE>
1342 
1343  DebugStop();
1344  TPZManVector<int64_t> firstshapeindex;
1345  FirstShapeIndex(firstshapeindex);
1346  int nshape = TPZIntelGen<TSHAPE>::NShapeF();
1347  shapeindex.Resize(nshape);
1348  int64_t nsides = sides.NElements();
1349  int64_t is, count=0;
1350  for(is=0 ; is<nsides; is++)
1351  {
1352  int side = sides[is];
1353  int conind = SideConnectLocId(0, side);
1354  int sideorder = this->Connect(conind).Order();
1355  int NShapeFace = TSHAPE::NConnectShapeF(side,sideorder);
1356  int ishapeface;
1357  for(ishapeface=0; ishapeface<NShapeFace; ishapeface++)
1358  {
1359  shapeindex[count++] = is;
1360  }
1361  }
1362  shapeindex.Resize(count);
1363 #ifdef LOG4CXX
1364  if (logger->isDebugEnabled())
1365  {
1366  std::stringstream sout;
1367  sout << "count = " << count << " nshape " << nshape;
1368  sout << endl<<"sides associated with the normals "<< sides <<
1369  "\nnormal associated with each shape function : shape function indexes " << shapeindex;
1370  LOGPZ_DEBUG(logger,sout.str())
1371  }
1372 #endif
1373 }
1374 
1375 template<class TSHAPE>
1377  TPZVec<REAL> &qsi){
1378 
1379 // TPZManVector<int,TSHAPE::NSides*TSHAPE::Dimension> normalsidesDG(TSHAPE::Dimension*TSHAPE::NSides);
1380 
1381  bool needsol = data.fNeedsSol;
1382  data.fNeedsSol = false;
1384  data.fNeedsSol = needsol;
1385 
1386  int restrainedface = this->RestrainedFace();
1387  // Acerta o vetor data.fNormalVec para considerar a direcao do campo. fSideOrient diz se a orientacao e de entrada
1388  // no elemento (-1) ou de saida (+1), dependedo se aquele lado eh vizinho pela direita (-1) ou pela esquerda(+1)
1389  int firstface = TSHAPE::NSides - TSHAPE::NFaces - 1;
1390  int lastface = TSHAPE::NSides - 1;
1391  int cont = 0;
1392 
1394 
1395  for(int side = firstface; side < lastface; side++)
1396  {
1397  int nvec = TSHAPE::NContainedSides(side);
1398  for (int ivet = 0; ivet<nvec; ivet++)
1399  {
1400  for (int il = 0; il<3; il++)
1401  {
1402  data.fDirectionsOnMaster(il,ivet+cont) *= fSideOrient[side-firstface];
1403  }
1404 
1405  }
1406  cont += nvec;
1407  }
1408 
1409  if(data.fNeedsNormalVecFad){
1410  #ifdef _AUTODIFF
1411  TPZIntelGen<TSHAPE>::Reference()->HDivDirections(qsi,data.fNormalVecFad,restrainedface);
1412  cont = 0;
1413 
1414  for(int side = firstface; side < lastface; side++)
1415  {
1416  int nvec = TSHAPE::NContainedSides(side);
1417  for (int ivet = 0; ivet<nvec; ivet++)
1418  {
1419  for (int il = 0; il<3; il++)
1420  {
1421  data.fNormalVecFad(il,ivet+cont) *= fSideOrient[side-firstface];
1422  }
1423 
1424  }
1425  cont += nvec;
1426  }
1427  #else
1428  DebugStop();
1429  #endif
1430  }else{
1431  TPZIntelGen<TSHAPE>::Reference()->HDivDirections(qsi,data.fNormalVec,restrainedface);
1432  cont = 0;
1433 
1434  for(int side = firstface; side < lastface; side++)
1435  {
1436  int nvec = TSHAPE::NContainedSides(side);
1437  for (int ivet = 0; ivet<nvec; ivet++)
1438  {
1439  for (int il = 0; il<3; il++)
1440  {
1441  data.fNormalVec(il,ivet+cont) *= fSideOrient[side-firstface];
1442  }
1443 
1444  }
1445  cont += nvec;
1446  }
1447  }
1448 
1450  if (data.fNeedsSol) {
1451  ComputeSolution(qsi, data);
1452  }
1453 
1454 
1455 #ifdef LOG4CXX
1456  if (logger->isDebugEnabled()) {
1457  std::stringstream sout;
1458  data.fNormalVec.Print("Normal Vectors " , sout,EMathematicaInput);
1459  LOGPZ_DEBUG(logger, sout.str())
1460  }
1461 #endif
1462 
1463 
1464 }//void
1465 
1470 template<class TSHAPE>
1472 {
1474 // if (TSHAPE::Type()==EQuadrilateral) {
1475 // int maxorder = this->MaxOrder();
1476 // data.p = maxorder+1;
1477 // }
1478 #ifdef LOG4CXX
1479  if(logger->isDebugEnabled())
1480  {
1481  LOGPZ_DEBUG(logger,"Initializing MaterialData of TPZCompElHDiv")
1482  }
1483 #endif
1484  TPZManVector<int,TSHAPE::Dimension*TSHAPE::NSides> vecside(TSHAPE::Dimension*TSHAPE::NSides),bilinear(TSHAPE::Dimension*TSHAPE::NSides),directions(TSHAPE::Dimension*TSHAPE::NSides);
1485 
1486  TPZFNMatrix<TSHAPE::NSides*TSHAPE::Dimension*3> NormalsDouglas(3,TSHAPE::Dimension*TSHAPE::NSides);
1487  TPZManVector<int,TSHAPE::NSides*TSHAPE::Dimension+1> normalsides(TSHAPE::Dimension*TSHAPE::NSides);
1488  TPZManVector<REAL,TSHAPE::Dimension> pt(TSHAPE::Dimension,0.);
1489 
1490  {
1491 
1492  int internalorder = this->Connect(NConnects()-1).Order();
1493  TPZVec<std::pair<int,int64_t> > IndexVecShape;
1494  if (TSHAPE::Type()==EPiramide) {
1495  normalsides.resize(3*TSHAPE::NSides+1);
1496  }
1497  TSHAPE::GetSideHDivDirections(vecside,directions,bilinear,normalsides);
1498  int64_t numvec = TSHAPE::Dimension*TSHAPE::NSides;
1499  if (TSHAPE::Type() == EPiramide) {
1500  numvec++;
1501  }
1502 
1503  data.fDirectionsOnMaster.Resize(3, numvec);
1504 
1505 #ifdef _AUTODIFF
1506  data.fNormalVecFad.Resize(3, numvec);
1507 #endif
1508 
1509  data.fNormalVec.Resize(3, numvec);
1510 
1511 
1512  IndexShapeToVec2(normalsides, bilinear, directions,data.fVecShapeIndex,internalorder);
1513  }
1515 
1516 // cout << "vecShape " << endl;
1517 // cout << data.fVecShapeIndex << endl;;
1518 
1519 
1520 #ifdef LOG4CXX
1521  if(logger->isDebugEnabled())
1522  {
1523  std::stringstream sout;
1524  data.fNormalVec.Print("Normal vector ", sout,EMathematicaInput);
1525  for (int i=0; i<TSHAPE::NCornerNodes; i++) {
1526  sout << "Id[" << i << "] = " << this->Reference()->NodePtr(i)->Id() << " ";
1527  }
1528  sout << "\n\nSides associated with the normals\n";
1529  for (int i=0; i<normalsides.size(); i++) {
1530  sout << i << '|' << normalsides[i] << " ";
1531  }
1532  sout << std::endl;
1533 
1534  sout << std::endl;
1535  sout << "NormalVector/Shape indexes \n";
1536  for (int i=0; i<data.fVecShapeIndex.size(); i++) {
1537  sout << i << '|' << data.fVecShapeIndex[i] << " ";
1538  }
1539  sout << std::endl;
1540  LOGPZ_DEBUG(logger,sout.str())
1541  }
1542 #endif
1543 
1544 }
1545 
1546 
1547 // Save the element data to a stream
1548 template<class TSHAPE>
1549 void TPZCompElHDiv<TSHAPE>::Write(TPZStream &buf, int withclassid) const
1550 {
1551  TPZInterpolatedElement::Write(buf,withclassid);
1552  TPZManVector<int,3> order(3,0);
1553  this->fIntRule.GetOrder(order);
1554  buf.Write(order);
1555  buf.Write(fSideOrient);
1556 
1557  buf.Write(this->fConnectIndexes.begin(),TSHAPE::NSides);
1558  buf.Write(&this->fPreferredOrder,1);
1559  buf.Write(fSideOrient);
1560  int sz = fRestraints.size();
1561  buf.Write(&sz);
1562  for (std::list<TPZOneShapeRestraint>::const_iterator it = fRestraints.begin(); it != fRestraints.end(); it++) {
1563  it->Write(buf);
1564  }
1565  int classid = this->ClassId();
1566  buf.Write ( &classid, 1 );
1567 }
1568 
1569 
1570 // Read the element data from a stream
1571 template<class TSHAPE>
1572 void TPZCompElHDiv<TSHAPE>::Read(TPZStream &buf, void *context)
1573 {
1574  TPZInterpolatedElement::Read(buf,context);
1575  TPZManVector<int,3> order;
1576  buf.Read(order);
1577  this-> fIntRule.SetOrder(order);
1579  buf.Read(SideOrient);
1581  buf.Read(this->fConnectIndexes.begin(),TSHAPE::NSides);
1582  buf.Read(&this->fPreferredOrder,1);
1583  buf.Read(fSideOrient);
1584  int sz;
1585  buf.Read(&sz);
1586  for (int i=0; i<sz; i++) {
1588  one.Read(buf);
1589  fRestraints.push_back(one);
1590  }
1591  int classid = -1;
1592  buf.Read( &classid, 1 );
1593  if ( classid != this->ClassId())
1594  {
1595  std::stringstream sout;
1596  sout << "ERROR - " << __PRETTY_FUNCTION__
1597  << " trying to restore an object id " << this->ClassId() << " and classid read = " << classid;
1598  LOGPZ_ERROR ( logger, sout.str().c_str() );
1599  }
1600 }
1601 //refinamento
1602 template<class TSHAPE>
1604 {
1605  this->SetPreferredOrder(order);
1606  int side;
1607  int icon;
1608  int ncon=NConnects();
1609  TPZCompElHDivPressure<TSHAPE> *hdivpressure = dynamic_cast<TPZCompElHDivPressure<TSHAPE> *>(this);
1610 
1611  if (hdivpressure) {
1612  ncon--;
1613  }
1614  int nnodes = this->Reference()->NNodes();
1615  for(icon=0; icon<ncon; icon++)
1616  {//somente para os conects de fluxo
1617 // TPZConnect &con = this->Connect(icon);
1618 // con.SetOrder(order);
1619  side= ConnectSideLocId(icon);
1620 
1621 #ifdef LOG4CXX
1622  if (logger->isDebugEnabled())
1623  {
1624  std::stringstream sout;
1625  sout << "side " << side << " order " << this->PreferredSideOrder(side)<<std::endl;
1626  LOGPZ_DEBUG(logger,sout.str())
1627  }
1628 #endif
1629 
1630  this->IdentifySideOrder(side);
1631  }
1632  #ifdef LOG4CXX
1633  if (loggerdiv->isDebugEnabled()) {
1634  std::stringstream sout;
1635  sout << (void*) this->Mesh() << "PRefine elindex " << this->Index() << " gel index " << this->Reference()->Index() << " " << order;
1636  sout << "\nPRefine connect orders ";
1637  int nc = this->NConnects();
1638  for(int ic=0; ic<nc; ic++) sout << (int)this->Connect(ic).Order() << " ";
1639  LOGPZ_DEBUG(loggerdiv, sout.str())
1640  }
1641 #endif
1642 
1643  // conect da pressao
1644 
1645  if(ncon>nnodes+1)
1646  {
1647  TPZCompElHDivPressure<TSHAPE> *hdivpressure = dynamic_cast<TPZCompElHDivPressure<TSHAPE> *>(this);
1648  TPZConnect &con = this->Connect(ncon-1);
1649 
1650  if (TSHAPE::Type()==EQuadrilateral) {
1651  hdivpressure->SetPressureOrder(order);
1652  con.SetOrder(order,this->fConnectIndexes[ncon-1]);
1653 
1654  }
1655  else {
1656  hdivpressure->SetPressureOrder(order-1);
1657  con.SetOrder(order-1,this->fConnectIndexes[ncon-1]);
1658 
1659  }
1660  int nshape = hdivpressure-> NConnectShapeF(ncon-1,con.Order());
1661  con.SetNShape(nshape);
1662  int64_t seqnum = con.SequenceNumber();
1663  this->Mesh()->Block().Set(seqnum,nshape);
1664  }
1665 
1666 
1667 }
1668 
1670 template<class TSHAPE>
1671 void TPZCompElHDiv<TSHAPE>::Print(std::ostream &out) const
1672 {
1673  out << __PRETTY_FUNCTION__ << std::endl;
1675  out << "Side orientation " << fSideOrient << std::endl;
1676  if (fRestraints.size()) {
1677  out << "One shape restraints associated with the element\n";
1678  for (std::list<TPZOneShapeRestraint>::const_iterator it = fRestraints.begin(); it != fRestraints.end(); it++)
1679  {
1680  it->Print(out);
1681  }
1682  }
1683 
1684 
1685 
1686 }
1687 
1688 template<class TSHAPE>
1690 
1691  int maxorder = TPZInterpolationSpace::MaxOrder();
1692  return maxorder+1;
1693 }
1694 
1695 #include "pzshapecube.h"
1696 #include "TPZRefCube.h"
1697 #include "pzshapelinear.h"
1698 #include "TPZRefLinear.h"
1699 #include "pzrefquad.h"
1700 #include "pzshapequad.h"
1701 #include "pzgeoquad.h"
1702 #include "pzshapetriang.h"
1703 #include "pzreftriangle.h"
1704 #include "pzgeotriangle.h"
1705 #include "pzshapeprism.h"
1706 #include "pzrefprism.h"
1707 #include "pzgeoprism.h"
1708 #include "pzshapetetra.h"
1709 #include "pzreftetrahedra.h"
1710 #include "pzgeotetrahedra.h"
1711 #include "pzshapepiram.h"
1712 #include "pzrefpyram.h"
1713 #include "pzgeopyramid.h"
1714 #include "pzrefpoint.h"
1715 #include "pzgeopoint.h"
1716 #include "pzshapepoint.h"
1717 #include "pzgraphelq2dd.h"
1718 #include "tpzgraphelt3d.h"
1719 #include "pzgraphel1dd.h"
1720 #include "pztrigraphd.h"
1721 #include "pzgraphelq3dd.h"
1722 #include "tpzgraphelprismmapped.h"
1723 #include "tpzgraphelpyramidmapped.h"
1724 #include "tpzgraphelt2dmapped.h"
1725 
1726 using namespace pztopology;
1727 
1728 #include "tpzpoint.h"
1729 #include "tpzline.h"
1730 #include "tpzquadrilateral.h"
1731 #include "tpztriangle.h"
1732 #include "tpzcube.h"
1733 #include "tpztetrahedron.h"
1734 #include "tpzprism.h"
1735 
1736 #include "pzelchdivbound2.h"
1737 
1738 using namespace pzgeom;
1739 using namespace pzshape;
1740 
1741 
1742 template<class TSHAPE>
1744  if(dimension == TSHAPE::Dimension && this->Material()->Id() > 0) {
1745  new typename TSHAPE::GraphElType(this,&grafgrid);
1746  }
1747 }
1748 
1750 template<class TSHAPE>
1752 {
1753  return -1;
1754 }
1755 
1756 template<>
1758 {
1759  if (fRestraints.size() == 0) {
1760  return -1;
1761  DebugStop(); //AQUIPHIL
1762  }
1763  std::list<TPZOneShapeRestraint>::iterator it = fRestraints.begin();
1764  int foundis = -1;
1765  bool found = false;
1766  while (found == false && it != fRestraints.end()) {
1767  int64_t connectindex = it->fFaces[3].first;
1768  int64_t cindex = -1;
1769  for (int is = 14; is<18; is++) {
1770  cindex = ConnectIndex(is-13);
1771  if (connectindex == cindex) {
1772  found = true;
1773  foundis = is+1;
1774  if (foundis == 18) {
1775  foundis = 14;
1776  }
1777  }
1778  }
1779  it++;
1780  }
1781  if (found == false) {
1782  DebugStop();
1783  }
1784  return foundis;
1785 }
1786 
1794 
1795 
1796 template class TPZCompElHDiv<TPZShapeLinear>;
1797 template class TPZCompElHDiv<TPZShapeTriang>;
1798 template class TPZCompElHDiv<TPZShapeQuad>;
1799 template class TPZCompElHDiv<TPZShapeTetra>;
1800 template class TPZCompElHDiv<TPZShapePrism>;
1801 template class TPZCompElHDiv<TPZShapePiram>;
1802 template class TPZCompElHDiv<TPZShapeCube>;
1803 
1804 
1806  return new TPZCompElHDivBound2<TPZShapePoint>(mesh,gel,index);
1807 }
1808 
1810  return new TPZCompElHDivBound2< TPZShapeLinear>(mesh,gel,index);
1811 }
1812 
1813 TPZCompEl * CreateHDivBoundQuadEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1814  return new TPZCompElHDivBound2< TPZShapeQuad>(mesh,gel,index);
1815 }
1816 
1818  return new TPZCompElHDivBound2< TPZShapeTriang >(mesh,gel,index);
1819 }
1820 
1821 TPZCompEl * CreateHDivLinearEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1822  return new TPZCompElHDiv< TPZShapeLinear>(mesh,gel,index);
1823 }
1824 
1825 TPZCompEl * CreateHDivQuadEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1826  return new TPZCompElHDiv< TPZShapeQuad>(mesh,gel,index);
1827 }
1828 
1829 TPZCompEl * CreateHDivTriangleEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1830  return new TPZCompElHDiv< TPZShapeTriang >(mesh,gel,index);
1831 }
1832 
1833 TPZCompEl * CreateHDivCubeEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1834  return new TPZCompElHDiv< TPZShapeCube >(mesh,gel,index);
1835 }
1836 
1837 TPZCompEl * CreateHDivPrismEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1838  return new TPZCompElHDiv< TPZShapePrism>(mesh,gel,index);
1839 }
1840 
1841 TPZCompEl * CreateHDivPyramEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1842  return new TPZCompElHDiv< TPZShapePiram >(mesh,gel,index);
1843 }
1844 
1845 TPZCompEl * CreateHDivTetraEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1846  return new TPZCompElHDiv< TPZShapeTetra >(mesh,gel,index);
1847 }
1848 
1849 #include "pzreferredcompel.h"
1850 
1858 
1859 
1867 
1868 TPZCompEl * CreateRefHDivLinearEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1869  return new TPZReferredCompEl<TPZCompElHDiv< TPZShapeLinear>>(mesh,gel,index);
1870 }
1871 
1872 TPZCompEl * CreateRefHDivQuadEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1873  return new TPZReferredCompEl<TPZCompElHDiv< TPZShapeQuad>>(mesh,gel,index);
1874 }
1875 
1877  return new TPZReferredCompEl<TPZCompElHDiv< TPZShapeTriang >>(mesh,gel,index);
1878 }
1879 
1880 TPZCompEl * CreateRefHDivCubeEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1881  return new TPZReferredCompEl<TPZCompElHDiv< TPZShapeCube >>(mesh,gel,index);
1882 }
1883 
1884 TPZCompEl * CreateRefHDivPrismEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1885  return new TPZReferredCompEl<TPZCompElHDiv< TPZShapePrism>>(mesh,gel,index);
1886 }
1887 
1888 TPZCompEl * CreateRefHDivPyramEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1889  return new TPZReferredCompEl<TPZCompElHDiv< TPZShapePiram >>(mesh,gel,index);
1890 }
1891 
1892 TPZCompEl * CreateRefHDivTetraEl(TPZGeoEl *gel,TPZCompMesh &mesh,int64_t &index) {
1893  return new TPZReferredCompEl<TPZCompElHDiv< TPZShapeTetra >>(mesh,gel,index);
1894 }
virtual void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
Represents a graphical mesh used for post processing purposes. Post processing.
Definition: pzgraphmesh.h:34
void Shape(TPZVec< REAL > &pt, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi) override
Computes the shape function set at the point x.
Definition: pzelchdiv.cpp:1300
Contains TPZShapeTetra class which implements the shape functions of a tetrahedral element...
void Print(std::ostream &out=std::cout)
Prints the structural information of the vector object to the output stream. This method will not p...
Definition: pzvec.h:482
virtual void Print(std::ostream &out=std::cout) const override
Prints the relevant data of the element to the output stream.
Definition: pzelchdiv.cpp:1671
void Read(TPZStream &buf)
Contains the TPZGraphElTd class which implements the graphical discontinuous triangular element...
TPZCompEl * CreateRefHDivTriangleEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Definition: pzelchdiv.cpp:1876
Contains the TPZInt1d, TPZIntTriang, TPZIntQuad, TPZIntCube3D, TPZIntTetra3D, TPZIntPyram3D and TPZIn...
int Position(const int block_diagonal) const
Returns the position of first element block dependent on matrix diagonal.
Definition: pzblock.h:177
virtual void GetInterpolationOrder(TPZVec< int > &ord) override
Identifies the interpolation order on the interior of the element.
Definition: pzelchdiv.cpp:449
Implements computational element and a side. Computational Element.
Definition: pzcompel.h:632
TPZCompEl * CreateHDivPrismEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational prismal element for HDiv approximate space.
Definition: pzelchdiv.cpp:1837
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.
TPZManVector< REAL, 3 > x
value of the coordinate at the integration point
virtual void InitMaterialData(TPZMaterialData &data)
Initialize a material data and its attributes based on element dimension, number of state variables a...
void FirstShapeIndex(TPZVec< int64_t > &Index) const
Returns the vector index of the first index shape associate to to each side Special implementation to...
Definition: pzelchdiv.cpp:599
TPZCompEl * CreateHDivCubeEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational cube element for HDiv approximate space.
Definition: pzelchdiv.cpp:1833
void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
Definition: pzintel.cpp:1940
virtual int GetSideOrient(int side) override
It returns the normal orientation of the reference element by the side. Only side that has dimension ...
Definition: pzelchdiv.cpp:873
virtual void resize(const int64_t newsize)
Definition: pzvec.h:213
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
int RestrainedFace()
return the first one dof restraint
Definition: pzelchdiv.cpp:1751
static void Axes2XYZ(const TPZFMatrix< TVar > &dudaxes, TPZFMatrix< TVar > &dudx, const TPZFMatrix< REAL > &axesv, bool colMajor=true)
Makes the basis transformation from axes basis to euclidian basis.
Definition: pzaxestools.h:61
TPZTransform TransformSideToElement(int side) override
Returns the transformation which transform a point from the side to the interior of the element...
Definition: pzelchdiv.cpp:1336
TPZCompEl * CreateRefHDivQuadEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Definition: pzelchdiv.cpp:1872
virtual ~TPZCompElHDiv()
Definition: pzelchdiv.cpp:144
void Print(const char *mess, std::ostream &out=std::cout) const
Definition: pzshtmat.cpp:269
groups all classes dedicated to the computation of shape functions
Definition: pzshapeextend.h:16
TPZCompEl * CreateHDivBoundPointEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational point element for HDiv approximate space.
Definition: pzelchdiv.cpp:1805
static void GetSideHDivPermutation(int transformid, TPZVec< int > &permgather)
Identifies the permutation of the nodes needed to make neighbouring elements compatible in terms of o...
virtual MElementType Type() override
Return the type of the element.
Definition: pzelchdiv.cpp:187
virtual void SetPreferredOrder(int order) override
Sets the preferred interpolation order along a side.
Definition: pzelctemp.cpp:215
TPZCompEl * CreateRefHDivCubeEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Definition: pzelchdiv.cpp:1880
Contains the TPZPoint class which defines the topology of a point.
virtual void SetPressureOrder(int ord)
Identifies the interpolation order for pressure variable.
Contains the TPZRefQuad class which implements the uniform refinement of a geometric quadrilateral el...
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
virtual int ConnectSideLocId(int connect) const
return the local index for side
Definition: pzelchdiv.cpp:442
Definition of the retraint associated with the top of the pyramid.
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
MShapeFunctionType fShapeType
TPZCompElSide LowerLevelCompElementList2(int onlyinterpolated)
return the element/side pair which contains this/side and has a computational element associated ...
static void GetSideHDivPermutation(int transformationid, TPZVec< int > &permgather)
Identifies the permutation of the nodes needed to make neighbouring elements compatible in terms of o...
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Definition: pzgeoelside.h:83
virtual int Dimension() const override
Returns the dimension of the element.
Definition: pzelchdiv.h:93
TinyFad< 8, T > abs(const TinyFad< 8, T > &in)
Definition: tinyfadeight.h:846
Contains declaration of TPZCompElHDiv class which implements a generic computational element (HDiv sc...
virtual int64_t CreateMidSideConnect(int side)
Verify the neighbours of the element and create a node along this side.
Definition: pzintel.cpp:654
static int GetTransformId(TPZVec< int64_t > &id)
Method which identifies the transformation based on the IDs of the corner nodes.
Definition: tpzline.cpp:412
std::list< TPZOneShapeRestraint > fRestraints
Data structure which defines the restraints.
Definition: pzelchdiv.h:28
virtual int SideDimension(int side) const =0
Return the dimension of side.
TPZCompEl * CreateHDivTetraEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational tetrahedral element for HDiv approximate space.
Definition: pzelchdiv.cpp:1845
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Definition: pzmanvector.h:426
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
Contains the TPZTriangle class which defines the topology of a triangle.
void Read(TPZStream &buf, void *context) override
Read the element data from a stream.
Definition: pzelchdiv.cpp:1572
void IndexShapeToVec(TPZVec< int > &VectorSide, TPZVec< std::pair< int, int64_t > > &IndexVecShape, int pressureorder)
Returns a matrix index of the shape and vector associate to element.
Definition: pzelchdiv.cpp:861
Contains TPZShapeLinear class which implements the shape functions of a linear one-dimensional elemen...
Contains the TPZRefPyramid class which implements the uniform refinement of a geometric hexahedral el...
int NShapeF() const override
Returns the total number of shapefunctions.
Definition: pzintel.cpp:63
Contains the TPZTetrahedron class which defines the topology of the tetrahedron element.
void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
Definition: pzintel.cpp:1945
virtual void PRefine(int order) override
Refinement along the element.
Definition: pzelchdiv.cpp:1603
int NShapeContinuous(TPZVec< int > &order)
return the number of continuous functions
Definition: pzelchdiv.cpp:1320
virtual void SetPreferredOrder(int order) override
Sets the preferred interpolation order along a side.
Definition: pzelchdiv.cpp:512
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
virtual void IdentifySideOrder(int side)
Checks if the side order is consistent with the preferred side order and with the constraints and rec...
Definition: pzintel.cpp:216
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
virtual int MaxOrder() override
Return the maximum order??
Definition: pzelchdiv.cpp:1689
virtual void Solution(TPZVec< REAL > &qsi, int var, TPZVec< STATE > &sol) override
Compute the solution for a given variable.
Definition: pzelchdiv.cpp:993
Contains TPZShapeCube class which implements the shape functions of a hexaedral element.
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
Definition: pzcompel.cpp:959
int Zero() override
Makes Zero all the elements.
Definition: pzfmatrix.h:651
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
Contains the TPZRefPrism class which implements the uniform refinement of a geometric prism element...
TPZFNMatrix< 220, REAL > divphi
values of the divergence of the shapefunctions in the mapped element (only applicable to H(div)) spac...
TPZCompEl * CreateHDivPyramEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational pyramidal element for HDiv approximate space.
Definition: pzelchdiv.cpp:1841
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
int64_t SequenceNumber() const
Returns the Sequence number of the connect object.
Definition: pzconnect.h:158
Groups all classes defining the structure of the master element.
Definition: PrismExtend.cpp:15
virtual void InitMaterialData(TPZMaterialData &data) override
Initialize a material data and its attributes based on element dimension, number of state variables a...
Definition: pzelchdiv.cpp:1471
void Push(const T object)
Pushes a copy of the object on the stack.
Definition: pzstack.h:80
f
Definition: test.py:287
void ComputeShapeIndex(TPZVec< int > &sides, TPZVec< int64_t > &shapeindex)
Compute the correspondence between the normal vectors and the shape functions.
Definition: pzelchdiv.cpp:1341
Contains the TPZGraphElT3d class which implements the graphical representation of a tetrahedra elemen...
TPZCompEl * CreateHDivTriangleEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational triangular element for HDiv approximate space.
Definition: pzelchdiv.cpp:1829
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)
Compute shape functions based on master element in the classical FEM manner.
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
int ClassId() const override
Returns the unique identifier for reading/writing objects to streams.
Definition: pzelchdiv.h:306
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...
int64_t Index() const
Returns the index of the element within the element vector of the mesh.
Definition: pzgeoel.h:730
Contains the TPZGeoTetrahedra class which implements the geometry of a tetrahedral element...
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
void IndexShapeToVec2(TPZVec< int > &VectorSide, TPZVec< int > &bilinear, TPZVec< int > &direction, TPZVec< std::pair< int, int64_t > > &IndexVecShape, int pressureorder)
Definition: pzelchdiv.cpp:664
virtual int SideConnectLocId(int icon, int is) const override=0
Returns the local node number of icon along is.
TPZCompEl * CreateRefHDivPyramEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Definition: pzelchdiv.cpp:1888
TPZFNMatrix< 180 > fNormalVec
list of normal vectors
Contains the TPZGraphElPrismMapped class which implements the graphical element for a prism using a d...
#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
TPZFNMatrix< 180 > fDirectionsOnMaster
Directions on the master element.
virtual void SetConnectIndex(int i, int64_t connectindex) override
Sets the node pointer of node i to nod.
Definition: pzelchdiv.cpp:200
Contains the TPZQuadrilateral class which defines the topology of a quadrilateral element...
TPZCompEl * CreateHDivBoundTriangleEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational triangular element for HDiv approximate space.
Definition: pzelchdiv.cpp:1817
static void GetSideHDivPermutation(int transformationid, TPZVec< int > &permgather)
Identifies the permutation of the nodes needed to make neighbouring elements compatible in terms of o...
Definition: tpzline.cpp:447
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...
Definition: pzelchdiv.cpp:888
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)
static int GetTransformId(TPZVec< int64_t > &id)
Method which identifies the transformation based on the IDs of the corner nodes.
int NormalOrientation(int side)
Determine the orientation of the normal vector comparing the ids of the neighbouring elements...
Definition: pzgeoel.cpp:2370
void CreateGraphicalElement(TPZGraphMesh &grafgrid, int dimension) override
Creates corresponding graphical element(s) if the dimension matches graphical elements are used to ge...
Definition: pzelchdiv.cpp:1743
virtual int NFluxShapeF() const
return the number of shape for flux(just for flux)
Definition: pzelchdiv.cpp:625
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
TPZCompEl * CreateRefHDivPrismEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Definition: pzelchdiv.cpp:1884
TPZCompEl * CreateHDivBoundQuadEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational quadrilateral element for HDiv approximate space.
Definition: pzelchdiv.cpp:1813
virtual void ComputeRequiredData(TPZMaterialData &data, TPZVec< REAL > &qsi) override
Compute and fill data with requested attributes.
Definition: pzelchdiv.cpp:1376
int NSides() const
Returns the number of sides in which the current side can be decomposed.
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
Definition: pzcmesh.h:213
TPZCompEl * CreateRefHDivLinearEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Definition: pzelchdiv.cpp:1868
virtual void HDivDirections(TPZVec< REAL > &pt, TPZFMatrix< REAL > &directions, int RestrainedFace)=0
virtual void Solution(TPZVec< REAL > &qsi, int var, TPZVec< STATE > &sol) override
Post processing method which computes the solution for the var post processed variable.
TPZCompEl * CreateRefHDivTetraEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Definition: pzelchdiv.cpp:1892
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...
TPZAdmChunkVector< TPZConnect > & ConnectVec()
Return a reference to the connect pointers vector.
Definition: pzcmesh.h:198
T * begin() const
Casting operator. Returns The fStore pointer.
Definition: pzvec.h:450
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
Implements generic class which holds a matrix of objects. Matrix.
Definition: pzshtmat.h:18
Contains declaration of TPZCompMesh class which is a repository for computational elements...
void FillOrder(TPZVec< int > &order) const
Fill the polynomial order needed from the continuous shape functions.
Definition: pzelchdiv.cpp:1248
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
int SideOrient(int face)
the orientation of the face
Definition: pzelchdiv.h:189
Contains the TPZGeoPoint class which implements the geometry of a point element or 0-D element...
virtual int PreferredSideOrder(int iside) override
Returns the preferred order of the polynomial along side iside.
Definition: pzelchdiv.cpp:459
Contains declaration of TPZCompElHDivPressure class which implements a generic computational element ...
virtual int NNodes() const =0
Returns the number of nodes of the element.
Contains TPZShapePrism class which implements the shape functions of a prism element.
TPZGeoEl * Element() const
Definition: pzgeoelside.h:162
virtual void HDivDirectionsMaster(TPZFMatrix< REAL > &directions)=0
virtual void SetSideOrder(int side, int order) override
Sets the interpolation order of side to order.
Definition: pzelchdiv.cpp:519
virtual void HDivPermutation(int side, TPZVec< int > &permutegather)
Computes the permutation for an HDiv side.
Definition: pzgeoel.cpp:2509
virtual int SideConnectLocId(int node, int side) const override
return the local index for connect
Definition: pzelchdiv.cpp:430
Contains the TPZRefTriangle class which implements the uniform refinement of a geometric triangular e...
TPZSolVec divsol
vector of the divergence of the solution at the integration point (only of hdiv spaces) ...
TPZManVector< int64_t, TSHAPE::NSides > fConnectIndexes
Indexes of the connects associated with the elements.
Definition: pzelctemp.h:25
virtual int NConnects() const override
Returns the number of connect objects of the element.
Definition: pzelchdiv.cpp:193
Contains the TPZRefTetrahedra class which implements the uniform refinement of a geometric tetrahedra...
static int idf[6]
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
MElementType
Define the element types.
Definition: pzeltype.h:52
virtual int NSideConnects(int side) const override
Returns the number of dof nodes along side iside.
Definition: pzelchdiv.cpp:411
void ComputeSolutionHDiv(TPZVec< REAL > &qsi, TPZMaterialData &data)
Definition: pzelchdiv.cpp:1007
void ResetReference()
Reset the element referenced by the geometric element to NULL.
Definition: pzgeoel.h:431
virtual int64_t ConnectIndex(int con) const override
Returns the index of the ith connectivity of the element.
Definition: pzelchdiv.cpp:479
void Jacobian(TPZVec< REAL > &param, TPZFMatrix< REAL > &jacobian, TPZFMatrix< REAL > &axes, REAL &detjac, TPZFMatrix< REAL > &jacinv) const
Jacobian associated with the side of the element.
Contains declaration of TPZCompElHDivBound2 class which implements a generic computational element (H...
Template to generate computational elements. Computational Element.
TPZCompEl * CreateHDivBoundLinearEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational linear element for HDiv approximate space.
Definition: pzelchdiv.cpp:1809
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
int Size(const int block_diagonal) const
Returns block dimension.
Definition: pzblock.h:171
TSHAPE::IntruleType fIntRule
Integration rule associated with the topology of the element.
Definition: pzelctemp.h:28
Definition: pzeltype.h:61
static int sidedimension[27]
Vector of the dimension for each side.
Definition: tpzcube.cpp:100
virtual void SideShapeFunction(int side, TPZVec< REAL > &point, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi) override
Computes the values of the shape function of the side.
Definition: pzelchdiv.cpp:899
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...
Contains the TPZRefLinear class which implements the uniform refinement of a geometric linear element...
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.
void ComputeFunctionDivergence()
Computes the flux divergence values based on a Material of Hdiv approx space.
int Side() const
Returns the side index.
Definition: pzcompel.h:688
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
virtual int EffectiveSideOrder(int side) const override
Returns the actual interpolation order of the polynomial along the side.
Definition: pzelchdiv.cpp:574
void RemoveDepend(int64_t myindex, int64_t dependindex)
Remove dependency between connects if exist.
Definition: pzconnect.cpp:178
virtual void Print(std::ostream &out) const
Definition: pzmatrix.h:253
virtual int MaxOrder()
Returns the max order of interpolation.
static int GetTransformId(TPZVec< int64_t > &id)
Method which identifies the transformation based on the IDs of the corner nodes.
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Definition: pzfmatrix.cpp:1016
Contains TPZShapePiram class which implements the shape functions of a pyramid element.
Contains the TPZGeoPyramid class which implements the geometry of pyramid element.
Contains TPZGenMatrix class which implements generic class which holds a matrix of objects...
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
TPZCompEl * CreateHDivQuadEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational quadrilateral element for HDiv approximate space.
Definition: pzelchdiv.cpp:1825
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 the TPZGraphEl1dd class which implements the graphical one dimensional discontinuous element...
Implements an affine transformation between points in parameter space. Topology Utility.
Definition: pzmganalysis.h:14
This class implements a "generic" computational element to HDiv scope. Computational Element...
Contains the TPZGeoPrism class which implements the geometry of a prism element.
Contains declaration of TPZReferredCompEl class which generates computational elements.
Contains the TPZCube class which defines the topology of the hexahedron element.
virtual void ComputeRequiredData(TPZMaterialData &data, TPZVec< REAL > &qsi)
Compute and fill data with requested attributes.
Contains the TPZLine class which defines the topology of a line element.
Definition: pzeltype.h:55
Groups all classes which model the geometry.
Definition: pzgeopoint.cpp:18
int fPreferredOrder
Preferred polynomial order.
TPZManVector< std::pair< int, int64_t > > fVecShapeIndex
correspondence between normal vector index and index of the shape functions
virtual int ConnectOrder(int connect) const override
return the interpolation order of the polynomial for connect
Definition: pzelchdiv.cpp:544
Contains the TPZPrism class which defines the topology of a Prism.
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
TPZSolVec sol
vector of the solutions at the integration point
int GetDefaultOrder()
Definition: pzcmesh.h:398
Contains TPZShapeQuad class which implements the shape functions of a quadrilateral element...
Contains the TPZRefCube class which implements the uniform refinement of a geometric hexahedral eleme...
virtual int NConnectShapeF(int connect, int order) const override
Number of shapefunctions of the connect associated.
Definition: pzelchdiv.cpp:221
Contains the TPZGraphElQ3dd class which implements the graphical three dimensional discontinuous elem...
Contains the TPZRefPoint class which implements the uniform refinement of a geometric point element...
TPZFMatrix< STATE > & Solution()
Access the solution vector.
Definition: pzcmesh.h:219
TPZCompEl * CreateHDivLinearEl(TPZGeoEl *gel, TPZCompMesh &mesh, int64_t &index)
Creates computational linear element for HDiv approximate space.
Definition: pzelchdiv.cpp:1821
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
virtual void SetIntegrationRule(int ord) override
Definition: pzelchdiv.cpp:404
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
virtual void ComputeSolution(TPZVec< REAL > &qsi, TPZSolVec &sol, TPZGradSolVec &dsol, TPZFMatrix< REAL > &axes) override
Computes solution and its derivatives in the local coordinate qsi.
Definition: pzelchdiv.cpp:1035
TPZManVector< int, TSHAPE::NFaces > fSideOrient
vector which defines whether the normal is outward or not
Definition: pzelchdiv.h:25
virtual void Read(bool &val)
Definition: TPZStream.cpp:91
Implements a generic computational element. Computational Element.
Definition: pzelctemp.h:20