NeoPZ
TPZInterfaceEl.cpp
Go to the documentation of this file.
1 
6 #include "pzelmat.h"
7 #include "TPZInterfaceEl.h"
8 #include "TPZCompElDisc.h"
9 #include "pzgeoelside.h"
10 #include "pzquad.h"
11 #include "TPZMaterial.h"
12 #include "pzconslaw.h"
13 #include "pzbndcond.h"
14 #include "pzintel.h"
15 #include "pzlog.h"
16 #include "pzinterpolationspace.h"
17 #include "pzmaterialdata.h"
18 #include "pzvec_extras.h"
19 #include "pzsubcmesh.h"
20 
21 using namespace std;
22 
23 #ifdef LOG4CXX
24 static LoggerPtr logger(Logger::getLogger("pz.mesh.tpzinterfacelement"));
25 static LoggerPtr logdata(Logger::getLogger("pz.material.axisymetric.data"));
26 #endif
27 
29 
30  if(fLeftElSide.Element() && fRightElSide.Element()) this->DecreaseElConnected();
31 
32  TPZCompEl * cel = left.Element();
33  if(cel) {
34  TPZInterpolatedElement * intel = dynamic_cast<TPZInterpolatedElement *>(cel);
35  TPZCompElDisc * disc = dynamic_cast<TPZCompElDisc *>(cel);
36  if (!intel && !disc){
37  PZError << __PRETTY_FUNCTION__ << " - Left element is not a TPZInterpolatedElement or TPZCompElDisc.\n";
38  DebugStop();
39  }
40 
41  this->fLeftElSide.SetElement( left.Element() );
42  this->fLeftElSide.SetSide( left.Side() );
43  }
44  else {
45  PZError << __PRETTY_FUNCTION__ << " - Left element is null.\n";
46  DebugStop();
47  }
48 
49  cel = right.Element();
50  if (cel) {
51 
52  TPZInterpolatedElement * intel = dynamic_cast<TPZInterpolatedElement *>(cel);
53  TPZCompElDisc * disc = dynamic_cast<TPZCompElDisc *>(cel);
54  if (!intel && !disc){
55  PZError << __PRETTY_FUNCTION__ << " - Right element is not a TPZInterpolatedElement or TPZCompElDisc.\n";
56  DebugStop();
57  }
58 
59  this->fRightElSide.SetElement( right.Element() );
60  this->fRightElSide.SetSide( right.Side() );
61  }
62  else{
63  PZError << __PRETTY_FUNCTION__ << " - Right element is null.\n";
64  DebugStop();
65  }
66  TPZGeoEl *gel = Reference();
67  if (gel->Dimension() != left.Element()->Dimension() || gel->Dimension() != right.Element()->Dimension()) {
68  this->ComputeCenterNormal(fCenterNormal);
69  }
70  else
71  {
72  fCenterNormal.Resize(3, 0.);
73  }
74 
75 
76  this->IncrementElConnected();
77 
78  this->InitializeIntegrationRule();
79  this->PrepareIntPtIndices();
80 
81 }//method
82 
84  const int ncon = this->NConnects();
85  for(int i = 0; i < ncon; i++){
86  int index = this->ConnectIndex(i);
87  fMesh->ConnectVec()[index].DecrementElConnected();
88  }
89 }
90 
92  const int ncon = this->NConnects();
93  for(int i = 0; i < ncon; i++){
94  int index = this->ConnectIndex(i);
95  fMesh->ConnectVec()[index].IncrementElConnected();
96  }
97 }
98 
100  DecreaseElConnected();
101  TPZGeoEl *gel = this->Reference();
102  if (gel) {
103  gel->ResetReference();
104  }
105  if (gel && gel->NumInterfaces() > 0) {
106  gel->DecrementNumInterfaces();
107  if (gel->NumInterfaces() == 0) {
108  gel->RemoveConnectivities(); // deleta o elemento das vizinhancas
109  TPZGeoMesh *gmesh = gel->Mesh();
110  int index = gmesh->ElementIndex(gel); // identifica o index do elemento
111  gmesh->ElementVec()[index] = NULL;
112  delete gel; // deleta o elemento
113  }
114  }
115 }
116 
118  TPZCompElSide& left, TPZCompElSide& right)
120 TPZCompEl(mesh,geo,index)
121 {
122 
123  geo->SetReference(this);
124  geo->IncrementNumInterfaces();
125 
126  if (!left.Element() || !right.Element()) {
127  PZError << "Error at " << __PRETTY_FUNCTION__ << " left or right null elements\n";
128  }
129  if (left.Side() == -1 || right.Side() == -1){
130  PZError << "Error at " << __PRETTY_FUNCTION__ << " at line " << __LINE__ << " Side should not be -1\n";
131  DebugStop();
132  }
133 
134  this->SetLeftRightElements(left, right);
135 
136  this->IncrementElConnected();
137 }
138 
141 TPZCompEl(mesh,geo,index), fLeftElSide(), fRightElSide(){
142  geo->SetReference(this);
143  geo->IncrementNumInterfaces();
144  this->IncrementElConnected();
145 }
146 
149 TPZCompEl(mesh,copy) {
150 
151  this->fLeftElSide.SetElement( mesh.ElementVec()[copy.fLeftElSide.Element()->Index()] );
152  this->fLeftElSide.SetSide( copy.fLeftElSide.Side() );
153 
154  this->fRightElSide.SetElement( mesh.ElementVec()[copy.fRightElSide.Element()->Index()] );
155  this->fRightElSide.SetSide( copy.fRightElSide.Side() );
156 
157 #ifdef PZDEBUG
158  if( !fLeftElSide.Element() || ! fRightElSide.Element() ) {
159  cout << "Something wrong with clone of interface element\n";
160  DebugStop();
161  }
162  if(fLeftElSide.Element()->Mesh() != &mesh || fRightElSide.Element()->Mesh() != &mesh) {
163  cout << "The discontinuous elements should be cloned before the interface elements\n";
164  DebugStop();
165  }
166 #endif
167 
168  if (copy.fIntegrationRule) {
170  }
172 
173  //TPZMaterial * mat = copy.Material();
174 
175  this->IncrementElConnected();
176 
177  if (this->Reference()){
179  }
180  else{
181  PZError << "ERROR at " << __PRETTY_FUNCTION__ << " at line " << __LINE__ << " - this->Reference() is NULL\n";
182  DebugStop();
183  }
184 }
185 
186 
188  const TPZInterfaceElement &copy,
189  std::map<int64_t,int64_t> &gl2lcConIdx,
190  std::map<int64_t,int64_t> &gl2lcElIdx) :
192 {
193 
194  int64_t cplftIdx = copy.fLeftElSide.Element()->Index();
195  int64_t cprgtIdx = copy.fRightElSide.Element()->Index();
196  if (copy.fIntegrationRule) {
198  }
199 
200  if (gl2lcElIdx.find(cplftIdx) == gl2lcElIdx.end() || gl2lcElIdx.find(cprgtIdx) == gl2lcElIdx.end())
201  {
202  std::stringstream sout;
203  sout << "ERROR in " << __PRETTY_FUNCTION__
204  << " trying to generate an interface for discontinuous elements that are not cloned."
205  << " Right idx = " << cprgtIdx << " left index = " << cplftIdx;
206  LOGPZ_ERROR (logger,sout.str().c_str());
207  DebugStop();
208  }
209 
210  this->fLeftElSide.SetElement( mesh.ElementVec()[gl2lcElIdx[cplftIdx]] );
211  this->fLeftElSide.SetSide( copy.fLeftElSide.Side() );
212 
213  this->fRightElSide.SetElement( mesh.ElementVec()[gl2lcElIdx[cprgtIdx]] );
214  this->fRightElSide.SetSide( copy.fRightElSide.Side() );
215 
216 #ifdef PZDEBUG
217  if( !fLeftElSide.Element() || ! fRightElSide.Element() ) {
218  cout << "Something wrong with clone of interface element\n";
219  DebugStop();
220  }
221  if(fLeftElSide.Element()->Mesh() != &mesh || fRightElSide.Element()->Mesh() != &mesh) {
222  cout << "The discontinuous elements should be cloned before the interface elements\n";
223  DebugStop();
224  }
225 #endif
226 
228  //TPZMaterial * mat = copy.Material();
229  this->IncrementElConnected();
230 
231  if (this->Reference()){
233  }
234  else{
235  PZError << "ERROR at " << __PRETTY_FUNCTION__ << " at line " << __LINE__ << " - this->Reference() is NULL\n";
236  DebugStop();
237  }
238 }
239 
240 
241 
244 TPZCompEl(mesh,copy,index) {
245 
246  //ambos elementos esquerdo e direito j�foram clonados e moram na malha aglomerada
247  //o geometrico da malha fina aponta para o computacional da malha aglomerada
249  if (copy.fIntegrationRule) {
251  }
252 
253  this->fLeftElSide.SetElement( mesh.ElementVec()[copy.fLeftElSide.Element()->Index()] );
254  this->fLeftElSide.SetSide( copy.fLeftElSide.Side() );
255 
256  this->fRightElSide.SetElement( mesh.ElementVec()[copy.fRightElSide.Element()->Index()] );
257  this->fRightElSide.SetSide( copy.fRightElSide.Side() );
258 
259 #ifdef PZDEBUG
260  if( !fLeftElSide.Element() || ! fRightElSide.Element() ) {
261  cout << "TPZInterfaceElement::TPZInterfaceElement Something wrong with clone of interface element\n";
262  DebugStop();
263  }
264  if(fLeftElSide.Element()->Mesh() != &mesh || fRightElSide.Element()->Mesh() != &mesh) {
265  cout << "TPZInterfaceElement::TPZInterfaceElement The discontinuous elements should be cloned "
266  << "before the interface elements\n";
267  DebugStop();
268  }
269 #endif
270 
271  this->IncrementElConnected();
272 
273  if (this->Reference()){
275  }
276  else{
277  PZError << "ERROR at " << __PRETTY_FUNCTION__ << " at line " << __LINE__ << " - this->Reference() is NULL\n";
278  DebugStop();
279  }
280 }
281 
284 fCenterNormal(3,0.)
285 {
286  //NOTHING TO BE DONE HERE
287 }
288 
289 TPZCompEl * TPZInterfaceElement::CloneInterface(TPZCompMesh &aggmesh,int64_t &index, /*TPZCompElDisc **/TPZCompElSide &left, /*TPZCompElDisc **/TPZCompElSide &right) const {
290  return new TPZInterfaceElement(aggmesh, this->Reference(), index, left, right);
291 }
292 
295 
296 #ifdef PZDEBUG
297  if(!mat || mat->Name() == "no_name"){
298  PZError << "TPZInterfaceElement::CalcResidual interface material null, do nothing\n";
299  ef.Reset();
300  DebugStop();
301  return;
302  }
303 #endif
304 
305  TPZInterpolationSpace * left = dynamic_cast<TPZInterpolationSpace*>(this->LeftElement());
306  TPZInterpolationSpace * right = dynamic_cast<TPZInterpolationSpace*>(this->RightElement());
307 
308 #ifdef PZDEBUG
309  if (!left || !right){
310  PZError << "\nError at TPZInterfaceElement::CalcResidual null neighbour\n";
311  ef.Reset();
312  DebugStop();
313  return;
314  }
315  if(!left->Material() || !right->Material()){
316  PZError << "\n Error at TPZInterfaceElement::CalcResidual null material\n";
317  ef.Reset();
318  DebugStop();
319  return;
320  }
321 #endif
322 
323  // data holds geometric data for integrating over the interface element
324  // datal holds the approximation space data of the left element
325  // datar holds the approximation space data of the right element
326  TPZMaterialData data,datal,datar;
327  const int dim = this->Dimension();
328  const int diml = left->Dimension();
329  const int dimr = right->Dimension();
330  this->InitMaterialData(data);
331  this->InitMaterialData(datal,left);
332  this->InitMaterialData(datar, right);
333  this->InitializeElementMatrix(ef);
334 
335  datal.p = left->MaxOrder();
336  datar.p = right->MaxOrder();
337  //Max interpolation order
338  const int p = (datal.p > datar.p) ? datal.p : datar.p;
339 
340  TPZGeoEl *ref = Reference();
341  int intorder = mat->IntegrationRuleOrder(p);
342 
343  TPZAutoPointer<TPZIntPoints> intrule = ref->CreateSideIntegrationRule(ref->NSides()-1, intorder);
344  if(mat->HasForcingFunction())
345  {
346  intorder = intrule->GetMaxOrder();
347  TPZManVector<int,3> order(ref->Dimension(),intorder);
348  intrule->SetOrder(order);
349  }
350 
351  const int npoints = intrule->NPoints();
352 
353  //integration points in left and right elements: making transformations to neighbour elements
354  TPZTransform<> TransfLeft, TransfRight;
355  this->ComputeSideTransform(this->LeftElementSide(), TransfLeft);
356  this->ComputeSideTransform(this->RightElementSide(), TransfRight);
357 
358  TPZManVector<REAL,3> intpoint(dim), LeftIntPoint(diml), RightIntPoint(dimr);
359  REAL weight;
360 
361  for(int ip = 0; ip < npoints; ip++){
362 
363  intrule->Point(ip,intpoint,weight);
364  ref->Jacobian( intpoint, data.jacobian, data.axes, data.detjac, data.jacinv);
365  weight *= fabs(data.detjac);
366 
367  this->Normal(data.axes,data.normal);
368 
369  TransfLeft.Apply( intpoint, LeftIntPoint );
370  TransfRight.Apply( intpoint, RightIntPoint );
371 
372 #ifdef PZDEBUG
373  this->CheckConsistencyOfMappedQsi(this->LeftElementSide(), intpoint, LeftIntPoint);
374  this->CheckConsistencyOfMappedQsi(this->RightElementSide(), intpoint, RightIntPoint);
375 #endif
376 
377  this->ComputeRequiredData(datal, left, LeftIntPoint);
378  this->ComputeRequiredData(datar, right, RightIntPoint);
379  data.intLocPtIndex = ip;
380  this->ComputeRequiredData(data,intpoint);
381  mat->ContributeInterface(data, datal, datar, weight, ef.fMat);
382 
383  }//loop over integration points
384 
385 }
386 
388  return this->NLeftConnects() + this->NRightConnects();
389 }
390 
392  TPZCompEl * LeftEl = fLeftElSide.Element();
393  if (!LeftEl) return 0;
394  return LeftEl->NConnects();
395 }
396 
398  TPZCompEl * RightEl = fRightElSide.Element();
399  if (!RightEl) return 0;
400  return RightEl->NConnects();
401 }
402 
404 
405  TPZInterpolationSpace * left = dynamic_cast<TPZInterpolationSpace*>(this->LeftElement());
406  TPZInterpolationSpace * right = dynamic_cast<TPZInterpolationSpace*>(this->RightElement());
407  if (!left || !right) return -1;
408 
409  int leftmaxp = left->MaxOrder();
410  int rightmaxp = right->MaxOrder();
411  int p = (leftmaxp > rightmaxp) ? leftmaxp : rightmaxp;
412  return 2*p;
413 }
414 
415 int64_t TPZInterfaceElement::ConnectIndex(int i) const {
416 
417  const int nleftcon = this->NLeftConnects();
418  const int nrightcon = this->NRightConnects();
419  const int ncon = nleftcon + nrightcon;
420 
421  if(i < 0 || i >= ncon){
422  PZError << "TPZInterfaceElement::ConnectIndex wrong argument i, i = " << i << endl;
423  DebugStop();
424  return -1;
425  }
426 
427  if(i < nleftcon){ //required connect is associated to left neighbour
428  TPZCompMesh *leftmesh = fLeftElSide.Element()->Mesh();
429  if (leftmesh == Mesh()) {
430  return fLeftElSide.Element()->ConnectIndex(i);
431  }
432  else
433  {
434  int64_t leftindex = fLeftElSide.Element()->ConnectIndex(i);
435  TPZCompMesh *comm = Mesh()->CommonMesh(leftmesh);
436  int64_t superind = leftmesh->PutinSuperMesh(leftindex, comm);
437  int64_t hereindex = Mesh()->GetFromSuperMesh(superind, comm);
438  return hereindex;
439  }
440  }
441 
442  if(i < ncon){ //required connect is associated to right neighbour
443  TPZCompMesh *rightmesh = fRightElSide.Element()->Mesh();
444  if (rightmesh == Mesh()) {
445  return fRightElSide.Element()->ConnectIndex(i-nleftcon);
446  }
447  else
448  {
449  int64_t rightindex = fRightElSide.Element()->ConnectIndex(i-nleftcon);
450  TPZCompMesh *comm = Mesh()->CommonMesh(rightmesh);
451  int64_t superind = rightmesh->PutinSuperMesh(rightindex, comm);
452  int64_t hereindex = Mesh()->GetFromSuperMesh(superind, comm);
453  return hereindex;
454  }
455  }
456  return -1;
457 }
458 
459 void TPZInterfaceElement::Print(std::ostream &out) const {
460 
461  TPZCompEl::Print(out);
462  out << "\nInterface element : \n";
463  if(!LeftElement() || !LeftElement()->Reference()) out << "\tNULL LeftElement - this is inconsistent\n";
464  else{
465  out << "\tLeft CompEl Index: " << LeftElement()->Index() << endl;
466  out << "\tLeft Geometric Index: " << LeftElement()->Reference()->Index() << endl;
467  out << "\tLeft Geometric Id: " << LeftElement()->Reference()->Id() << endl;
468  out << "\tElement Dimension " << LeftElement()->Reference()->Dimension() << endl;
469  }
470 
471  if(!RightElement() || !RightElement()->Reference()) out << "\tNULL RightElement - this is inconsistent";
472  else{
473  out << "\tRight CompEl Index: " << RightElement()->Index() << endl;
474  out << "\tRight Geometric Index: " << RightElement()->Reference()->Index() << endl;
475  out << "\tRight Geometric Id: " << RightElement()->Reference()->Id() << endl;
476  out << "\tElement Dimension " << RightElement()->Reference()->Dimension() << endl;
477  }
478 
479  out << "\tMaterial id : " << Reference()->MaterialId() << endl;
480 
481  out << "\tNormal vector (at center point): ";
482  out << "(" << fCenterNormal[0] << "," << fCenterNormal[1] << "," << fCenterNormal[2] << ")\n";
483 }
484 
485 void TPZInterfaceElement::SetConnectIndex(int node, int64_t index) {
486  cout << "TPZInterfaceElement::SetConnectIndex should never be called\n";
487  DebugStop();
488 }
489 
491  // esta func� testa o correto desempenho do algoritmo que cria e
492  // deleta elementos de interface numa malha sujeita a refinamento h
493 
494  // InterfaceDimension �a dimens� do elemento de interface
495  // verifica-se para cada lado de dimens� InterfaceDimension do
496  // elemento que existe um elemento interface e que este �nico
497 
498  int64_t iel,iside,nel = cmesh.NElements();
499 
500  int InterfaceDimension;
501 
502  for(iel=0;iel<nel;iel++){
503  TPZCompEl *cel = cmesh.ElementVec()[iel];
504  if(!cel) continue;
505  TPZGeoEl *geo = cel->Reference();
506  InterfaceDimension = cel->Material()->Dimension() -1;
507  if(!geo){
508  PZError << "TPZInterfaceElement::main computational element with null reference\n";
509  DebugStop();
510  }
511  int nsides = geo->NSides();
512  for(iside=0;iside<nsides;iside++){
513  if(geo->SideDimension(iside) != InterfaceDimension) continue;
514  TPZCompElSide compside(cel,iside);
515  if(ExistInterfaces(compside)){
516  continue;
517  } else {
518  PZError << "TPZInterfaceEl::main interface error\t->\t";
519  int nint = ExistInterfaces(compside);
520  PZError << "number of existing interfaces : " << nint << endl;
521  return 0;
522  }
523  }
524  }//fim for iel
525  if(!FreeInterface(cmesh)) return 0;
526  return 1;
527 }
528 
530 
532  list.Resize(0);
533 
534  if(!comp.Exists()){
535  PZError << "TPZInterfaceElement::ExistInterfaces null argument, do nothing it verify\n";
536  return 1;//sem problemas
537  }
538  comp.HigherLevelElementList(list,0,0);
539  int64_t cap = list.NElements();
540 
541  if(cap) {
542  //caso existem elementos pequenos n� deve existir
543  //interface associada ao lado atual, o lado atual
544  //deve apontar para elemento computacional nulo
545  TPZGeoElSide geo = comp.Reference(),neigh;
546  neigh = geo.Neighbour();
547  while(neigh.Exists() && neigh != geo){
548  if(neigh.Element()->Reference()){
549  PZError << "TPZInterfaceElement::ExistInterfaces error of data structure\n";
550  DebugStop();
551  }
552  neigh = neigh.Neighbour();
553  }
554  //caso o vizinho n� existe todo bem
555  //caso existe n� pode ter refer�cia computacional
556  return 1;//sem problemas
557  }
558 
559  //neste estagio o lado atual enxerga um elemento vizinho ou
560  //est�comtido no lado de um elemento maior, portanto deve
561  //ter associado um elemento interface
562  TPZGeoElSide geo = comp.Reference();
563  if(!geo.Exists()){
564  PZError << "TPZInterfaceElement::ExistInterfaces error of data structure\n";
565  DebugStop();
566  }
567  TPZGeoElSide neigh = geo.Neighbour();
568  int exists = 0;
569  if(comp.Element()->Type() == EInterface) exists++;//o pr�rio �interface
570 
571  while(neigh.Element() && neigh.Element() != geo.Element()){
572  TPZCompElSide comp = neigh.Reference();
573  neigh = neigh.Neighbour();
574  if(!comp.Element()) continue;
575  if(comp.Element()->Type() == EInterface) exists++;
576  }
577  if(exists != 1) return 0;
578  return 1;//existe uma nica interface
579 }
580 
582 
583  int64_t iel,nel = cmesh.NElements();
584  for(iel=0;iel<nel;iel++){
585  TPZCompEl *cel = cmesh.ElementVec()[iel];
586  if(!cel) continue;
587  if(cel->Type() != EInterface) continue;//interessa s�interfaces
588  TPZGeoEl *gel = cel->Reference();
589  if(!gel){
590  PZError << "TPZInterfaceElement::FreeInterface computational element with null reference\n";
591  DebugStop();
592  continue;
593  }
594  int nsides = gel->NSides();
595  TPZCompElSide compside(cel,nsides-1);//face ou aresta
596  TPZGeoElSide geo = compside.Reference();
597  TPZGeoElSide neigh = geo.Neighbour();
598  int exists = 0;
599  while(neigh.Element() && neigh.Element() != geo.Element()){
600  TPZCompElSide comp = neigh.Reference();
601  neigh = neigh.Neighbour();
602  if(!comp.Element()) continue;
603  if(comp.Element()->Type() != EInterface) exists++;
604  }
605  //s�pode haver 1 ou 2 elementos de volume associados a um el. interface
606  if(exists < 1 || exists > 2) return 0;
607  }
608  return 1;
609 }
610 
613  int side = this->Reference()->NSides() - 1;
614  this->Reference()->CenterPoint(side,qsi);
615  this->ComputeNormal(qsi,normal);
616 }
617 
619  int dim = Reference()->Dimension();
620  TPZFNMatrix<9> jacobian(dim,dim),jacinv(dim,dim),axes(dim,3);
621  REAL detjac;
622  this->Reference()->Jacobian(qsi,jacobian,axes,detjac,jacinv);
623  this->ComputeNormal(axes,normal);
624 }
625 
627 
628  normal.Resize(3);
629 
630  TPZCompEl * LeftEl = this->LeftElement();
631  TPZCompEl * RightEl = this->RightElement();
632 
633  TPZMaterial *LeftElMaterial = LeftEl->Material();
634  TPZMaterial *RightElMaterial = RightEl->Material();
635 
636  if (!LeftElMaterial || !RightElMaterial) {
637  std::cout << "Interface elements created between elements without material\n";
638  std::cout << "Material Ids missing ";
639  if(!LeftElMaterial) std::cout << LeftEl->Reference()->MaterialId() << " ";
640  if(!RightElMaterial) std::cout << RightEl->Reference()->MaterialId() << " ";
641  std::cout << std::endl;
642  DebugStop();
643  }
644 
645  // int dim = Reference()->Dimension();
646  // TPZGeoEl *ref = Reference();
647  // int face = ref->NSides()-1;
648  //face: lado do elemento bidimensional ou aresta
649  //do unidimensional ou canto do ponto
650  normal.Resize(3,0.);
651  normal.Fill(0.);
652  int faceleft,faceright;
653 
654  REAL normalize;
655  int i;
656 
657  TPZGeoEl *gLeftEl = LeftEl->Reference();
658  TPZGeoEl *gRightEl = RightEl->Reference();
659  int leftdim = gLeftEl->Dimension();
660  int rightdim = gRightEl->Dimension();
661  TPZManVector<REAL, 3> centleft(leftdim),centright(rightdim),point(3,0.),result(3,0.),xint(3),xvolleft(3),xvolright(3),vec(3),rib(3);
662  faceleft = LeftEl->Reference()->NSides()-1;//lado interior do elemento esquerdo
663  faceright = RightEl->Reference()->NSides()-1; // lado interior do element direito
664  LeftEl->Reference()->CenterPoint(faceleft,centleft);//ponto centro do elemento de volume
665  RightEl->Reference()->CenterPoint(faceright,centright);
666  LeftEl->Reference()->X(centleft,xvolleft);
667  RightEl->Reference()->X(centright,xvolright);
668  for(i=0;i<3;i++) vec[i] = xvolright[i]-xvolleft[i];//n� deve ser nulo
669 
670  int myinterfacedim = Reference()->Dimension();
671  int InterfaceDimension = LeftEl->Material()->Dimension() - 1;
672  if (myinterfacedim != InterfaceDimension) {
673  std::stringstream sout;
674  sout << __PRETTY_FUNCTION__ << "the dimension of the interface element " << myinterfacedim << " is not compatible with the dimension of the material " << InterfaceDimension <<
675  " Expect trouble ";
676 #ifdef LOG4CXX
677  LOGPZ_WARN(logger,sout.str())
678 #else
679  // std::cout << sout.str() << std::endl;
680 #endif
681  InterfaceDimension = myinterfacedim;
682  }
683 
684 
685  REAL vecnorm = sdot(vec, vec);
686  if(InterfaceDimension && vecnorm < 1.e-10)
687  {
688  int index = fabs(axes(0,0)) < fabs(axes(0,1)) ? 0 : 1;
689  index = fabs(axes(0,index)) < fabs(axes(0,2)) ? index : 2;
690  vec[index] = 1.;
691  LOGPZ_WARN(logger,"Left and Right element centers coincide")
692  }
693 
694 
695  switch(InterfaceDimension){
696  case 0:
697  normal[0] = 1.0;// a normal sempre apontar�na dire� positiva do eixo
698  normal[1] = 0.;
699  normal[2] = 0.;
700  break;
701  case 1:
702  for(i=0;i<3;i++) rib[i] = axes(0,i);//dire� da aresta
703  this->VetorialProd(rib,vec,result);
704  this->VetorialProd(result,rib,normal);
705  //normalizando a normal
706  normalize = 0.;
707  for(i=0;i<3;i++) normalize += normal[i]*normal[i];
708  if(normalize == 0.0)
709  {
710  PZError << __PRETTY_FUNCTION__ << " null normal vetor\n";
711 #ifdef LOG4CXX
712  {
713  std::stringstream sout;
714  Print(sout);
715  LOGPZ_DEBUG(logger,sout.str())
716  }
717 #endif
718 
719  DebugStop();
720  }
721  normalize = sqrt(normalize);
722  for(i=0;i<3;i++) normal[i] = normal[i]/normalize;
723  break;
724  case 2:{
725  TPZManVector<REAL,3> axes1(3), axes2(3);
726  for(int iax = 0; iax < 3; iax++){
727  axes1[iax] = axes(0,iax);
728  axes2[iax] = axes(1,iax);
729  }
730  this->VetorialProd(axes1,axes2,normal);
731  }
732  break;
733  default:
734  PZError << "TPZInterfaceElement::NormalToFace in case that not treated\n";
735  normal.Resize(0);
736  DebugStop();
737  return;
738  }
739 
740  //to guarantee the normal points from left to right neighbours:
741  REAL dot = 0.;
742  for(i=0; i<3; i++) dot += normal[i]*vec[i];
743  if(dot < 0.) {
744  for(i=0; i<3; i++) normal[i] = -normal[i];
745  }
746 }
747 
749 
750  kvet.Resize(3);
751  kvet[0] = ivet[1]*jvet[2] - ivet[2]*jvet[1];
752  kvet[1] = -ivet[0]*jvet[2] + ivet[2]*jvet[0];
753  kvet[2] = ivet[0]*jvet[1] - ivet[1]*jvet[0];
754 }
755 
757  const int n = fCenterNormal.NElements();
758  CenterNormal.Resize(n);
759  for(int i = 0; i < n; i++) CenterNormal[i] = fCenterNormal[i];
760 }
761 
763  TPZGeoEl * gel = this->Reference();
764  if(gel->IsLinearMapping()) return this->CenterNormal(normal);
765  return this->ComputeNormal(axes, normal);
766 }
767 
769  TPZGeoEl * gel = this->Reference();
770  if(gel->IsLinearMapping()) return this->CenterNormal(normal);
771  return this->ComputeNormal(qsi, normal);
772 }
773 
780 void TPZInterfaceElement::EvaluateError(std::function<void(const TPZVec<REAL> &loc,TPZVec<STATE> &val,TPZFMatrix<STATE> &deriv)> func,
781  TPZVec<REAL> &errors, bool store_error)
782 {
783  errors.Fill(0.0);
784 }
785 
786 
791  return Hash("TPZInterfaceElement") ^ TPZCompEl::ClassId() << 1;
792 }
793 
794 #ifndef BORLAND
795 template class
797 #endif
798 
802 void TPZInterfaceElement::Write(TPZStream &buf, int withclassid) const
803 {
804  TPZCompEl::Write(buf,withclassid);
807  int64_t leftelindex = fLeftElSide.Element()->Index();
808  int64_t rightelindex = fRightElSide.Element()->Index();
809  if ( (this->Index() < leftelindex) || (this->Index() < rightelindex) ){
810  PZError << __PRETTY_FUNCTION__ << endl
811  << "Indices of neighbours are less than interface index:" << endl
812  << "Left: " << leftelindex << ", Right: " << rightelindex << ", this: " << this->Index() << endl;
813  DebugStop();
814  }
815 
816  int leftside = fLeftElSide.Side();
817  int rightside = fRightElSide.Side();
818 
819  buf.Write(&leftelindex,1);
820  buf.Write(&leftside,1);
821  buf.Write(&rightelindex,1);
822  buf.Write(&rightside,1);
823  buf.Write(fCenterNormal);
824 }
825 
829 void TPZInterfaceElement::Read(TPZStream &buf, void *context)
830 {
831  TPZCompEl::Read(buf,context);
832  TPZCompEl * leftEl = dynamic_cast<TPZCompEl *>(TPZPersistenceManager::GetInstance(&buf));
833  TPZCompEl * rightEl = dynamic_cast<TPZCompEl *>(TPZPersistenceManager::GetInstance(&buf));
834  int64_t leftelindex;
835  int64_t rightelindex;
836  int leftside, rightside;
837  // int matid;
838  buf.Read(&leftelindex,1);
839  buf.Read(&leftside,1);
840  buf.Read(&rightelindex,1);
841  buf.Read(&rightside,1);
842  this->fLeftElSide.SetElement ( leftEl );
843  this->fRightElSide.SetElement( rightEl );
844  this->fLeftElSide.SetSide( leftside );
845  this->fRightElSide.SetSide( rightside );
846 
847  buf.Read(fCenterNormal);
848 }
849 
851 
852  TPZInterpolationSpace * left = dynamic_cast<TPZInterpolationSpace*>(this->LeftElement());
853  TPZInterpolationSpace * right = dynamic_cast<TPZInterpolationSpace*>(this->RightElement());
854 
855 #ifdef PZDEBUG
856  if (!left || !right){
857  PZError << "\nError at TPZInterfaceElement::InitializeElementMatrix null neighbour\n";
858  ef.Reset();
859  DebugStop();
860  return;
861  }
862  if(!left->Material() || !right->Material()){
863  PZError << "\n Error at TPZInterfaceElement::InitializeElementMatrix null material\n";
864  ef.Reset();
865  DebugStop();
866  return;
867  }
868 #endif
869 
870  TPZMaterial *mat = Material();
871  const int numdof = mat->NStateVariables();
872 
873  int nshapel = left ->NShapeF();
874  int nshaper = right->NShapeF();
875  const unsigned int nstatel = left->Material()->NStateVariables();
876  const unsigned int nstater = right->Material()->NStateVariables();
877 
878  TPZManVector<TPZConnect*> ConnectL, ConnectR;
879  TPZManVector<int64_t> ConnectIndexL, ConnectIndexR;
880 
881  this->GetConnects( this->LeftElementSide(), ConnectL, ConnectIndexL );
882  this->GetConnects( this->RightElementSide(), ConnectR, ConnectIndexR );
883  const int64_t ncon = ConnectL.NElements() + ConnectR.NElements();
884  const int neql = nshapel * nstatel;
885  const int neqr = nshaper * nstater;
886  const int neq = neql + neqr;
887  const int numloadcases = mat->NumLoadCases();
888  ef.fMat.Redim(neq,numloadcases);
889  ef.fBlock.SetNBlocks(ncon);
890  ef.fConnect.Resize(ncon);
891 
892  int64_t ic = 0;
893  int64_t n = ConnectL.NElements();
894  for(int64_t i = 0; i < n; i++) {
895  TPZConnect &c = left->Connect(i);
896  const unsigned int nshape = left->NConnectShapeF(i,c.Order());
897  const int con_neq = nstatel * nshape;
898 #ifdef PZDEBUG
899  if(c.NShape() != nshape || c.NState() != nstatel)
900  {
901  DebugStop();
902  }
903 #endif
904  ef.fBlock.Set(ic,con_neq);
905  (ef.fConnect)[ic] = ConnectIndexL[i];
906  ic++;
907  }
908  n = ConnectR.NElements();
909  for(int64_t i = 0; i < n; i++) {
910  TPZConnect &c = right->Connect(i);
911  const unsigned int nshape = right->NConnectShapeF(i,c.Order());
912  const int con_neq = nstater * nshape;
913 #ifdef PZDEBUG
914  if (c.NShape() != nshape || c.NState() != nstater) {
915  DebugStop();
916  }
917 #endif
918 
919  ef.fBlock.Set(ic,con_neq);
920  (ef.fConnect)[ic] = ConnectIndexR[i];
921  ic++;
922  }
923  ef.fBlock.Resequence();
924 
925 }
926 
928 
929  TPZInterpolationSpace * left = dynamic_cast<TPZInterpolationSpace*>(this->LeftElement());
930  TPZInterpolationSpace * right = dynamic_cast<TPZInterpolationSpace*>(this->RightElement());
931 
932 #ifdef PZDEBUG
933  if (!left || !right){
934  PZError << "\nError at TPZInterfaceElement::InitializeElementMatrix null neighbour\n";
935  ek.Reset();
936  ef.Reset();
937  DebugStop();
938  return;
939  }
940  if(!left->Material() || !right->Material()){
941  PZError << "\n Error at TPZInterfaceElement::InitializeElementMatrix null material\n";
942  ek.Reset();
943  ef.Reset();
944  DebugStop();
945  return;
946  }
947 #endif
948 
949  ek.fMesh = Mesh();
952  ef.fMesh = ek.fMesh;
953  TPZMaterial *mat = Material();
954  const int numdof = mat->NStateVariables();
955 
956  int nshapel = left ->NShapeF();
957  int nshaper = right->NShapeF();
958  const unsigned int nstatel = left->Material()->NStateVariables();
959  const unsigned int nstater = right->Material()->NStateVariables();
960 
961  TPZManVector<TPZConnect*> ConnectL, ConnectR;
962  TPZManVector<int64_t> ConnectIndexL, ConnectIndexR;
963 
964  this->GetConnects( this->LeftElementSide(), ConnectL, ConnectIndexL );
965  this->GetConnects( this->RightElementSide(), ConnectR, ConnectIndexR );
966  const int64_t ncon = ConnectL.NElements() + ConnectR.NElements();
967  const int neql = nshapel * nstatel;
968  const int neqr = nshaper * nstater;
969  const int neq = neql + neqr;
970  const int numloadcases = mat->NumLoadCases();
971  ek.fMat.Redim(neq,neq);
972  ef.fMat.Redim(neq,numloadcases);
973  ek.fBlock.SetNBlocks(ncon);
974  ef.fBlock.SetNBlocks(ncon);
975  ek.fConnect.Resize(ncon);
976  ef.fConnect.Resize(ncon);
977 
978 #ifdef PZDEBUG
979  TPZStack<STATE> solutionvec;
980 #endif
981 
982  int64_t ic = 0;
983  int64_t n = ConnectL.NElements();
984  for(int i = 0; i < n; i++) {
985  TPZConnect &c = left->Connect(i);
986  const unsigned int nshape = left->NConnectShapeF(i,c.Order());
987  const int con_neq = nstatel * nshape;
988 #ifdef PZDEBUG
989  if(c.NShape() != nshape || c.NState() != nstatel)
990  {
991  DebugStop();
992  }
993 #endif
994  ek.fBlock.Set(ic,con_neq );
995  ef.fBlock.Set(ic,con_neq);
996  (ef.fConnect)[ic] = ConnectIndexL[i];
997  (ek.fConnect)[ic] = ConnectIndexL[i];
998 #ifdef PZDEBUG
999  TPZConnect &con = Mesh()->ConnectVec()[ConnectIndexL[i]];
1000  int64_t seqnum = con.SequenceNumber();
1001  int blsize = Mesh()->Block().Size(seqnum);
1002  int64_t pos = Mesh()->Block().Position(seqnum);
1003  for (int ip=0; ip<blsize; ip++)
1004  {
1005  solutionvec.Push(Mesh()->Solution()(pos+ip)*(STATE)1.e15);
1006  }
1007 #endif
1008  ic++;
1009  }
1010  n = ConnectR.NElements();
1011  for(int64_t i = 0; i < n; i++) {
1012  TPZConnect &c = right->Connect(i);
1013  const unsigned int nshape = right->NConnectShapeF(i,c.Order());
1014  const int con_neq = nstater * nshape;
1015 #ifdef PZDEBUG
1016  if (c.NShape() != nshape || c.NState() != nstater) {
1017  DebugStop();
1018  }
1019 #endif
1020  ek.fBlock.Set(ic,con_neq );
1021  ef.fBlock.Set(ic,con_neq);
1022  (ef.fConnect)[ic] = ConnectIndexR[i];
1023  (ek.fConnect)[ic] = ConnectIndexR[i];
1024 #ifdef PZDEBUG
1025  TPZConnect &con = Mesh()->ConnectVec()[ConnectIndexR[i]];
1026  int64_t seqnum = con.SequenceNumber();
1027  int blsize = Mesh()->Block().Size(seqnum);
1028  int64_t pos = Mesh()->Block().Position(seqnum);
1029  for (int ip=0; ip<blsize; ip++)
1030  {
1031  solutionvec.Push(Mesh()->Solution()(pos+ip)*(STATE)1.e15);
1032  }
1033 #endif
1034  ic++;
1035  }
1036 #ifdef PZDEBUG
1037 #ifdef LOG4CXX
1038  if(logdata->isDebugEnabled())
1039  {
1040  std::stringstream sout;
1041  sout.precision(15);
1042  sout << "ElementSolution = { " << solutionvec << " }/1000000000000000.;" << std::endl;
1043  LOGPZ_DEBUG(logdata,sout.str())
1044  }
1045 #endif
1046 #endif
1047  ek.fBlock.Resequence();
1048  ef.fBlock.Resequence();
1049 }
1050 
1052 
1053 #ifdef LOG4CXX
1054  if (logger->isDebugEnabled())
1055  {
1056  std::stringstream sout;
1057  sout << "elemento de interface " << Index() << " Indice deste Material--> " <<this->Material()->Id()<< std::endl;
1058 
1059  LOGPZ_DEBUG(logger, sout.str().c_str());
1060  }
1061 #endif
1062 
1064  if(!mat || mat->Name() == "no_name"){
1065  PZError << "TPZInterfaceElement::CalcStiff interface material null, do nothing\n";
1066  ek.Reset();
1067  ef.Reset();
1068  return;
1069  }
1070 
1071  TPZInterpolationSpace * left = dynamic_cast<TPZInterpolationSpace*>(this->LeftElement());
1072  TPZInterpolationSpace * right = dynamic_cast<TPZInterpolationSpace*>(this->RightElement());
1073 
1074  if (!left || !right){
1075  PZError << "\nError at TPZInterfaceElement::CalcStiff null neighbour\n";
1076  ek.Reset();
1077  ef.Reset();
1078  return;
1079  }
1080  if(!left->Material() || !right->Material()){
1081  PZError << "\n Error at TPZInterfaceElement::CalcStiff null material\n";
1082  ek.Reset();
1083  ef.Reset();
1084  return;
1085  }
1086 
1087  //TPZMaterialData data;
1088  const int dim = this->Dimension();
1089  const int diml = left->Dimension();
1090  const int dimr = right->Dimension();
1091 
1092  TPZMaterialData dataright;
1093  TPZMaterialData dataleft;
1094  TPZMaterialData data;
1095 
1096  mat->FillDataRequirementsInterface(data);
1097 
1098  InitMaterialData(dataleft,left);
1099  InitMaterialData(dataright,right);
1100  InitMaterialData(data);
1101 
1102 
1103 #ifdef PZDEBUG
1104  if( !dataleft.x.size() ||!dataright.x.size() ){
1105  PZError << "\n Error at TPZInterfaceElement::CalcStiff null interface\n";
1106  ek.Reset();
1107  ef.Reset();
1108  DebugStop();
1109  }
1110 #endif
1111 
1112  InitializeElementMatrix(ek, ef);
1113 
1114  int leftmaxp = left->MaxOrder();
1115  int rightmaxp = right->MaxOrder();
1116 
1117 #ifdef LOG4CXX
1118  if (logger->isDebugEnabled())
1119  {
1120  if (logger->isDebugEnabled())
1121  {
1122  std::stringstream sout;
1123  sout << "ordem maxima na esquerda " << leftmaxp<<std::endl;
1124  sout << "ordem maxima na direita " << rightmaxp<<std::endl;
1125  LOGPZ_DEBUG(logger, sout.str().c_str());
1126  }
1127  }
1128 #endif
1129 
1130 
1131  //Max interpolation order
1132  const int p = (leftmaxp > rightmaxp) ? leftmaxp : rightmaxp;
1133 
1134  TPZGeoEl *ref = Reference();
1135  TPZIntPoints *intrule = ref->CreateSideIntegrationRule(ref->NSides()-1, 2*(p) );
1136 
1137 
1138  const int npoints = intrule->NPoints();
1139 
1140  //integration points in left and right elements: making transformations to neighbour elements
1141  TPZTransform<> TransfLeft, TransfRight;
1142  this->ComputeSideTransform(this->LeftElementSide(), TransfLeft);
1143  this->ComputeSideTransform(this->RightElementSide(), TransfRight);
1144 
1145  TPZManVector<REAL,3> intpoint(dim), LeftIntPoint(diml), RightIntPoint(dimr);
1146  REAL weight;
1147  //LOOP OVER INTEGRATION POINTS
1148  for(int ip = 0; ip < npoints; ip++){
1149 
1150  intrule->Point(ip,intpoint,weight);
1151  ref->Jacobian( intpoint, data.jacobian, data.axes, data.detjac, data.jacinv);
1152  weight *= fabs(data.detjac);
1153 
1154  TransfLeft.Apply( intpoint, LeftIntPoint );
1155  TransfRight.Apply( intpoint, RightIntPoint );
1156 
1157 #ifdef PZDEBUG
1158  this->CheckConsistencyOfMappedQsi(this->LeftElementSide(), intpoint, LeftIntPoint);
1159  this->CheckConsistencyOfMappedQsi(this->RightElementSide(), intpoint, RightIntPoint);
1160 #endif
1161 
1162 
1163  this->ComputeRequiredData(dataleft, left, LeftIntPoint);
1164  this->ComputeRequiredData(dataright, right, RightIntPoint);
1165  data.intLocPtIndex = ip;
1166  this->ComputeRequiredData(data,intpoint);
1167 
1168  // dataleft.x nao esta preenchido!!
1169  data.x = dataleft.x;
1170  data.p = dataright.p;
1171  if (dataleft.p > data.p) {
1172  data.p = dataleft.p;
1173  }
1174 
1175  mat->ContributeInterface(data,dataleft,dataright, weight, ek.fMat, ef.fMat);
1176 
1177  }//loop over integration points
1178 
1179  delete intrule;
1180 }
1181 
1182 
1184 
1185  TPZInterpolationSpace * left = dynamic_cast<TPZInterpolationSpace*>(this->LeftElement());
1186  TPZInterpolationSpace * right = dynamic_cast<TPZInterpolationSpace*>(this->RightElement());
1187 
1188  //LOOKING FOR MAX INTERPOLATION ORDER
1189  int leftmaxp = left->MaxOrder();
1190  int rightmaxp = right->MaxOrder();
1191 
1192 #ifdef LOG4CXX
1193  if (logger->isDebugEnabled())
1194  {
1195  if (logger->isDebugEnabled())
1196  {
1197  std::stringstream sout;
1198  sout << "ordem maxima na esquerda " << leftmaxp<<std::endl;
1199  sout << "ordem maxima na direita " << rightmaxp<<std::endl;
1200  LOGPZ_DEBUG(logger, sout.str().c_str());
1201  }
1202  }
1203 #endif
1204 
1205 
1206  //Max interpolation order
1207  const int p = (leftmaxp > rightmaxp) ? leftmaxp : rightmaxp;
1208 
1209  TPZGeoEl *ref = Reference();
1210  TPZIntPoints *intrule = ref->CreateSideIntegrationRule(ref->NSides()-1, 2*(p) );
1211 
1212  this->SetIntegrationRule(intrule);
1213 }
1214 
1216 
1217  TPZCompEl * el = elside.Element();
1218  TPZCompMesh *comm = Mesh()->CommonMesh(el->Mesh());
1219  TPZCompMesh *elmesh = el->Mesh();
1220  TPZCompMesh *thismesh = Mesh();
1221 
1222  if(el){
1223  int ncon = el->NConnects();
1224  connects.Resize(ncon);
1225  connects.Fill(NULL);
1226  connectindex.Resize(ncon);
1227  connectindex.Fill(-1);
1228  int64_t index;
1229  for(int i = 0; i < ncon; i++){
1230  index = el->ConnectIndex(i);
1231  if (elmesh != thismesh) {
1232  int64_t superind = elmesh->PutinSuperMesh(index, comm);
1233  index = thismesh->GetFromSuperMesh(superind, comm);
1234  }
1235  connectindex[i] = index;
1236  connects[i] = &(fMesh->ConnectVec()[ index ]);
1237  }//for
1238 
1239  }
1240  else{ //if (!el)
1241  connects.Resize(0);
1242  connectindex.Resize(0);
1243  }
1244 
1245 }//end of method
1246 
1248 
1250  if(!mat || mat->Name() == "no_name"){
1251  PZError << "TPZInterfaceElement::EvaluateInterfaceJump interface material null, do nothing\n";
1252  DebugStop();
1253  return;
1254  }
1255 
1256  TPZMaterialData datal, datar, data;
1257  const int nstatel = this->LeftElement()->Material()->NStateVariables();
1258  const int nstater = this->RightElement()->Material()->NStateVariables();
1259  const int njump = (nstatel > nstater) ? nstatel : nstater;
1260 
1261  //LOOKING FOR MAX INTERPOLATION ORDER
1262  TPZGeoEl *ref = Reference();
1263  TPZAutoPointer<TPZIntPoints> intrule = ref->CreateSideIntegrationRule(ref->NSides()-1, 2 );
1264  TPZManVector<int> order(3);
1265  intrule->GetOrder(order);
1266  int maxorder = intrule->GetMaxOrder();
1267  order.Fill(maxorder);
1268  intrule->SetOrder(order);
1269  const int npoints = intrule->NPoints();
1270  TPZManVector<REAL> intpoint(3);
1271  data.x.Resize(3);
1272  REAL weight;
1273 
1274  int64_t numbersol = jump.size();
1275  for (int64_t is=0; is<numbersol; is++) {
1276  jump[is].Resize(njump);
1277  jump[is].Fill(0.);
1278  }
1279  //LOOP OVER INTEGRATION POINTS
1280  for(int ip = 0; ip < npoints; ip++){
1281  intrule->Point(ip,intpoint,weight);
1282  ref->Jacobian( intpoint, data.jacobian, data.axes, data.detjac, data.jacinv);
1283  ref->X(intpoint,data.x);
1284  weight *= fabs(data.detjac);
1285 
1286  //method NeighbourSolution will compute the transformation in this->MapQsi every time it is called
1287  //(which means for all integration point). Instead of calling NeighbourSolution the whole method
1288  //may be written here but keeping the transformation computed at first integration point (as done in CalcStiff).
1289  this->NeighbourSolution(this->LeftElementSide(), intpoint, datal.sol, datal.dsol, datal.axes);
1290  this->NeighbourSolution(this->RightElementSide(), intpoint, datar.sol, datar.dsol, datar.axes);
1291 
1292  if (LeftElement()->NConnects() == 0){
1293  datal.sol.Resize(0);
1294  datal.dsol.Resize(0);
1295  }
1296 
1297  if (RightElement()->NConnects() == 0){
1298  datar.sol.Resize(0);
1299  datar.dsol.Resize(0);
1300  }
1301  TPZSolVec localjump(numbersol);
1302  for (int64_t is=0; is<numbersol; is++) {
1303  localjump[is].Resize(njump,0.);
1304  }
1305  mat->InterfaceJump(data.x, datal.sol, datar.sol, localjump);
1306 
1307  for (int64_t is=0; is<numbersol; is++) {
1308  if(opt == 0){
1309  for(int64_t ier = 0; ier < njump; ier++){
1310  jump[is][ier] += localjump[is][ier]*localjump[is][ier]*(STATE)weight;
1311  }
1312  }
1313  if(opt == 1){
1314  for(int64_t ier = 0; ier < njump; ier++){
1315  if( fabs(localjump[is][ier]) > fabs(jump[is][ier]) ){
1316  jump[is][ier] = fabs( localjump[is][ier] );
1317  }//if
1318  }//for
1319  }//if
1320  }
1321  }//loop over integration points
1322 
1323  //Norma sobre o elemento
1324  for (int64_t is=0; is<numbersol; is++) {
1325  if(opt == 0){
1326  for(int64_t ier = 0; ier < njump; ier++){
1327  jump[is][ier] = sqrt(jump[is][ier]);
1328  }//for
1329  }//if
1330  }
1331 
1332 }//method
1333 
1335  TPZVec<STATE> &errorL,
1336  TPZVec<STATE> &errorR){
1337 
1339  if(!mat){
1340  PZError << "TPZInterfaceElement::ComputeErrorFace interface material null, do nothing\n";
1341  DebugStop();
1342  return;
1343  }
1344 
1345 
1346  TPZInterpolationSpace * left = dynamic_cast<TPZInterpolationSpace*>(this->LeftElement());
1347  TPZInterpolationSpace * right = dynamic_cast<TPZInterpolationSpace*>(this->RightElement());
1348 
1349  if (!left || !right){
1350  PZError << "\nError at TPZInterfaceElement::ComputeErrorFace null neighbour\n";
1351  DebugStop();
1352  return;
1353  }
1354  if(!left->Material() || !right->Material()){
1355  PZError << "\n Error at TPZInterfaceElement::ComputeErrorFace null material\n";
1356  DebugStop();
1357  return;
1358  }
1359 
1360  TPZMaterialData data, datal, datar;
1361  data.SetAllRequirements(true);
1362  datal.SetAllRequirements(true);
1363  datar.SetAllRequirements(true);
1364  this->InitMaterialData(datal,left);
1365  this->InitMaterialData(datar,right);
1366  this->InitMaterialData(data);
1367 
1368  const int dim = this->Dimension();
1369  const int diml = left->Dimension();
1370  const int dimr = right->Dimension();
1371 
1372  //LOOKING FOR MAX INTERPOLATION ORDER
1373  datal.p = left->MaxOrder();
1374  datar.p = right->MaxOrder();
1375  //Max interpolation order
1376  const int p = (datal.p > datar.p) ? datal.p : datar.p;
1377 
1378  TPZGeoEl *ref = Reference();
1379  int intorder = mat->IntegrationRuleOrder(p);
1380  TPZAutoPointer<TPZIntPoints> intrule = ref->CreateSideIntegrationRule(ref->NSides()-1, intorder );
1381  if(mat->HasForcingFunction())
1382  {
1383  intorder = intrule->GetMaxOrder();
1384  TPZManVector<int,3> order(ref->Dimension(),intorder);
1385  intrule->SetOrder(order);
1386  }
1387  // mat->SetIntegrationRule(intrule, p, dim);
1388  const int npoints = intrule->NPoints();
1389 
1390  //integration points in left and right elements: making transformations to neighbour elements
1391  TPZTransform<> TransfLeft, TransfRight;
1392  this->ComputeSideTransform(this->LeftElementSide(), TransfLeft);
1393  this->ComputeSideTransform(this->RightElementSide(), TransfRight);
1394 
1395  TPZManVector<REAL,3> intpoint(dim), LeftIntPoint(diml), RightIntPoint(dimr);
1396  REAL weight;
1397  //LOOP OVER INTEGRATION POINTS
1398  for(int ip = 0; ip < npoints; ip++){
1399 
1400  intrule->Point(ip,intpoint,weight);
1401  ref->Jacobian( intpoint, data.jacobian, data.axes, data.detjac, data.jacinv);
1402  weight *= fabs(data.detjac);
1403 
1404  this->Normal(data.axes,data.normal);
1405 
1406  TransfLeft.Apply( intpoint, LeftIntPoint );
1407  TransfRight.Apply( intpoint, RightIntPoint );
1408 
1409 #ifdef PZDEBUG
1410  this->CheckConsistencyOfMappedQsi(this->LeftElementSide(), intpoint, LeftIntPoint);
1411  this->CheckConsistencyOfMappedQsi(this->RightElementSide(), intpoint, RightIntPoint);
1412 #endif
1413 
1414  //left->ComputeShape(LeftIntPoint, datal.x, datal.jacobian, datal.axes, datal.detjac, datal.jacinv, datal.phi, datal.dphix);
1415  //right->ComputeShape(RightIntPoint, datar.x, datar.jacobian, datar.axes, datar.detjac, datar.jacinv, datar.phi, datar.dphix);
1416 
1417  this->ComputeRequiredData(datal, left, LeftIntPoint);
1418  this->ComputeRequiredData(datar, right, RightIntPoint);
1419  //data.SetAllRequirements(true);
1420  data.fNeedsHSize=true;
1421  data.intLocPtIndex=ip;
1422  this->ComputeRequiredData(data,intpoint);
1423 
1424  mat->ContributeInterfaceErrors(data, datal, datar, weight,errorL,errorR,errorid);
1425 
1426  }//loop over integration points
1427 
1428 }
1429 
1430 void TPZInterfaceElement::Integrate(int variable, TPZVec<STATE> & value){
1431  const int varsize = this->Material()->NSolutionVariables(variable);
1432  value.Resize(varsize);
1433  value.Fill(0.);
1434 }
1435 
1437  TPZMaterial * material = Material();
1438  if(!material){
1439  PZError << "Error at " << __PRETTY_FUNCTION__ << " : no material for this element\n";
1440  DebugStop();
1441  return;
1442  }
1443  if (!this->Reference()){
1444  PZError << "Error at " << __PRETTY_FUNCTION__ << " : no reference element\n";
1445  DebugStop();
1446  return;
1447  }
1448  const int dim = this->Dimension();
1449  TPZInterpolationSpace *left = dynamic_cast<TPZInterpolationSpace*>(this->LeftElement());
1450  TPZInterpolationSpace *right = dynamic_cast<TPZInterpolationSpace*>(this->RightElement());
1451  if (!left || !right){
1452  PZError << "\nError at TPZInterfaceElement::IntegrateInterface null neighbour\n";
1453  DebugStop();
1454  return;
1455  }
1456  if(!left->Material() || !right->Material()){
1457  PZError << "\n Error at TPZInterfaceElement::IntegrateInterface null material\n";
1458  DebugStop();
1459  return;
1460  }
1461  TPZDiscontinuousGalerkin *discgal = dynamic_cast<TPZDiscontinuousGalerkin *>(material);
1462 
1463  //local variables
1464  REAL weight;
1465  TPZMaterialData data, datal, datar;
1466  this->InitMaterialData(datal,left);
1467  this->InitMaterialData(datar,right);
1468  this->InitMaterialData(data);
1469  TPZGeoEl *ref = Reference();
1470  datal.p = left->MaxOrder();
1471  datar.p = right->MaxOrder();
1472  TPZManVector<REAL, 3> intpoint(dim,0.);
1473  const int varsize = material->NSolutionVariables(variable);
1474  //Max interpolation order
1475  const int p = (datal.p > datar.p) ? datal.p : datar.p;
1476 
1477  //Integration rule
1478  int intorder = material->IntegrationRuleOrder(p);
1479  TPZAutoPointer<TPZIntPoints> intrule = ref->CreateSideIntegrationRule(ref->NSides()-1, intorder);
1480  if(material->HasForcingFunction())
1481  {
1482  intorder = intrule->GetMaxOrder();
1483  TPZManVector<int,3> order(ref->Dimension(),intorder);
1484  intrule->SetOrder(order);
1485  }
1486  // material->SetIntegrationRule(intrule, p, ref->Dimension());
1487 
1488  //loop over integration points
1489  const int npoints = intrule->NPoints();
1490  int ip, iv;
1491  value.Resize(varsize);
1492  value.Fill(0.);
1493  TPZManVector<STATE> locval(varsize);
1494  for(ip=0;ip<npoints;ip++){
1495  intrule->Point(ip,intpoint,weight);
1496  ref->Jacobian(intpoint, data.jacobian, data.axes, data.detjac, data.jacinv);
1497  weight *= fabs(data.detjac);
1498  this->Normal(data.axes,data.normal);
1499 // this->ComputeSolution(intpoint, data.phi, data.dphix, data.axes, data.sol, data.dsol);
1500  this->NeighbourSolution(this->LeftElementSide(), intpoint, datal.sol, datal.dsol, datal.axes);
1501  this->NeighbourSolution(this->RightElementSide(), intpoint, datar.sol, datar.dsol, datar.axes);
1502  discgal->SolutionDisc(data, datal, datar, variable, locval);
1503  for(iv = 0; iv < varsize; iv++) {
1504 #ifdef STATE_COMPLEX
1505  value[iv] += locval[iv].real()*weight;
1506 #else
1507  value[iv] += locval[iv]*weight;
1508 #endif
1509  }//for iv
1510  }//for ip
1511 
1512 }//method
1513 
1515  TPZGeoEl * neighel = Neighbor.Element()->Reference();
1516  const int dim = this->Dimension();
1517  TPZTransform<> LocalTransf(dim);
1518  TPZGeoElSide thisgeoside(this->Reference(), this->Reference()->NSides()-1);
1519  TPZGeoElSide neighgeoside(neighel, Neighbor.Side());
1520 #ifdef LOG4CXX
1521  if(logger->isDebugEnabled())
1522  {
1523  std::stringstream sout;
1524  sout << "thisgeoside = \n";
1525  thisgeoside.Print(sout);
1526  sout << "neighgeoside = \n";
1527  neighgeoside.Print(sout);
1528  LOGPZ_DEBUG(logger, sout.str())
1529  }
1530 #endif
1531  thisgeoside.SideTransform3(neighgeoside, LocalTransf);
1532 
1533  TPZGeoElSide highdim(neighel, neighel->NSides()-1);
1534  transf = neighgeoside.SideToSideTransform(highdim).Multiply(LocalTransf);
1535 }//ComputeSideTransform
1536 
1538  TPZTransform<> Transf;
1539  this->ComputeSideTransform(Neighbor, Transf);
1540  Transf.Apply( qsi, NeighIntPoint );
1541 #ifdef PZDEBUG
1542  this->CheckConsistencyOfMappedQsi(Neighbor, qsi, NeighIntPoint);
1543 #endif
1544 }//MapQsi
1545 
1547  REAL tol = 0.;
1548  ZeroTolerance(tol);
1549  tol *= 100.;
1550  TPZManVector<REAL,3> FaceXPoint(3), XPoint(3);
1551  this->Reference()->X( qsi, FaceXPoint);
1552  Neighbor.Element()->Reference()->X( NeighIntPoint, XPoint);
1553  int i, n = FaceXPoint.NElements();
1554  if (n != XPoint.NElements() ){
1555  PZError << __PRETTY_FUNCTION__ << std::endl
1556  << "Face X point and LeftElement X point have not same dimension." << std::endl;
1557  return false;
1558  }
1559  REAL erro = 0.;
1560  for(i = 0; i < n; i++){
1561  erro += (XPoint[i] - FaceXPoint[i])*(XPoint[i] - FaceXPoint[i]);
1562  }
1563  erro = sqrt(erro);
1564  if (erro > tol){
1565  PZError << __PRETTY_FUNCTION__ << std::endl
1566  << "Face X point and LeftElement X point are not same." << std::endl;
1567  this->Print(cout);
1568  return false;
1569  }
1570  return true;
1571 }//void
1572 
1574  TPZSolVec &sol, TPZGradSolVec &dsol,
1575  TPZFMatrix<REAL> &NeighborAxes){
1576  TPZGeoEl * neighel = Neighbor.Element()->Reference();
1577  const int neighdim = neighel->Dimension();
1578  TPZManVector<REAL,3> NeighIntPoint(neighdim);
1579  this->MapQsi(Neighbor, qsi, NeighIntPoint);
1580  Neighbor.Element()->ComputeSolution(NeighIntPoint, sol, dsol, NeighborAxes);
1581 }
1582 
1584  const TPZFMatrix<REAL> &axes, TPZSolVec &sol, TPZGradSolVec &dsol){
1585  sol.Resize(0);
1586  dsol.Resize(0);
1587 }
1588 
1590  TPZSolVec &sol, TPZGradSolVec &dsol,TPZFMatrix<REAL> &axes){
1591  sol.Resize(0);
1592  dsol.Resize(0);
1593  axes.Zero();
1594 }
1595 
1602  TPZMaterialData &data)
1603 {
1604  DebugStop();
1605 }
1606 
1607 
1609  TPZVec<REAL> &normal,
1610  TPZSolVec &leftsol, TPZGradSolVec &dleftsol,TPZFMatrix<REAL> &leftaxes,
1611  TPZSolVec &rightsol, TPZGradSolVec &drightsol,TPZFMatrix<REAL> &rightaxes){
1612  this->Normal(qsi, normal);
1613  this->NeighbourSolution(this->fLeftElSide, qsi, leftsol, dleftsol, leftaxes);
1614  this->NeighbourSolution(this->fRightElSide, qsi, rightsol, drightsol, rightaxes);
1615 }//method
1616 
1618  TPZMaterial *matorig = Material();
1619  TPZDiscontinuousGalerkin *mat = dynamic_cast<TPZDiscontinuousGalerkin *>(matorig);
1620  if (!mat){
1621  PZError << "FATAL ERROR AT " << __PRETTY_FUNCTION__ << "\n";
1622  DebugStop();
1623  }
1624  elem->InitMaterialData(data);
1625  mat->FillDataRequirementsInterface(data);
1626  if (data.fNeedsNeighborSol) {
1627  data.fNeedsSol = true;
1628  }
1629 //
1630 // //this values needs to be computed only once
1631  if(data.fNeedsNeighborCenter){
1632  TPZManVector<REAL,3> qsi(elem->Dimension(),0.);
1633  data.XCenter.Resize(3);
1634  TPZGeoEl * gel = elem->Reference();
1635  gel->CenterPoint(gel->NSides()-1,qsi);
1636  gel->X(qsi,data.XCenter);
1637  }
1638 
1639  data.gelElId = elem->Reference()->Id();
1640 
1641 }//void
1642 
1643 
1645 // TPZMaterial *matorig = Material().operator->();
1646  const int dim = this->Dimension();
1647  data.axes.Redim(dim,3);
1648  data.jacobian.Redim(dim,dim);
1649  data.jacinv.Redim(dim,dim);
1650  data.x.Resize(3);
1651  data.normal = this->fCenterNormal;
1652 }
1653 
1655  TPZInterpolationSpace *elem,
1656  TPZVec<REAL> &IntPoint){
1657 
1658  data.intGlobPtIndex = -1;
1659  //elem->ComputeShape(IntPoint, data.x, data.jacobian, data.axes, data.detjac, data.jacinv, data.phi, data.dphix);
1660  elem->ComputeShape(IntPoint,data);
1661 
1662  if (data.fNeedsNeighborSol){
1663  elem->ComputeSolution(IntPoint, data.phi, data.dphix, data.axes, data.sol, data.dsol );
1664  }
1665 
1666  data.p = elem->MaxOrder();
1667 
1668 }
1670 {
1671 
1672  if (data.fNeedsSol){
1673  // the interface elements have no approximation space!!
1674  DebugStop();
1675  }
1676 
1677  if (data.fNeedsHSize){
1678  const int dim = this->Dimension();
1679  REAL faceSize;
1680  if (dim == 0){//it means I am a point
1681  DebugStop();
1682  faceSize = 1.;
1683  }
1684  else{
1685  faceSize = 2.*this->Reference()->ElementRadius();//Igor Mozolevski's suggestion. It works well for elements with small aspect ratio
1686  }
1687  data.HSize = faceSize;
1688  }
1689 
1690  if(data.fNeedsNormal )//&& !this->Reference()->IsLinearMapping())
1691  {
1692  this->ComputeNormal(data.axes,data.normal);
1693  }
1694 
1695 }//void
1696 
1698 void TPZInterfaceElement::BuildCornerConnectList(std::set<int64_t> &connectindexes) const
1699 {
1700  TPZCompEl *left = LeftElement();
1701  TPZCompEl *right = RightElement();
1702 #ifdef PZDEBUG
1703  if (!left || !right ) {
1704  DebugStop();
1705  }
1706 #endif
1707  left->BuildCornerConnectList(connectindexes);
1708  right->BuildCornerConnectList(connectindexes);
1709 }
1710 
int64_t NElements() const
Number of computational elements allocated.
Definition: pzcmesh.h:169
Defines the interface which material objects need to implement for discontinuous Galerkin formulation...
Definition: pzdiscgal.h:20
virtual void GetOrder(TPZVec< int > &ord) const =0
Gets the order of the integration rule for each dimension of the master element.
bool CheckConsistencyOfMappedQsi(TPZCompElSide &Neighbor, TPZVec< REAL > &qsi, TPZVec< REAL > &NeighIntPoint)
Check consistency of mapped qsi performed by method TPZInterfaceElement::MapQsi by comparing the X co...
int64_t ConnectIndex(int i) const override
Its return the connects of the left and right element associates.
virtual void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
void SolutionDisc(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
Definition: pzdiscgal.h:176
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
Definition: tfadfunc.h:140
Contains the TPZInt1d, TPZIntTriang, TPZIntQuad, TPZIntCube3D, TPZIntTetra3D, TPZIntPyram3D and TPZIn...
virtual void BuildCornerConnectList(std::set< int64_t > &connectindexes) const =0
adds the connect indexes associated with base shape functions to the set
TPZManVector< REAL, 3 > normal
normal to the element at the integration point
int Position(const int block_diagonal) const
Returns the position of first element block dependent on matrix diagonal.
Definition: pzblock.h:177
virtual int NPoints() const =0
Returns number of points for the cubature rule related.
void Normal(TPZFMatrix< REAL > &axes, TPZVec< REAL > &normal)
Returns normal based on already computed axes matrix.
Implements computational element and a side. Computational Element.
Definition: pzcompel.h:632
int Set(const int index, const int dim, const int pos=-1)
Modifies existing block dimensions or creates a new block with given index.
Definition: pzblock.cpp:104
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
Definition: pzconnect.h:30
Contains declaration of TPZGeoElSide class which represents an element and its side, and TPZGeoElSideIndex class which represents an TPZGeoElSide index.
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...
virtual MElementType Type()
Return the type of the element.
Definition: pzcompel.cpp:195
int MaterialId() const
Returns the material index of the element.
Definition: pzgeoel.h:250
TPZManVector< REAL, 3 > fCenterNormal
Normal to the face element.
TPZCompElSide fRightElSide
Element the right of the normal a interface.
virtual int NConnectShapeF(int icon, int order) const =0
Returns the number of shapefunctions associated with a connect.
TPZStack< int64_t > fConnect
Vector of pointers to TPZConnect objects.
Definition: pzelmat.h:39
void GetConnects(TPZCompElSide &elside, TPZVec< TPZConnect *> &connects, TPZVec< int64_t > &connectindex)
Extract connects from element el.
TPZGeoElSide Reference() const
Reference to the geometric element.
Definition: pzcompel.cpp:748
TPZFNMatrix< 1000, STATE > fMat
Pointer to a blocked matrix object.
Definition: pzelmat.h:41
virtual int Dimension() const =0
Dimension of the element.
void SetAllRequirements(bool set)
Set all flags at once.
void ComputeSideTransform(TPZCompElSide &Neighbor, TPZTransform<> &transf)
Contains declaration of TPZInterpolationSpace class which implements the interface for interpolated c...
void SetLeftRightElements(TPZCompElSide &left, TPZCompElSide &right)
Set neighbors.
virtual int Dimension() const =0
Returns the integrable dimension of the material.
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
double sdot(TPZVec< T1 > &x, TPZVec< T1 > &y)
Performs a sdot operation: dot <- Transpose[x] * y.
Definition: pzvec_extras.h:98
TPZFNMatrix< 9, REAL > jacinv
value of the inverse of the jacobian at the integration point
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Definition: pzgeoelside.h:83
TPZCompEl * CloneInterface(TPZCompMesh &aggmesh, int64_t &index, TPZCompElSide &left, TPZCompElSide &right) const
Method used in TPZAgglomerateElement::CreateAgglomerateMesh.
virtual void Integrate(int variable, TPZVec< STATE > &value) override
Integrate a variable over the element.
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef) override
CalcStiff computes the element stiffness matrix and right hand side.
REAL val(STATE &number)
Returns value of the variable.
Definition: pzartdiff.h:23
#define LOGPZ_WARN(A, B)
Define log for warnings.
Definition: pzlog.h:91
TPZGeoElSide Neighbour() const
Definition: pzgeoel.h:754
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.
static int ExistInterfaces(TPZCompElSide &comp)
Verifies the existence of interfaces associates with the side of an element.
TPZBlock< STATE > fBlock
Block structure associated with fMat.
Definition: pzelmat.h:43
virtual void FillDataRequirementsInterface(TPZMaterialData &data) override
Fill material data parameter with necessary requirements for the ContributeInterface method...
Definition: pzdiscgal.cpp:22
TPZCompElSide fLeftElSide
Element the left of the normal a interface.
virtual void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
static TPZSavable * GetInstance(const int64_t &objId)
void Print(std::ostream &out=std::cout) const override
Prints attributes of the object.
virtual int SideDimension(int side) const =0
Return the dimension of side.
void SideTransform3(TPZGeoElSide neighbour, TPZTransform<> &t)
Accumulates the transformations from the current element/side to the neighbour/side.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Definition: pzmanvector.h:426
void VetorialProd(TPZVec< REAL > &ivet, TPZVec< REAL > &jvet, TPZVec< REAL > &kvet)
TPZFNMatrix< 9, REAL > jacobian
value of the jacobian at the integration point
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
int p
maximum polinomial order of the shape functions
void SetElement(TPZCompEl *el)
Sets computational element pointer.
Definition: pzcompel.h:685
void SetSide(int side)
Sets the side index.
Definition: pzcompel.cpp:757
virtual void InitializeIntegrationRule() override
Pointer to the integration rule.
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
virtual int ClassId() const override
Define the class id associated with the class.
Definition: pzcompel.cpp:1129
Abstract class defining integration rules. Numerical Integration.
Definition: tpzintpoints.h:19
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
virtual void CenterPoint(int side, TPZVec< REAL > &masscent) const =0
It returns the coordinates from the center of the side of the element in the element coordinate space...
TPZInterfaceElement()
Empty constructor.
void NeighbourSolution(TPZCompElSide &Neighbor, TPZVec< REAL > &qsi, TPZSolVec &sol, TPZGradSolVec &dsol, TPZFMatrix< REAL > &NeighborAxes)
Compute solution at neighbour element in a given master coordinate qsi. It returns the axes at which ...
virtual TPZIntPoints * CreateSideIntegrationRule(int side, int order)=0
Creates an integration rule for the topology of the corresponding side and able to integrate a polyno...
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
Definition: pzcompel.cpp:959
int NRightConnects() const
Returns the number from connectivities of the element related to right neighbour. ...
void HigherLevelElementList(TPZStack< TPZCompElSide > &elsidevec, int onlyinterpolated, int removeduplicates)
Returns all connected elements which have level higher to the current element.
Definition: pzcompel.cpp:761
~TPZInterfaceElement()
Destructor.
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
virtual int ClassId() const override
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
TPZManVector< REAL, 3 > XCenter
value of the coordinate at the center of the element
virtual std::string Name() override
Returns the name of the material.
Definition: pzdiscgal.cpp:20
static const double tol
Definition: pzgeoprism.cpp:23
void Read(TPZStream &buf, void *context) override
Read the element data from a stream.
Definition: pzcompel.cpp:736
virtual void ComputeErrorFace(int errorid, TPZVec< STATE > &errorL, TPZVec< STATE > &errorR)
ComputeError computes the element error estimator.
void Push(const T object)
Pushes a copy of the object on the stack.
Definition: pzstack.h:80
int DecrementNumInterfaces()
Decrement number of TPZInterfaceElement pointing to this.
Definition: pzgeoel.h:105
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
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
virtual void CalcResidual(TPZElementMatrix &ef) override
CalcResidual only computes the element residual.
int Dimension() const override
Returns the dimension from the element interface.
int64_t Index() const
Returns the index of the element within the element vector of the mesh.
Definition: pzgeoel.h:730
virtual void SetIntegrationRule(TPZIntPoints *intrule)
Method to set a dynamically allocated integration rule.
Definition: pzcompel.cpp:1116
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
Contains declaration of TPZInterfaceElement class which computes the contribution over an interface b...
virtual void SetOrder(TPZVec< int > &ord, int type=0)=0
Sets the order of the cubature rule.
TPZCompElSide & LeftElementSide()
Returns left neighbor.
#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
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
It computes a contribution to stiffness matrix and load vector at one integration point...
Definition: pzdiscgal.cpp:30
int NumInterfaces()
Returns number of TPZInterfaceElement pointing to this.
Definition: pzgeoel.h:94
void Jacobian(TPZVec< REAL > &qsi, TPZFMatrix< REAL > &jac, TPZFMatrix< REAL > &axes, REAL &detjac, TPZFMatrix< REAL > &jacinv) const
Compute a decomposition of the gradient of the mapping function, as a rotation matrix (Jacobian) and ...
Definition: pzgeoel.cpp:1144
void IntegrateInterface(int variable, TPZVec< REAL > &value)
int NLeftConnects() const
Returns the number from connectivities of the element related to left neighbour.
virtual int64_t PutinSuperMesh(int64_t local, TPZCompMesh *super)
Put an local connection in the supermesh - Supermesh is one mesh who contains the analised submesh...
Definition: pzcmesh.cpp:1512
unsigned int NShape() const
Definition: pzconnect.h:151
void CenterNormal(TPZVec< REAL > &CenterNormal) const
Returns the normal of this interface which goes from left to right neighbors.
void DecreaseElConnected()
Informs the connects that this element is no longer connected to it.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
Definition: tfadfunc.h:120
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
void InitializeElementMatrix(TPZElementMatrix &ef)
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
Definition: pzcmesh.h:213
TPZCompMesh * fMesh
Definition: pzelmat.h:36
TPZCompElSide & RightElementSide()
Returns right neighbor.
int Exists() const
Verifies if the object is non null (initialized)
Definition: pzcompel.h:697
Contains declaration of TPZCompelDisc class which implements a computational element for discontinuou...
TPZIntPoints * fIntegrationRule
Integration rule established by the user.
Definition: pzcompel.h:590
TPZAdmChunkVector< TPZConnect > & ConnectVec()
Return a reference to the connect pointers vector.
Definition: pzcmesh.h:198
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...
REAL HSize
measure of the size of the element
virtual int HasForcingFunction()
Directive that gives true if the material has a forcing function.
Definition: TPZMaterial.h:472
int intGlobPtIndex
global point index
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Definition: pzlog.h:93
int SetNBlocks(const int num_of_blocks)
Sets number of blocks on diagonal matrix.
Definition: pzblock.cpp:91
void ComputeRequiredData(TPZMaterialData &data, TPZInterpolationSpace *elem, TPZVec< REAL > &IntPoint)
Compute and fill data with requested attributes for neighbouring element.
virtual void ComputeSolution(TPZVec< REAL > &qsi, TPZMaterialData &data)
Definition: pzcompel.h:462
void ComputeCenterNormal(TPZVec< REAL > &normal)
Computes normal for linear geometric elements.
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Definition: pzfmatrix.h:616
virtual TPZConnect & Connect(int i) const
Returns a pointer to the ith node.
Definition: pzcompel.cpp:298
int intLocPtIndex
Index of the current integration point being evaluated.
unsigned char NState() const
Number of state variables associated with the connect.
Definition: pzconnect.h:146
virtual void ContributeInterfaceErrors(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZVec< STATE > &nkL, TPZVec< STATE > &nkR, int &errorid)
Definition: pzdiscgal.h:212
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
virtual int64_t ConnectIndex(int i) const =0
Returns the index of the ith connectivity of the element.
Computes the contribution over an interface between two discontinuous elements. Computational Element...
TPZTransform< T > Multiply(TPZTransform< T > &right)
Multiply the transformation object (to the right) with right (Multiplying matrices) ...
Definition: pztrnsform.cpp:112
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
Definition: pzelmat.h:30
Implements the interfaces for TPZCompElDisc, TPZInterfaceElement and TPZInterpolatedElement. Computational element.
virtual int NConnects() const =0
Returns the number of nodes of the element.
virtual bool IsLinearMapping() const
Definition: pzgeoel.h:268
virtual void InterfaceJump(TPZVec< REAL > &x, TPZSolVec &leftu, TPZSolVec &rightu, TPZSolVec &jump)
Computes interface jump = leftu - rightu.
Definition: pzdiscgal.cpp:77
TPZGeoEl * Element() const
Definition: pzgeoelside.h:162
virtual void ComputeSolution(TPZVec< REAL > &qsi, TPZVec< REAL > &normal, TPZSolVec &leftsol, TPZGradSolVec &dleftsol, TPZFMatrix< REAL > &leftaxes, TPZSolVec &rightsol, TPZGradSolVec &drightsol, TPZFMatrix< REAL > &rightaxes) override
Computes solution and its derivatives in the local coordinate qsi.
Contains declaration of TPZSubCompMesh class which implements a group of computational elements as a ...
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
int64_t Id() const
Returns the Id of the element.
Definition: pzgeoel.h:223
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
Definition: pzcompel.cpp:1137
void IncrementElConnected()
Informs the connects that this element is connected to it.
virtual int NShapeF() const =0
It returns the shapes number of the element.
TPZCompEl * LeftElement() const
Returns the left element from the element interface.
virtual int NSolutionVariables(int var)
Returns the number of variables associated with the variable indexed by var.
virtual void X(TPZVec< REAL > &qsi, TPZVec< REAL > &result) const =0
Return the coordinate in real space of the point coordinate in the master element space...
TPZCompElSide Reference() const
Returns a pointer to the elementside referenced by the geometric elementside.
static int main(TPZCompMesh &cmesh)
void ComputeNormal(TPZVec< REAL > &qsi, TPZVec< REAL > &normal)
Computes normal at qsi point.
virtual int NConnects() const override
Returns the number from connectivities of the element.
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
virtual int GetMaxOrder() const
Returns the minimum order to integrate polinomials exactly for all implemented cubature rules...
Definition: pzquad.cpp:30
void ResetReference()
Reset the element referenced by the geometric element to NULL.
Definition: pzgeoel.h:431
void Reset(TPZCompMesh *mesh=NULL, MType type=Unknown)
Reset the data structure.
Definition: pzelmat.h:59
void Print(std::ostream &out) const
print geometric characteristics of the element/side
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
int Size(const int block_diagonal) const
Returns block dimension.
Definition: pzblock.h:171
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Definition: pzcmesh.h:183
virtual void Print(std::ostream &out=std::cout) const
Prints element data.
Definition: pzcompel.cpp:322
void RemoveConnectivities()
It removes the connectivities of the element.
Definition: pzgeoel.cpp:1098
void SetReference(TPZCompEl *elp)
Make the current element reference to the computational element.
Definition: pzgeoel.h:746
virtual void Solution(TPZVec< REAL > &qsi, int var, TPZVec< STATE > &sol)
Calculates the solution - sol - for the variable var at point qsi, where qsi is expressed in terms of...
Definition: pzcompel.cpp:421
Contains declaration of TPZInterpolatedElement class which implements computational element of the in...
int NumLoadCases()
returns the number of load cases for this material object
Definition: TPZMaterial.h:186
int Id() const
Definition: TPZMaterial.h:170
virtual TPZCompMesh * CommonMesh(TPZCompMesh *mesh)
Gives the commom father mesh of the specified mesh and the current submesh.
Definition: pzcmesh.cpp:2794
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
int Side() const
Returns the side index.
Definition: pzcompel.h:688
int Exists() const
Definition: pzgeoelside.h:175
void Write(TPZStream &buf, int withclassid) const override
Save the element data to a stream.
Definition: pzcompel.cpp:726
virtual int MaxOrder()
Returns the max order of interpolation.
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 * RightElement() const
Returns the right element from the element interface.
Contains the TPZConservationLaw class which implements the interface for conservation laws...
Implements an affine transformation between points in parameter space. Topology Utility.
Definition: pzmganalysis.h:14
int ComputeIntegrationOrder() const override
Returns the unique identifier for reading/writing objects to streams.
virtual TPZIntPoints * Clone() const =0
Make a clone of the related cubature rule.
This class implements a discontinuous element (for use with discontinuous Galerkin). Computational Element.
Definition: TPZCompElDisc.h:35
Extra utilities for TPZVec. Implementations of the saxpy, sscal, sdot, intercept, max and min functio...
virtual REAL ElementRadius()
Definition: pzgeoel.cpp:949
virtual void EvaluateError(std::function< void(const TPZVec< REAL > &loc, TPZVec< STATE > &val, TPZFMatrix< STATE > &deriv)> func, TPZVec< REAL > &errors, bool store_error) override
Performs an error estimate on the elemen.
static int FreeInterface(TPZCompMesh &cmesh)
void EvaluateInterfaceJump(TPZSolVec &jump, int opt)
REAL ZeroTolerance()
Returns the tolerance to Zero value. Actually: .
Definition: pzreal.h:633
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
int IncrementNumInterfaces()
Increments number of TPZInterfaceElement pointing to this.
Definition: pzgeoel.h:99
TPZSolVec sol
vector of the solutions at the integration point
void SetConnectIndex(int node, int64_t index) override
This function should not be called.
virtual void BuildCornerConnectList(std::set< int64_t > &connectindexes) const override
adds the connect indexes associated with base shape functions to the set
int64_t ElementIndex(TPZGeoEl *gel)
Returns the index of the given element into the fElementVec.
Definition: pzgmesh.cpp:1169
void InitMaterialData(TPZMaterialData &data, TPZInterpolationSpace *left)
Initialize a material data and its attributes based on element dimension, number of state variables a...
REAL detjac
determinant of the jacobian
static void WritePointer(const TPZSavable *obj, TPZStream *stream)
void Apply(TPZVec< T > &vectorin, TPZVec< T > &vectorout)
Transforms the vector.
Definition: pztrnsform.cpp:121
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 Point(int i, TPZVec< REAL > &pos, REAL &w) const =0
Returns i-th point at master element and related weight.
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
int Resequence(const int start=0)
Resequences blocks positioning.
Definition: pzblock.cpp:150
TPZCompMesh * fMesh
Computational mesh to which the element belongs.
Definition: pzcompel.h:64
virtual void Read(bool &val)
Definition: TPZStream.cpp:91
virtual int64_t GetFromSuperMesh(int64_t superind, TPZCompMesh *super)
Get an external connection from the supermesh - Supermesh is one mesh who contains the analised subme...
Definition: pzcmesh.cpp:1517
TPZAdmChunkVector< TPZGeoEl * > & ElementVec()
Methods for handling pzlists.
Definition: pzgmesh.h:138
void MapQsi(TPZCompElSide &Neighbor, TPZVec< REAL > &qsi, TPZVec< REAL > &NeighIntPoint)
Maps qsi coordinate at this master element to qsi coordinate at neighbor master element.