NeoPZ
pzgeoelrefless.h.h
Go to the documentation of this file.
1 
3 
4 
5 #ifndef PZGEOELREFLESS_H_H
6 #define PZGEOELREFLESS_H_H
7 
8 #include "pzgeoelrefless.h"
9 #include "tpzpyramid.h"
10 #include "pzgnode.h"
11 #include "pzgeom_utility.h"
12 #include "pzgmesh.h"
13 
14 #include <sstream>
15 
16 #include "pzlog.h" // test
17 #ifdef LOG4CXX
18 static LoggerPtr loggerrefless(Logger::getLogger("pz.mesh.tpzgeoelrefless"));
19 #endif
20 
21 #ifdef _AUTODIFF
22 #include "fadType.h"
23 #endif
24 
25 template<class TGeo>
27 TPZGeoEl(){
28  int i;
29  for(i=0;i<TGeo::NSides;i++)fNeighbours[i] = TPZGeoElSideIndex();
30 }
31 
32 template<class TGeo>
35  int i;
36  for(i=0;i<TGeo::NSides;i++){
37  TPZGeoElSide thisside(this->fNeighbours[i], this->Mesh());
38  TPZGeoElSide gelside(gel.fNeighbours[i], this->Mesh());
39  thisside.SetConnectivity(gelside);
40  // fNeighbours[i].SetConnectivity(gel.fNeighbours[i]);
41  }
42  // fSubElement = -1;
43 }
44 
45 template<class TGeo>
47  //RemoveConnectivities();
48 }
49 
50 template<class TGeo>
52 TPZRegisterClassId(&TPZGeoElRefLess<TGeo>::ClassId), TPZGeoEl(matind,mesh), fGeo(nodeindices) {
53 
54  int i;
55  for(i=0;i<TGeo::NSides;i++)fNeighbours[i] = TPZGeoElSideIndex();
56  fGeo.Initialize(this);
57 }
58 
59 template<class TGeo>
61 TPZRegisterClassId(&TPZGeoElRefLess<TGeo>::ClassId), TPZGeoEl(matind,mesh), fGeo(geo) {
62  int i;
63  for(i=0;i<TGeo::NSides;i++)fNeighbours[i] = TPZGeoElSideIndex();
64  fGeo.Initialize(this);
65 }
66 
67 template<class TGeo>
68 TPZGeoElRefLess<TGeo>::TPZGeoElRefLess(TPZVec<int64_t> &nodeindices,int matind,TPZGeoMesh &mesh, int64_t &index)
69 : TPZRegisterClassId(&TPZGeoElRefLess<TGeo>::ClassId), TPZGeoEl(matind,mesh,index) , fGeo(nodeindices)
70 {
71  int i;
72  for(i=0;i<TGeo::NSides;i++)fNeighbours[i] = TPZGeoElSideIndex();
73  fGeo.Initialize(this);
74 }
75 
76 template<class TGeo>
77 TPZGeoElRefLess<TGeo>::TPZGeoElRefLess(int64_t id,TPZVec<int64_t> &nodeindexes,int matind,TPZGeoMesh &mesh) :
78 TPZRegisterClassId(&TPZGeoElRefLess<TGeo>::ClassId), TPZGeoEl(id,matind,mesh) , fGeo(nodeindexes) {
79  int i;
80  for(i=0;i<TGeo::NSides;i++)fNeighbours[i] = TPZGeoElSideIndex();
81  fGeo.Initialize(this);
82 }
83 
84 template<class TGeo>
85 int64_t
87  if(node<0 || node>=fGeo.NNodes) return -1;
88  return fGeo.fNodeIndexes[node];
89 }
90 
92 template<class TGeo>
94 {
95  TPZGeoNode *np;
96  int i,j;
97  for(i=0;i<TGeo::NNodes;i++) {
98  np = NodePtr(i);
99  for(j=0;j<3;j++) {
100  coord(j,i) = np->Coord(j);
101  }
102  }
103 }
104 
105 template<class TGeo>
106 int64_t
107 TPZGeoElRefLess<TGeo>::SideNodeIndex(int side,int node) const {
108  if(side<0 || side>(TGeo::NSides - 1) || node<0) {
109  PZError << "TPZGeoElRefLess::SideNodeIndex. Bad parameter side.\n";
110  return -1;
111  }
112  return fGeo.fNodeIndexes[TGeo::SideNodeLocId(side,node)];
113 }
114 
115 template<class TGeo>
116 int
118 
119  if(side<0 || side>(TGeo::NSides - 1) || node<0) {
120  PZError << "TPZGeoElRefLess::SideNodeIndex. Bad parameter side.\n";
121  return -1;
122  }
123  return TGeo::SideNodeLocId(side,node);
124 }
125 
126 template<class TGeo>
127 void
129  if (id!=0)
130  PZError << "TPZGeoElRefLess<TGeo>::SetSubElement - Fodeu!\n";
131  else PZError << "TPZGeoElRefLess<TGeo>::SetSubElement - Por enquanto eu no faco nada!\n";
132  return;
133 }
134 
135 template<class TGeo>
137  return TGeo::CreateSideIntegrationRule(side,order);
138 }
139 
140 template<class TGeo>
141 int
143  return TGeo::NNodes;
144 }
145 
146 template<class TGeo>
147 int
149  return TGeo::NCornerNodes;
150 }
151 
152 template<class TGeo>
153 int
155  return TGeo::NSides;
156 }
157 
158 template<class TGeo>
159 int
160 TPZGeoElRefLess<TGeo>::SideNodeLocId(int side, int node) const {
161  return TGeo::SideNodeLocId(side,node);
162 }
163 
164 template<class TGeo>
165 REAL
167  return TGeo::RefElVolume();
168 }
169 
170 template<class TGeo>
171 int
173  return TGeo::NSideNodes(side);
174 }
175 
176 template<class TGeo>
177 void
178 TPZGeoElRefLess<TGeo>::MidSideNodeIndex(int side,int64_t &index) const{
179  //TRef::MidSideNodeIndex(this,side,index);
180  index = -1;
181  if(side<0 || side>NSides()-1) {
182  PZError << "TPZGeoElRefLess<TGeo>::MidSideNodeIndex. Bad parameter side = " << side << std::endl;
183  return;
184  }
185  if(side<NNodes()) {//o n�medio do lado 0 �o 0 etc.
186  index = NodeIndex(side);
187  return;
188  }
189 }
190 
191 template<class TGeo>
192 int
194  if (side < 0 || side > NSides()){
195  PZError << "TPZGeoElRefLess<TGeo>::SideIsUndefined - bad side: " << side << std::endl;
196  DebugStop();
197  }
198  return (fNeighbours[side].Side() == -1);
199 }
200 
201 template<class TGeo>
202 int
204  //return TRef::NSubEl;
205  return 0;
206 }
207 
208 template<class TGeo>
209 int
211  return 0;
212 }
213 
214 
215 // template<class TGeo>
216 // TPZGeoEl *
217 // TPZGeoElRefLess<TGeo>::CreateBCGeoEl(int side, int bc){
218 // TPZGeoEl * result = fGeo.CreateBCGeoEl(this,side,bc);
219 // // result->BuildBlendConnectivity();
220 // result->Initialize();
221 // return result;
222 // }
223 
224 template<class TGeo>
225 TPZGeoEl *
227  // Consistency check
228  int nsides = TGeo::NSides;
229  if(side<0 || side >= nsides){
230  std::cout << "\n ("<<TGeo::Type()<<")::CreateBCGeoEl unexpected side = " << side << "\n";
231  return 0;
232  }
233  if(fGeo.Dimension == 3 && side == nsides-1){
234  std::cout <<"\nCreateBCGeoEl not implemented for tridimensional sides \n";
235  return 0;
236  }
237 
238  // Is side straight?
239  TPZStack<int> LowAllSides;
240  TGeo::LowerDimensionSides(side,LowAllSides);
241  LowAllSides.Push(side);
242  bool straight = true;
243  if(fGeo.IsLinearMapping(side) == false) straight = false;
244  for(int lowside = 0; lowside < LowAllSides.NElements(); lowside++)
245  {
246  int lside = LowAllSides[lowside];
247  if(lside < TGeo::NNodes) continue;
248  if(fGeo.IsLinearMapping(lside) == false) straight = false;
249  if(straight == false) break;
250  }
251  if(straight == false)
252  {
253  TPZGeoEl *BCGeoEl = CreateBCGeoBlendEl(side,bc);
254  return BCGeoEl;
255  }
256 
257  // else
258 
259  // Build vector with node indices of element to be created
260  int sidennodes = TGeo::NSideNodes(side);
261  TPZManVector<int64_t,4> nodeindices(sidennodes);
262  for(int inode = 0; inode < sidennodes; inode++){
263  nodeindices[inode] = this->SideNodeIndex(side,inode);
264  }
265 
266  // Create GeoElement
267  int64_t index;
268  MElementType BCtype = TGeo::Type(side);
269  TPZGeoEl *BCGeoEl = this->Mesh()->CreateGeoElement(BCtype, nodeindices, bc, index);
270 
271  // Set Connectivity
272  int sidensides = TGeo::NContainedSides(side);
273  for(int iside=0; iside < sidensides-1; iside++){
274  TPZGeoElSide(BCGeoEl,iside).SetConnectivity(TPZGeoElSide(this,TGeo::ContainedSideLocId(side,iside)));
275  }
276  TPZGeoElSide(BCGeoEl, sidensides-1).SetConnectivity(TPZGeoElSide(this,side));
277 
278  // Return pointer to new element
279  BCGeoEl->Initialize();
280  return BCGeoEl;
281 }
282 
283 
284 template <class TGeo>
286 {
287  int sidennodes = TGeo::NSideNodes(side);
288  TPZManVector<int64_t> nodeindices(sidennodes);
289  int inode;
290  for(inode=0; inode<sidennodes; inode++){
291  nodeindices[inode] = this->SideNodeIndex(side,inode);
292  }
293  int64_t index;
294 
295  TPZGeoMesh *mesh = this->Mesh();
296  MElementType BCtype = TGeo::Type(side);
297 
298  TPZGeoEl *newel = mesh->CreateGeoBlendElement(BCtype, nodeindices, bc, index);
299  TPZGeoElSide me(this,side);
300  TPZGeoElSide newelside(newel,newel->NSides()-1);
301 
302  newelside.InsertConnectivity(me);
303  newel->Initialize();
304 
305  return newel;
306 }
307 
308 
309 template<class TGeo>
311  TPZVec<int64_t>& nodeindexes,
312  int matid,
313  int64_t& index)
314 {
315  if(this->IsLinearMapping(NSides()-1)) return this->Mesh()->CreateGeoElement(type,nodeindexes,matid,index);
316  else return this->Mesh()->CreateGeoElementMapped(type,nodeindexes,matid,index);
317 }
318 
319 template<class TGeo>
320 void
321 TPZGeoElRefLess<TGeo>::SetNodeIndex(int i,int64_t nodeindex){
322  if(i<0 || i>(TGeo::NNodes - 1)){
323  std::cout << "TPZGeoElRefLess::SetNodeIndex index error i = " << i << std::endl;
324  return;
325  }
326  fGeo.fNodeIndexes[i] = nodeindex;
327 }
328 
329 template<class TGeo>
332  return TGeo::SideToSideTransform(sidefrom,sideto);
333 }
334 
335 template<class TGeo>
336 TPZGeoEl *
338  if(is<0 || is>1){//(TRef::NSubEl - 1)){
339  std::cout << "TPZGeoElRefLess::SubElement index error is= " << is << std::endl;
340  }
341  // return fSubEl[is];
342  return 0;
343 }
344 
345 template<class TGeo>
346 int
348  return TGeo::SideDimension(side);
349 }
350 
351 template<class TGeo>
352 int
354  return TGeo::Dimension;
355 }
356 
357 template<class TGeo>
359 TPZGeoElRefLess<TGeo>::HigherDimensionSides(int side,int targetdimension){
360  std::cout << "TPZGeoElRefLess::HigherDimensionSides nao deve ser usado\n";
361  return TPZGeoElSide();
362 }
363 
364 template<class TGeo>
365 void
368  TGeo::HigherDimensionSides(side,highsides);
369  int i,size = highsides.NElements();
370  for(i=0;i<size;i++) {
371  if(SideDimension(highsides[i]) == targetdimension) {
372  elsides.Push(TPZGeoElSide(this,highsides[i]));
373  }
374  }
375 }
376 
377 template<class TGeo>
378 void
380  TGeo::LowerDimensionSides(side,smallsides);
381 }
382 
383 template<class TGeo>
384 void
386  BuildTransform2(side,father,t);
387 }
388 
389 #ifdef _AUTODIFF
390 
391 template<class TGeo>
392 void
394 {
395  gradx.Resize(3,fGeo.Dimension);
397  CornerCoordinates(cornerco);
398  fGeo.GradX(cornerco,par,gradx);
399 }
400 #endif
401 
403 template<class TGeo>
404 void
406 {
407  gradx.Resize(3,fGeo.Dimension);
409  CornerCoordinates(cornerco);
410  fGeo.GradX(cornerco,par,gradx);
411 }
412 
414 template<class TGeo>
415 void
417 #ifdef PZDEBUG
418  if(result.size() != 3) DebugStop();
419 #endif
421  CornerCoordinates(cornerco);
422  fGeo.X(cornerco,coordinate,result);
423 }
424 
425 #ifdef _AUTODIFF
426 
427 template<class TGeo>
428 void
429 TPZGeoElRefLess<TGeo>::X(TPZVec<Fad<REAL> > &coordinate,TPZVec<Fad<REAL> > &result) const {
430  result.Resize(3);
432  CornerCoordinates(cornerco);
433  fGeo.X(cornerco,coordinate,result);
434 }
435 #endif
436 
437 template<class TGeo>
439 {
440  return fGeo.IsLinearMapping(side);
441 }
442 
443 template<class TGeo>
445 {
446  return fGeo.IsGeoBlendEl();
447 }
448 template<class TGeo>
449 bool TPZGeoElRefLess<TGeo>::ResetBlendConnectivity(const int64_t &side, const int64_t &index){
450  return fGeo.ResetBlendConnectivity(side,index);
451 }
452 
453 template<class TGeo>
456 {
457  if(this == father) return t;
458  TPZGeoEl *myfather = Father();
459  if(side<0 || side>(TGeo::NSides-1) || !myfather){
460  PZError << "TPZGeoElRefLess::BuildTransform2 side out of range or father null\n";
461  return TPZTransform<>(0,0);
462  }
463  TPZGeoElSide fathloc = Father2(side);
464  int son = WhichSubel();
465  TPZTransform<> trans=myfather->GetTransform(side,son);
466  trans = trans.Multiply(t);
467  if(fathloc.Element() == father) return trans;
468  trans = myfather->BuildTransform2(fathloc.Side(),father,trans);
469  return trans;
470 }
471 
472 template<class TGeo>
474 TPZGeoElRefLess<TGeo>::GetTransform(int /*side*/,int /*son*/){
475  PZError << "TPZGeoElRefLess<TGeo>::GetTransform::Never should be called\n";
476  return TPZTransform<>(0,0);
477 }
478 
479 template<class TGeo>
480 void
482  TGeo::CenterPoint(side,cent);
483 }
484 
485 template<class TGeo>
488 {
489  //std::cout << " Father2 teste Cedric: 08/05/2003\n";
490  TPZGeoEl *father = Father();
491  if(!father) return TPZGeoElSide();
492  int son = WhichSubel();
493  if(son<0) return TPZGeoElSide();
494  int fathsid = father->FatherSide(side,son);
495  return TPZGeoElSide(father,fathsid);
496 }
497 
498 template<class TGeo>
499 void
501  return;
502 }
503 
504 template<class TGeo>
505 void TPZGeoElRefLess<TGeo>::Read(TPZStream &buf, void *context){
506  TPZGeoEl::Read(buf,context);
507  fGeo.Read(buf,context);
508  for (unsigned int i = 0; i < TGeo::NSides; ++i) {
509  this->fNeighbours[i].Read(buf, context);
510  }
511 }
512 
513 template<class TGeo>
514 void TPZGeoElRefLess<TGeo>::Write(TPZStream &buf, int withclassid) const {
515  TPZGeoEl::Write(buf, withclassid);
516  fGeo.Write(buf, withclassid);
517  for (unsigned int i = 0; i < TGeo::NSides; ++i) {
518  this->fNeighbours[i].Write(buf, withclassid);
519  }
520 }//Write
521 
522 template<class TGeo>
524 TPZRegisterClassId(&TPZGeoElRefLess<TGeo>::ClassId),TPZGeoEl(DestMesh, cp), fGeo(cp.fGeo) {
525  int i;
526  const int n = TGeo::NSides;
527  for(i = 0; i < n; i++){
528  this->fNeighbours[i] = cp.fNeighbours[i];
529  }
530 }
531 
532 
533 template<class TGeo>
535  const TPZGeoElRefLess &cp,
536  std::map<int64_t,int64_t> & gl2lcNdMap,
537  std::map<int64_t,int64_t> & gl2lcElMap ) :
538 TPZRegisterClassId(&TPZGeoElRefLess<TGeo>::ClassId),TPZGeoEl(DestMesh, cp, gl2lcElMap), fGeo(cp.fGeo, gl2lcNdMap)
539 {
540  int i;
541  const int n = TGeo::NSides;
542 
543  for(i = 0; i < n; i++)
544  {
545  TPZGeoElSide neigh (cp.fNeighbours[i],cp.Mesh());
546  int64_t neighIdx = neigh.Element()->Index();
547  int side = neigh.Side();
548 
549  while (gl2lcElMap.find(neighIdx)==gl2lcElMap.end())
550  {
551  neigh = neigh.Neighbour();
552  neighIdx = neigh.Element()->Index();
553  side = neigh.Side();
554  }
555  this->fNeighbours[i] = TPZGeoElSideIndex ( gl2lcElMap [ neighIdx ] , side );
556  }
557 }
558 
559 //template<class TGeo>
560 //void TPZGeoElRefLess<TGeo>::Directions(int side, TPZVec<REAL> &pt, TPZFMatrix<REAL> &directions, TPZVec<int> &sidevectors)
561 //{
562 // TPZFNMatrix<9,REAL> jac(TGeo::Dimension,TGeo::Dimension), jacinv(TGeo::Dimension,TGeo::Dimension), axes(TGeo::Dimension,3), gradx(3,TGeo::Dimension,0.);
563 // REAL detjac;
564 //
565 // this->Jacobian(pt,jac,axes,detjac,jacinv);
566 //
567 // // gradX = ( AxesˆT * jac )
568 // TPZFNMatrix<9> gradxt(TGeo::Dimension,3,0.);
569 // for (int il=0; il<TGeo::Dimension; il++)
570 // {
571 // for (int jc=0; jc<3; jc++)
572 // {
573 // for (int i = 0 ; i<TGeo::Dimension; i++)
574 // {
575 // gradx(jc,il) += axes(i,jc) * jac(i,il); // gradX = ( AxesˆT * jac )
576 // }
577 // }
578 // }
580 // TGeo::ComputeDirections(side, gradx, directions, sidevectors);
581 //
587 //
588 //}
589 
590 template<class TGeo>
592 {
593  TPZFNMatrix<9,REAL> gradx(3,TGeo::Dimension,0.);
594  for (int i = 0; i < TGeo::Dimension; i++) {
595  gradx(i,i) = 1.;
596  }
597  TGeo::ComputeHDivDirections(gradx, directions);
598 }
599 
600 
601 template<class TGeo>
602 void TPZGeoElRefLess<TGeo>::HDivDirections(TPZVec<REAL> &pt, TPZFMatrix<REAL> &directions, int ConstrainedFace)
603 {
604  TPZFNMatrix<9,REAL> jac(TGeo::Dimension,TGeo::Dimension), jacinv(TGeo::Dimension,TGeo::Dimension), axes(TGeo::Dimension,3), gradx(3,TGeo::Dimension,0.);
605 
606  this->GradX(pt, gradx);
607 
608  TGeo::ComputeHDivDirections(gradx, directions);
609 
610  if (TGeo::Type() == EPiramide) {
611  pztopology::TPZPyramid::AdjustTopDirections(ConstrainedFace-13, gradx, directions);
612  }
613 
614 }
615 
616 #ifdef _AUTODIFF
617 template<class TGeo>
618 void TPZGeoElRefLess<TGeo>::HDivDirections(TPZVec<REAL> &pt, TPZFMatrix<Fad<REAL>> &directions, int ConstrainedFace)
619 {
620  TPZFNMatrix<9,REAL> gradx(3,TGeo::Dimension,0.),gradxinv(TGeo::Dimension,TGeo::Dimension,0.);
621 
622  this->GradX(pt, gradx);
623  gradx.Resize(TGeo::Dimension,TGeo::Dimension);
624  gradx.Inverse(gradxinv, ENoDecompose);
625 
626  TPZManVector<Fad<REAL>> qsiFad(TGeo::Dimension,0.);
627 
628  for(int i=0;i<TGeo::Dimension;i++){
629  qsiFad[i] = Fad<REAL>(TGeo::Dimension,pt[i]);
630 
631  for(int j=0;j<TGeo::Dimension;j++){
632  qsiFad[i].fastAccessDx(j)=gradxinv(i,j);
633  }
634  }
635  //std::cout<<qsiFad<<std::endl;
636  TPZFNMatrix<9,Fad<REAL>> gradxFad(3,TGeo::Dimension);
637  this->GradX(qsiFad, gradxFad);
638  //gradxFad.Print(std::cout);
639  TGeo::ComputeHDivDirections(gradxFad, directions);
640 
641  if (TGeo::Type() == EPiramide) {
642  pztopology::TPZPyramid::AdjustTopDirections(ConstrainedFace-13, gradxFad, directions);
643  }
644 
645 }
646 #endif
647 
648 
649 #include "pzgeoquad.h"
650 
652 /*
653 template<>
654 inline void TPZGeoElRefLess<pzgeom::TPZGeoQuad>::HDivPermutation(int side, TPZVec<int> &permutegather)
655 {
656  if(side < 4 || side > 7)
657  {
658  std::stringstream sout;
659  sout << __PRETTY_FUNCTION__ << " called with wrong side parameter " << side;
660 #ifdef LOG4CXX
661  LOGPZ_ERROR(loggerrefless,sout.str())
662 #endif
663  std::cout << sout.str() << std::endl;
664  }
665  permutegather.Resize(3);
666  int64_t id1 = NodePtr(SideNodeLocIndex(side,0))->Id();
667  int64_t id2 = NodePtr(SideNodeLocIndex(side,1))->Id();
668  if(id1<id2)
669  {
670  permutegather[0] = 0;
671  permutegather[1] = 1;
672  permutegather[2] = 2;
673  }
674  else
675  {
676  permutegather[0] = 1;
677  permutegather[1] = 0;
678  permutegather[2] = 2;
679  }
680 }
681 */
682 #include "pzgeotriangle.h"
683 
685 /*
686 template<>
687 inline void TPZGeoElRefLess<pzgeom::TPZGeoTriangle>::HDivPermutation(int side, TPZVec<int> &permutegather)
688 {
689  if(side < 3 || side > 5)
690  {
691  std::stringstream sout;
692  sout << __PRETTY_FUNCTION__ << " called with wrong side parameter " << side;
693 #ifdef LOG4CXX
694  LOGPZ_ERROR(loggerrefless,sout.str())
695 #endif
696  std::cout << sout.str() << std::endl;
697  }
698  permutegather.Resize(3);
699  int64_t id1 = NodePtr(SideNodeLocIndex(side,0))->Id();
700  int64_t id2 = NodePtr(SideNodeLocIndex(side,1))->Id();
701  if(id1<id2)
702  {
703  permutegather[0] = 0;
704  permutegather[1] = 1;
705  permutegather[2] = 2;
706  }
707  else
708  {
709  permutegather[0] = 1;
710  permutegather[1] = 0;
711  permutegather[2] = 2;
712  }
713 }
714 */
715 
717 template<class TGeo>
718 inline void TPZGeoElRefLess<TGeo>::HDivPermutation(int side, TPZVec<int> &permutegather)
719 {
720  int dimension = TGeo::Dimension;
721  int sidedimension = TGeo::SideDimension(side);
722 
723  if(dimension != sidedimension+1)
724  {
725  std::stringstream sout;
726  sout << "HDivPermutation called with wrong side parameter " << side;
727 #ifdef LOG4CXX
728  LOGPZ_ERROR(loggerrefless,sout.str())
729 #endif
730  }
731 
732  // Douglas -- teste em 2014 09 04
733  // conta o numero de lados da face
734  const int64_t nsidenodes = TGeo::NSideNodes(side);
736 
737  for(int inode=0; inode<nsidenodes; inode++)
738  {
739  // esta parte pega os indices locais dos nos apenas da face em questao
740  int64_t nodeindex = SideNodeLocId(side, inode);
741  // com base nestes indices locais, pegamos os indices globais para determinar a permutacao
742  id[inode] = NodePtr(nodeindex)->Id();
743  }
744 
745  // Esse bloco parece pegar todos os vertices do cubo para fazer a permutacao, deveria ser da face
746 // TPZManVector<int64_t,TGeo::NCornerNodes> id(TGeo::NCornerNodes);
747 // for(int i=0; i<TGeo::NCornerNodes; i++)
748 // {
749 // int64_t nodeindex = fGeo.fNodeIndexes[i];
750 // id[i] = Mesh()->NodeVec()[nodeindex].Id();
751 // }
752 
753  MElementType sidetype = TGeo::Type(side);
754  int transformid;
755  switch (sidetype) {
756  case EOned:
757  transformid = pztopology::TPZLine::GetTransformId(id);
758  pztopology::TPZLine::GetSideHDivPermutation(transformid, permutegather);
759  break;
760  case EQuadrilateral:
762  pztopology::TPZQuadrilateral::GetSideHDivPermutation(transformid, permutegather);
763  break;
764  case ETriangle:
765  transformid = pztopology::TPZTriangle::GetTransformId(id);
766  pztopology::TPZTriangle::GetSideHDivPermutation(transformid, permutegather);
767  break;
768  case EPoint:
769  transformid = 0;
770  permutegather[0] = 0;
771  break;
772  default:
773  DebugStop();
774  break;
775  }
776 #ifdef LOG4CXX
777  if (loggerrefless->isDebugEnabled()) {
778  std::stringstream sout;
779  sout << "side = " << side << " transform id " << transformid << " permutegather " << permutegather;
780  LOGPZ_DEBUG(loggerrefless, sout.str())
781  }
782 #endif
783 }
784 
785 #include "TPZTopologyUtils.h"
786 
787 template <class Geom>
789  return Geom::Top::NPermutations;
790 }
791 
792 template <class Geom>
793 void TPZGeoElRefLess<Geom>::GetPermutation(const int& i, TPZVec<int> &permutation) const{
794  return pztopology::GetPermutation<typename Geom::Top>(i,permutation);
795 }
796 
797 
798 #endif
virtual ~TPZGeoElRefLess()
static REAL cornerco[8][3]
virtual TPZGeoEl * CreateGeoElement(MElementType type, TPZVec< int64_t > &nodeindexes, int matid, int64_t &index) override
Creates a geometric element according to the type of the father element.
virtual int NSubElements() const override
Returns the number of subelements of the element independent of the fact hether the element has alrea...
virtual int64_t NodeIndex(int node) const override
Returns the index of the ith node the index is the location of the node in the nodevector of the mesh...
virtual void Read(TPZStream &str, void *context) override
read objects from the stream
virtual TPZTransform< REAL > GetTransform(int side, int son)=0
bool ResetBlendConnectivity(const int64_t &side, const int64_t &index) override
TPZGeoNode * NodePtr(int i) const
Returns a pointer to the ith node of the element.
Definition: pzgeoel.cpp:2566
virtual TPZTransform SideToSideTransform(int sidefrom, int sideto) override
compute the transformation between the master element space of one side of an element to the master e...
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.
Contains declaration of TPZGeoElRefLess class which implements the mapping between the master element...
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
virtual int NSideNodes(int side) const override
Returns the number of nodes for a particular side.
clarg::argBool bc("-bc", "binary checkpoints", false)
virtual TPZGeoEl * CreateGeoElement(MElementType type, TPZVec< int64_t > &cornerindexes, int matid, int64_t &index, int reftype=1)
Generic method for creating a geometric element. Putting this method centrally facilitates the modifi...
Definition: pzgmesh.cpp:1296
Contains declaration of TPZGeoNode class which defines a geometrical node.
REAL Coord(int i) const
Returns i-th coordinate of the current node.
Definition: pzgnode.h:99
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
virtual TPZTransform< REAL > BuildTransform2(int side, TPZGeoEl *father, TPZTransform< REAL > &t)
Returns the transformation which maps the parameter side of the element/side into the parameter spac...
Definition: pzgeoel.cpp:386
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 void AllHigherDimensionSides(int side, int targetdimension, TPZStack< TPZGeoElSide > &elsides) override
TPZGeoElSideIndex fNeighbours[TGeo::NSides]
void Write(TPZStream &str, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Definition: pzgeoel.cpp:1663
virtual TPZTransform GetTransform(int side, int son) override
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
Definition: fad.h:54
Implements the mapping between the master element and deformed element. Geometry. ...
virtual void Initialize()
Definition: pzgeoel.h:176
static int GetTransformId(TPZVec< int64_t > &id)
Method which identifies the transformation based on the IDs of the corner nodes.
Definition: tpzline.cpp:412
TPZGeoMesh * Mesh() const
Returns the mesh to which the element belongs.
Definition: pzgeoel.h:220
virtual int NSides() const =0
Returns the number of connectivities of the element.
virtual void LowerDimensionSides(int side, TPZStack< int > &smallsides) const override
virtual REAL RefElVolume() override
Volume of the master element.
virtual TPZGeoEl * CreateGeoBlendElement(MElementType type, TPZVec< int64_t > &nodeindexes, int matid, int64_t &index)
Creates a geometric element in same fashion of CreateGeoElement but here the elements are blend...
Definition: pzgmesh.cpp:1400
Abstract class defining integration rules. Numerical Integration.
Definition: tpzintpoints.h:19
void Read(TPZStream &str, void *context) override
read objects from the stream
Definition: pzgeoel.cpp:1652
Utility class which represents an element index with its side. Geometry.
Definition: pzgeoelside.h:33
virtual void HDivPermutation(int side, TPZVec< int > &permutegather) override
Compute the permutation for an HDiv side.
virtual TPZTransform BuildTransform2(int side, TPZGeoEl *father, TPZTransform<> &t) override
static int highsides[27][7]
For each side was stored the sides connected with it but of the higher dimension. ...
Definition: tpzcube.cpp:110
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
virtual void CenterPoint(int side, TPZVec< REAL > &masscent) const override
It returns the coordinates of the center of the side of the element.
void Push(const T object)
Pushes a copy of the object on the stack.
Definition: pzstack.h:80
virtual int NSides() const override
Returns the number of connectivities of the element.
virtual int NSideSubElements(int side) const override
Returns the number of subelements of the same dimension of the element at the side.
virtual void GetSubElements2(int side, TPZStack< TPZGeoElSide > &subel) const override
This method will return a partition of the side of the current element as the union of sub elements/...
virtual bool IsGeoBlendEl() const override
static void AdjustTopDirections(int ConstrainedFace, TPZFMatrix< TVar > &gradx, TPZFMatrix< TVar > &directions)
Adjust the directions associated with the tip of the pyramid, considering that one of the faces is co...
TPZGeoElRefLess()
Contains the implementation of the TPZGeoElRefLess methods.
int WhichSubel() const
Returns the son number of the sub element gel.
Definition: pzgeoel.cpp:448
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
virtual int Dimension() const override
Returns the dimension of the element.
int64_t Index() const
Returns the index of the element within the element vector of the mesh.
Definition: pzgeoel.h:730
virtual int SideNodeLocIndex(int side, int node) const override
Returns the local index of a node on a side.
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
virtual int FatherSide(int side, int son)
Definition: pzgeoel.cpp:381
virtual int64_t SideNodeIndex(int side, int node) const override
Returns the index of the nodenum node of side.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
virtual void X(TPZVec< REAL > &coordinate, TPZVec< REAL > &result) const override
Returns the coordinate in real space of the point coordinate in the master element space...
virtual int SideDimension(int side) const override
Return the dimension of side.
virtual void SetSubElement(int id, TPZGeoEl *el) override
Sets the subelement of index i.
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
static int GetTransformId(TPZVec< int64_t > &id)
Method which identifies the transformation based on the IDs of the corner nodes.
void CornerCoordinates(TPZFMatrix< REAL > &coord) const
Gets the corner node coordinates in coord.
virtual int NNodes() const override
Returns the number of nodes of the element.
virtual int SideNodeLocId(int side, int node) const
Returns the local node number of the node "node" along side "side".
virtual int NCornerNodes() const override
Returns the number of corner nodes of the element.
void SetConnectivity(const TPZGeoElSide &neighbour) const
virtual TPZIntPoints * CreateSideIntegrationRule(int side, int order) override
Creates an integration rule for the topology of the corresponding side and able to integrate a polyno...
void GetPermutation(const int &i, TPZVec< int > &permutation) const override
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Definition: pzlog.h:93
static int nsidenodes[27]
Vector with the number of vertices contained in the closure of the side.
Definition: tpzcube.cpp:103
virtual void GradX(TPZVec< REAL > &coordinate, TPZFMatrix< REAL > &gradx) const override
Return the gradient of the transformation at the point.
Contains the TPZPyramid class which defines the topology of a pyramid element.
virtual int ClassId() const override
Define the class id associated with the class.
TPZTransform< T > Multiply(TPZTransform< T > &right)
Multiply the transformation object (to the right) with right (Multiplying matrices) ...
Definition: pztrnsform.cpp:112
virtual bool IsLinearMapping() const
Definition: pzgeoel.h:268
TPZGeoEl * Element() const
Definition: pzgeoelside.h:162
virtual void HDivDirections(TPZVec< REAL > &pt, TPZFMatrix< REAL > &directions, int ConstrainedFace=-1) override
virtual void HDivDirectionsMaster(TPZFMatrix< REAL > &directions) override
Implements a geometric node in the pz environment. Geometry.
Definition: pzgnode.h:31
virtual void BuildTransform(int side, TPZGeoEl *father, TPZTransform<> &t)
Accumulates the transformation of the jacobian which maps the current master element space into the s...
virtual TPZGeoEl * CreateBCGeoBlendEl(int side, int bc)
Method which creates a blend geometrical boundary condition element based on the current geometric el...
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
MElementType
Define the element types.
Definition: pzeltype.h:52
virtual TPZGeoElSide HigherDimensionSides(int side, int targetdimension)
virtual TPZGeoEl * SubElement(int is) const override
Returns a pointer to the subelement is.
static int sidedimension[27]
Vector of the dimension for each side.
Definition: tpzcube.cpp:100
virtual TPZGeoEl * CreateGeoElementMapped(MElementType type, TPZVec< int64_t > &nodeindexes, int matid, int64_t &index)
Generic method for creating a geometric element. Putting this method centrally facilitates the modifi...
Definition: pzgmesh.cpp:1229
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Definition: pzgeoelside.cpp:60
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
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
Implements an affine transformation between points in parameter space. Topology Utility.
Definition: pzmganalysis.h:14
void Read(TPZStream &buf, void *context) override
read objects from the stream
Definition: pzgeoelside.cpp:55
Definition: pzeltype.h:55
TPZGeoEl * Father() const
Computes the normal vectors needed for forming HDiv vector valued shape functions.
Definition: pzgeoel.cpp:2574
virtual TPZGeoEl * CreateBCGeoEl(int side, int bc) override
Method which creates a computational boundary condition element based on the current geometric elemen...
virtual void MidSideNodeIndex(int side, int64_t &index) const override
Returns the midside node index along a side of the element.
void InsertConnectivity(TPZGeoElSide &neighbour)
This method inserts the element/side and all lowerdimension sides into the connectivity loop...
virtual void Write(TPZStream &str, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
virtual int SideIsUndefined(int side) override
Returns 1 if the side has not been defined by buildconnectivity.
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
virtual void SetNodeIndex(int i, int64_t nodeindex) override
Initializes the node i of the element.
virtual TPZGeoElSide Father2(int side) const override
Returns the father/side of the father which contains the side of the sub element. ...