NeoPZ
pzcompel.cpp
Go to the documentation of this file.
1 
6 #include "pzcompel.h"
7 #include "pzgeoel.h"
8 #include "pzgeoelside.h"
9 #include "TPZMaterial.h"
10 #include "pzcmesh.h"
11 #include "pzbndcond.h"
12 #include "pzelmat.h"
13 #include "pzconnect.h"
14 #include "pzblockdiag.h"
15 
16 #include "pzshapelinear.h"
17 
18 #include "pzerror.h"
19 #include "pzmatrix.h"
20 #include "pzfmatrix.h"
21 #include "pzblock.h"
22 #include "pzsolve.h"
23 
24 #include "pzmanvector.h"
25 #include "pzstack.h"
26 
27 #include "pztransfer.h"
28 #include "pztrnsform.h"
29 #include "pzquad.h"
30 
31 #include "TPZInterfaceEl.h"
32 #include "TPZCompElDisc.h"
33 #include "pzintel.h"
34 
35 #include <math.h>
36 #include <stdlib.h>
37 
38 #include <sstream>
39 using namespace std;
40 
41 #include "pzlog.h"
42 
43 #include <algorithm>
44 #include <iterator>
45 
46 #ifdef LOG4CXX
47 static LoggerPtr logger(Logger::getLogger("pz.mesh.tpzcompel"));
48 static LoggerPtr loggerSide(Logger::getLogger("pz.mesh.tpzcompelside"));
49 #endif
50 
52  TPZElementMatrix ek(this->Mesh(), TPZElementMatrix::EK),ef(this->Mesh(), TPZElementMatrix::EF);
53  int b;
54  CalcStiff(ek,ef);
55  if(HasDependency()) {
56  ek.ApplyConstraints();
57  ef.ApplyConstraints();
58  int numblock = ek.fConstrConnect.NElements();
59  TPZVec<int> blocksize(numblock);
60 
61  for(b=0; b<numblock; b++) blocksize[b] = ek.fConstrBlock.Size(b);
62 
63  blockdiag.Initialize(blocksize);
64  connectlist = ek.fConstrConnect;
65 
66  for(b=0; b<numblock; b++) {
67  int blsize = blocksize[b];
68  int64_t conind = ek.fConstrConnect[b];
69  TPZConnect &con = Mesh()->ConnectVec()[conind];
70  if(con.HasDependency() || con.IsCondensed()) continue;
71  //TPZFMatrix<REAL> ekbl(blsize,blsize);
72  TPZFMatrix<STATE> ekbl(blsize,blsize);
73  int r,c;
74  //TPZBlock<REAL> &mbl = ek.fConstrBlock;
75  TPZBlock<STATE> &mbl = ek.fConstrBlock;
76 
77  for(r=0; r<blsize; r++) {
78  for(c=0; c<blsize; c++) {
79  ekbl(r,c) = (mbl)(b,b,r,c);
80  }
81  }
82  blockdiag.AddBlock(b,ekbl);
83  }
84  } else {
85  int numblock = ek.fConnect.NElements();
86  TPZVec<int> blocksize(numblock);
87 
88  for(b=0; b<numblock; b++) blocksize[b] = ek.fBlock.Size(b);
89 
90  blockdiag.Initialize(blocksize);
91  connectlist = ek.fConnect;
92 
93  for(b=0; b<numblock; b++) {
94  int blsize = blocksize[b];
95  //TPZFMatrix<REAL> ekbl(blsize,blsize);
96  TPZFMatrix<STATE> ekbl(blsize,blsize);
97  int64_t conind = ek.fConnect[b];
98  TPZConnect &con = Mesh()->ConnectVec()[conind];
99  if(con.HasDependency() || con.IsCondensed()) continue;
100  int r, c;
101  //TPZBlock<REAL> &mbl = ek.fBlock;
102  TPZBlock<STATE> &mbl = ek.fBlock;
103 
104  for(r=0; r<blsize; r++) {
105  for(c=0; c<blsize; c++) {
106  //ekbl(r,c) = (mbl)(b,b,r,c);
107  ekbl(r,c) = (mbl)(b,b,r,c);
108  }
109  }
110  blockdiag.AddBlock(b,ekbl);
111  }
112  }
113 }
114 
115 int TPZCompEl::gOrder = 2;
116 
117 TPZCompEl::TPZCompEl() : fMesh(0), fIndex(-1), fReferenceIndex(-1), fIntegrationRule(0) {
118 }
119 
120 TPZCompEl::TPZCompEl(TPZCompMesh &mesh, TPZGeoEl *ref, int64_t &index) : fIntegrationRule(0) {
121  fMesh = &mesh;
122  index = mesh.ElementVec().AllocateNewElement();
123  mesh.ElementVec()[index] = this;
124  fIndex = index;
125  fReferenceIndex = (ref == 0) ? -1 : ref->Index();
126 }
127 
129  fMesh = &mesh;
130  int64_t index = copy.fIndex;
131  if(index >= 0) mesh.ElementVec()[index] = this;
132  fIndex = index;
134  if (copy.fIntegrationRule) {
136  }
137 }
138 
139 TPZCompEl::TPZCompEl(TPZCompMesh &mesh, const TPZCompEl &copy, int64_t &index) : fIntegrationRule(0) {
140  fMesh = &mesh;
141  index = mesh.ElementVec().AllocateNewElement();
142  if(index >= 0) mesh.ElementVec()[index] = this;
143  fIndex = index;
145  if (copy.fIntegrationRule) {
147  }
148 }
149 
150 TPZCompEl::TPZCompEl(TPZCompMesh &mesh, const TPZCompEl &copy, std::map<int64_t,int64_t> &gl2lcElMap) : fIntegrationRule(0)
151 {
152  fMesh = &mesh;
153  if (gl2lcElMap.find(copy.fIndex) == gl2lcElMap.end())
154  {
155  std::stringstream sout;
156  sout << "ERROR in - " << __PRETTY_FUNCTION__
157  << " original element index: " << copy.fIndex << " is not mapped!\n"
158  << "Map content: ";
159  std::map<int64_t,int64_t>::iterator it;
160  for (it=gl2lcElMap.begin();it!=gl2lcElMap.end();it++) sout << " ( " << it->first << " | " << it->second << " ) ;";
161  LOGPZ_ERROR (logger,sout.str().c_str());
162  DebugStop();
163  }
164  int64_t index = gl2lcElMap[copy.fIndex];
165  if(index >= 0) mesh.ElementVec()[index] = this;
166  fIndex = index;
168  if (copy.fIntegrationRule) {
170  }
171 }
172 
174  int64_t index = Index();
175  if (index != -1){
176  if (fMesh->ElementVec()[index] == this) {
177  fMesh->ElementVec()[index] = 0;
178  fMesh->ElementVec().SetFree(index);
179  }
180  }
181 #ifdef PZDEBUG
182  TPZGeoEl *gel = Reference();
183  if (gel && gel->Reference()) {
184  DebugStop();
185  }
186 #endif
187  fIndex = -1;
188  fReferenceIndex = -1;
189  fMesh = 0;
190  if (fIntegrationRule) {
191  delete fIntegrationRule;
192  }
193 }
194 
196  LOGPZ_WARN(logger, "Type unknown");
197  return ENoType;
198 }
199 
201  // an element without mesh is a free element
202  if(!Mesh() || !HasDependency()) return;
203  TPZStack<int64_t> connectlist;
204  int totalconnects;
205  BuildConnectList(connectlist);
206  totalconnects = connectlist.NElements();
207  TPZManVector<int> dependenceorder(totalconnects);
208  TPZConnect::BuildDependencyOrder(connectlist,dependenceorder,*this->Mesh());
209  // TPZMaterial * mat = Material();
210  // if(!mat) {
211  // LOGPZ_WARN(logger, "Exiting LoadSolution because a null material was reached.");
212  // return;
213  // }
214  //int numstate = mat->NStateVariables();
215  //TPZBlock<REAL> &block = Mesh()->Block();
216  TPZBlock<STATE> &block = Mesh()->Block();
217  //TPZFMatrix<REAL> &MeshSol = Mesh()->Solution();
218  TPZFMatrix<STATE> &MeshSol = Mesh()->Solution();
219  int maxdep = 0;
220  int in;
221  int64_t iv,jv,idf;
222  STATE coef;
223  for(in=0;in<totalconnects;in++)
224  maxdep = (maxdep < dependenceorder[in]) ? dependenceorder[in] : maxdep;
225  int current_order = maxdep-1;
226  while(current_order >= 0) {
227  for(in=0; in<totalconnects; in++) {
228  if(dependenceorder[in] != current_order) continue;
229  TPZConnect *dfn = &Mesh()->ConnectVec()[connectlist[in]];
230  if(!dfn->HasDependency()) continue;
231  int64_t bl = dfn->SequenceNumber();
232  int nvar = block.Size(bl);
233  int numstate = dfn->NState(); //numstate eh fornecida pelo connect
234  // int numshape = nvar/numstate;
235  TPZConnect::TPZDepend *dep = dfn->FirstDepend();
236  int64_t blpos = block.Position(bl);
237  for(iv=0; iv<nvar; iv++) MeshSol(blpos+iv, 0) = 0.;
238  while(dep) {
239  int64_t depconindex = dep->fDepConnectIndex;
240  TPZConnect &depcon = Mesh()->ConnectVec()[depconindex];
241  int64_t depseq = depcon.SequenceNumber();
242  int numdepvar = block.Size(depseq);
243  int64_t depseqpos = block.Position(depseq);
244  for(iv=0; iv<nvar; iv+=numstate) {
245  for(jv=0; jv<numdepvar; jv+=numstate) {
246  coef = dep->fDepMatrix(iv/numstate,jv/numstate);
247  for(idf=0; idf<numstate; idf++) MeshSol(blpos+iv+idf,0) += coef*MeshSol(depseqpos+jv+idf,0);
248  }
249  }
250  dep = dep->fNext;
251  }
252  }
253  current_order--;
254  }
255  std::list<TPZOneShapeRestraint> mylist = this->GetShapeRestraints();
256  for (std::list<TPZOneShapeRestraint>::iterator it = mylist.begin(); it != mylist.end(); it++)
257  {
258  int64_t connectdest = it->fFaces[0].first;
259  int64_t seqnumdest = Mesh()->ConnectVec()[connectdest].SequenceNumber();
260  int destidf = it->fFaces[0].second;
261  REAL mult = -1./it->fOrient[0];
262 #ifdef PZDEBUG
263  STATE prevval = Mesh()->Block()(seqnumdest,0,destidf,0);
264 #endif
265  Mesh()->Block()(seqnumdest,0,destidf,0) = 0.;
266  for (int i=1; i<4; i++) {
267  int64_t connectindex = it->fFaces[i].first;
268  int64_t seqnum = Mesh()->ConnectVec()[connectindex].SequenceNumber();
269  int idf = it->fFaces[i].second;
270  STATE val = Mesh()->Block()(seqnum,0,idf,0);
271  REAL multorig = it->fOrient[i];
272  Mesh()->Block()(seqnumdest,0,destidf,0) += mult*multorig*val;
273  }
274 #ifdef PZDEBUG
275  STATE finalval = Mesh()->Block()(seqnumdest,0,destidf,0);
276  finalval -= prevval;
277 #endif
278  }
279 }
280 
282  // The mesh can be null, indicating that the element is now unused
283  if(!mesh)
284  LOGPZ_ERROR(logger, "TPZCompEl.SetMesh called with zero pointer.");
285  fMesh = mesh;
286 }
287 
289  if(!fMesh)
290  {
291  std::stringstream sout;
292  sout << __PRETTY_FUNCTION__ << " mesh address " << (void *) fMesh << " this address " << (void *) this;
293  LOGPZ_WARN(logger, sout.str());
294  }
295  return fMesh;
296 }
297 
299 #ifndef NODEBUG
300  if(fMesh) {
301  int64_t connectindex = ConnectIndex(i);
302  if(connectindex >= 0) {
303  return fMesh->ConnectVec()[connectindex];
304  } else {
305  LOGPZ_ERROR(logger, "TPZCompEl::Connect called for noninitialized connect\n");
306  Reference()->Print(cout);
307  const TPZCompEl *cel = (const TPZCompEl *) this;
308  cel->Print(cout);
309  DebugStop();
310  }
311  } else {
312  LOGPZ_FATAL(logger, "Connect called for an element without mesh\n");
313  DebugStop();
314  }
315  static TPZConnect dummy;
316  return dummy;
317 #else
318  return fMesh->ConnectVec()[ConnectIndex(i)];
319 #endif
320 }
321 
322 void TPZCompEl::Print(std::ostream & out) const {
323 
324  out << "\nOutput for a computable element index: " << fIndex;
325  out << "\nfReferenceIndex " << fReferenceIndex;
326  if(this->Reference())
327  {
328  out << "\nCenter coordinate: ";
329  TPZVec< REAL > centerMaster( this->Reference()->Dimension(),0. );
330  TPZVec< REAL > centerEuclid( 3,0.);
331  this->Reference()->CenterPoint(this->Reference()->NSides()-1,centerMaster);
332  this->Reference()->X(centerMaster,centerEuclid);
333  out << centerEuclid;
334  }
335  if(this->Material())
336  {
337  out << "\nMaterial id " << this->Material()->Id() << "\n";
338  }
339  else {
340  out << "\nNo material\n";
341  }
342 
343  out << "Number of connects = " << NConnects();
344  out<< "\nConnect indexes : ";
345  int nod;
346  for(nod=0; nod< NConnects(); nod++)
347  {
348  out << ConnectIndex(nod) << ' ' ;
349  }
350  out << endl;
351 }
352 
353 std::ostream& operator<<(std::ostream &s,TPZCompEl & el){
354  el.Print(s);
355  return s;
356 }
357 
358 void TPZCompEl::PrintSolution(TPZVec<REAL> &point,const char *varname,std::ostream &s) {
359  TPZGeoEl *georef = Reference();
360  TPZMaterial * mat = Material();
361  if(!georef || !mat) {
362  LOGPZ_WARN(logger, "Exiting PrintSolution should not be called for an element which doesnt have a geometric reference or material");
363  Print();
364  return;
365  }
366  int varindex = mat->VariableIndex(varname);
367  int numvar = mat->NSolutionVariables(varindex);
368  if(varindex == -1) {
369  LOGPZ_WARN(logger, "Exiting PrintSolution should not be called for an element which has unknown variable index");
370  return;
371  }
372  TPZManVector<STATE> sol(numvar);
373  sol.Fill(0.);
374  Solution(point,varindex,sol);
375  for(int64_t i=0; i<sol.NElements(); i++) {
376  s << sol[i] << '\t';
377  }
378 }
379 
380 void TPZCompEl::PrintCoordinate(TPZVec<REAL> &point,int CoordinateIndex,std::ostream &s) {
381  TPZGeoEl *georef = Reference();
382  if(!georef) {
383  LOGPZ_WARN(logger,"Exiting PrintCoordinate should not be called on an element which doesnt have a geometric reference");
384  return;
385  }
386  TPZManVector<REAL> X(3);
387  X.Fill(0.);
388  georef->X(point,X);
389  s << X[CoordinateIndex] << '\t';
390 }
391 
392 void TPZCompEl::PrintTitle(const char *varname,std::ostream &s) {
393  TPZMaterial * mat = Material();
394  TPZGeoEl *georef = Reference();
395  if(!georef || !mat) {
396  LOGPZ_WARN(logger,"Exiting PrintTitle should not be called for an element which doesnt have a material");
397  return;
398  }
399  int varindex = mat->VariableIndex(varname);
400  if(varindex == -1) return;
401  int numvar = mat->NSolutionVariables(varindex);
402  if(numvar == 0) return;
403  if(numvar == 1) {
404  s << varname << '\t';
405  return;
406  }
407  for(int i=0; i<numvar; i++) s << varname << '_' << i << '\t';
408 }
409 
410 inline void TPZCompEl::Divide(int64_t index, TPZVec<int64_t> &subindex, int interpolate) {
411  subindex.Resize(0);
412  LOGPZ_WARN(logger,"TPZCompEl::Divide called");
413 }
414 
415 void TPZCompEl::EvaluateError(std::function<void(const TPZVec<REAL> &loc,TPZVec<STATE> &val,TPZFMatrix<STATE> &deriv)> fp,
416  TPZVec<REAL> &/*errors*/, bool store_error) {
417  LOGPZ_WARN(logger, "EvaluateError is called.");
418  DebugStop();
419 }
420 
421 void TPZCompEl::Solution(TPZVec<REAL> &/*qsi*/,int var,TPZVec<STATE> &sol){
422  if(var >= 100) {
423  int ind = Index();
424  if(fMesh->ElementSolution().Cols() > var-100) {
425  sol[0] = fMesh->ElementSolution()(ind,var-100);
426  } else {
427  DebugStop();
428  sol[0] = 0;
429  }
430  } else {
431  sol.Resize(0);
432  }
433 }
434 
435 void TPZCompEl::BuildConnectList(std::set<int64_t> &indepconnectlist,
436  std::set<int64_t> &depconnectlist) {
437  const int ncon = this->NConnects();
438  for(int i = 0; i < ncon; i++) {
439  int64_t conind = ConnectIndex(i);
440  Connect(i).BuildConnectList(conind, indepconnectlist,depconnectlist,*Mesh());
441  }
442  std::list<TPZOneShapeRestraint> mylist = GetShapeRestraints();
443  for (std::list<TPZOneShapeRestraint>::iterator it = mylist.begin(); it != mylist.end(); it++) {
444  for (int i=0; i<4; i++) {
445  int64_t conind = it->fFaces[i].first;
446  TPZConnect &c = Mesh()->ConnectVec()[conind];
447  c.BuildConnectList(conind, indepconnectlist, depconnectlist, *Mesh());
448  }
449  }
450 }
451 
453  int64_t ncon = connectlist.NElements();
454  if (ncon) {
455  std::sort(&connectlist[0], &connectlist[0]+ncon);
456  }
457  TPZAdmChunkVector<TPZConnect> &connectvec = Mesh()->ConnectVec();
458  std::list<TPZOneShapeRestraint> rest = GetShapeRestraints();
459  int64_t nconloc = NConnects();
460  bool hasdependency = false;
461  if (ncon == 0) {
462  connectlist.Resize(nconloc);
463  for(int64_t i = 0; i < nconloc; i++) {
464  connectlist[i] = this->ConnectIndex(i);
465  if (connectlist[i] == -1) continue;
466  if (connectvec[connectlist[i]].HasDependency()) {
467  hasdependency = true;
468  }
469  }
470  if (hasdependency == false && rest.size() == 0) {
471  return;
472  }
473  std::sort(&connectlist[0], &connectlist[0]+nconloc);
474  ncon = nconloc;
475  nconloc = 0;
476  }
477  TPZManVector<int64_t> localcon(nconloc);
478  for(int64_t i = 0; i < nconloc; i++) {
479  localcon[i] = this->ConnectIndex(i);
480  if (connectvec[localcon[i]].HasDependency()) {
481  hasdependency = true;
482  }
483  }
484  if (nconloc) {
485  std::sort(&localcon[0], &localcon[0]+nconloc);
486  }
487 
488  std::set<int64_t> buf;
489  if (ncon > 0 && nconloc > 0)
490  {
491  std::set_union(&connectlist[0],&connectlist[0]+ncon,&localcon[0],&localcon[0]+nconloc,std::inserter(buf, buf.begin()));
492  }
493  else if (ncon > 0)
494  {
495  buf = std::set<int64_t>(&connectlist[0],&connectlist[0]+ncon);
496  }
497  else if(nconloc > 0)
498  {
499  buf = std::set<int64_t>(&localcon[0],&localcon[0]+nconloc);
500  }
501  std::set<int64_t> buf2;
502  std::list<TPZOneShapeRestraint> mylist = GetShapeRestraints();
503  for (std::list<TPZOneShapeRestraint>::iterator it = mylist.begin(); it != mylist.end(); it++) {
504  for (int i=0; i<4; i++) {
505  buf2.insert(it->fFaces[i].first);
506  }
507  }
508  nconloc = NConnects();
509  for(int64_t i = 0; i < nconloc; i++) {
510  TPZConnect &c = Connect(i);
511  if (c.HasDependency()) {
513  while(dep)
514  {
515  buf2.insert(dep->fDepConnectIndex);
516  dep = dep->fNext;
517  }
518  }
519  }
520  TPZConnect::BuildConnectList(buf, buf2, *Mesh());
521  if (buf.size() != connectlist.size())
522  {
523  connectlist.Resize(buf.size());
524  std::copy(buf.begin(), buf.end(), &connectlist[0]);
525  }
526 }
527 
528 void TPZCompEl::BuildConnectList(std::set<int64_t> &connectlist) {
529  int64_t nconloc = NConnects();
530  TPZManVector<int64_t> localcon(nconloc);
531  for(int64_t i = 0; i < nconloc; i++) {
532  localcon[i] = this->ConnectIndex(i);
533  }
534  if (nconloc) {
535  std::sort(&localcon[0], &localcon[0]+nconloc);
536  }
537 
538  std::set<int64_t> buf;
539  if (nconloc > 0)
540  {
541  std::set_union(connectlist.begin(),connectlist.end(),&localcon[0],&localcon[0]+nconloc,std::inserter(buf, buf.begin()));
542  }
543  else
544  {
545  buf = connectlist;
546  }
547  std::set<int64_t> buf2;
548  std::list<TPZOneShapeRestraint> mylist = GetShapeRestraints();
549  for (std::list<TPZOneShapeRestraint>::iterator it = mylist.begin(); it != mylist.end(); it++) {
550  for (int i=0; i<4; i++) {
551  buf2.insert(it->fFaces[i].first);
552  }
553  }
554  for(std::set<int64_t>::iterator it=buf.begin(); it != buf.end(); it++) {
555  TPZConnect &c = Mesh()->ConnectVec()[*it];
556  if (c.HasDependency()) {
558  buf2.insert(dep->fDepConnectIndex);
559  }
560  }
561  TPZConnect::BuildConnectList(buf, buf2, *Mesh());
562  connectlist = buf;
563 }
564 
566  int nconnects = NConnects();
567  int in;
568  for(in=0; in<nconnects; in++) if(Connect(in).HasDependency()){
569  return 1;
570  }
571  if (GetShapeRestraints().size()) {
572  return 1;
573  }
574  return 0;
575 }
576 
577 void TPZCompEl::SetIndex(int64_t index) {
578  fIndex = index;
579  return;
580 }
581 
583  int numeq=0;
584  for (int i=0;i<NConnects(); i++){
585  TPZConnect &df = Connect(i);
586  if(df.HasDependency() || df.IsCondensed() || !df.NElConnected() || df.SequenceNumber() == -1) continue;
587  int64_t seqnum = df.SequenceNumber();
588  numeq += Mesh()->Block().Size(seqnum);
589  }
590  return numeq;
591 }
592 
593 REAL TPZCompEl::CompareElement(int var, char *matname){
594  cout << "TPZCompEl::CompareElement called!\n";
595  LOGPZ_WARN(logger, "CompareElement called!");
596  return 0.;
597 }
598 
599 // TPZCompElSide //
600 
602 {
603  TPZGeoEl *ref = Reference();
604  if(ref)
605  {
606  ref->SetReference(this);
607  }
608 }
609 
612  CalcStiff(ek,ef);
613 }
614 
616  TPZGeoEl *ref = Reference();
617  if (!ref) {
618  LOGPZ_ERROR(logger, "reached a null reference");
619  return (0);
620  }
621 #ifdef LOG4CXX
622  std::stringstream sout;
623  if (logger->isDebugEnabled())
624  {
625  sout << "Obtendo elemento geometrico de referencia para elemento " << Index() << endl;
626  sout << "Impressao dos ancestrais\n";
627  Print(sout);
628  }
629 
630  if (logger->isDebugEnabled())
631  {
632  ref->Print(sout);
633  }
634 #endif
635 
636  TPZStack <TPZGeoEl *> ancestors;
637  ancestors.Push(ref);
638  while(ref->Father()){
639  ancestors.Push(ref->Father());
640  ref = ref->Father();
641 #ifdef LOG4CXX
642  ref->Print(sout);
643 #endif
644  }
645  int j;
646  LOGPZ_DEBUG(logger, sout.str());
647  while(ancestors.NElements()) {
648  TPZGeoEl *larger = ancestors.Pop();
649  for (j=0; j<larger->NSides(); j++){
650  int sidedimension = larger->SideDimension(j);
651  if(sidedimension == 0){
652  continue;
653  }
654  TPZGeoElSide gelside(larger,j);
656  gelside.EqualLevelCompElementList(stack,1,1);
657  // the first geometric element that has a neighbour is a reference element
658  if(stack.NElements()){
659  //cout << " \n \n \n ==================================\n ================================\nElemento PatchReference\n";
660  //aux->Print();
661  return larger;
662  }
663  }
664  }
665  //cout << " \n \n \n ==================================\n ================================\nElemento PatchReference falho\n";
666  //Reference()->Print();
667  LOGPZ_DEBUG(logger, "Exit GetRefElPatch - Element is its own patch");
668  return (Reference());
669 }
670 
672  //O elemento deve ser a envoltura convexa dos seus v�tices
673 // if(!this) {
674 // LOGPZ_ERROR(logger,"TPZCompMesh::MaximumRadiusOfEl() null element");
675 // }
676 
677  int i,j,k;
678  REAL maxdist = 0.0,dist=0.0;
679  TPZVec<REAL> point0(3),point1(3);
680  TPZGeoNode *node0,*node1;
681  int nvertices = Reference()->NNodes();
682  for(i=0;i<nvertices;i++){
683  for(j=i+1;j<nvertices;j++){
684  node0 = Reference()->NodePtr(i);
685  node1 = Reference()->NodePtr(j);
686  for(k=0;k<3;k++){
687  point0[k] = node0->Coord(k);
688  point1[k] = node1->Coord(k);
689  }
690  dist = TPZGeoEl::Distance(point0,point1);
691  if(dist > maxdist) maxdist = dist;
692  }
693  }
694  return maxdist;
695 }
696 
698 
699 // if(!this) LOGPZ_INFO(logger,"TPZCompMesh::LesserEdgeOfEl null element"); ///Jorge 2017 If object exists this can not be NULL
700 
701  int i,j,k;
702  REAL mindist = 1000.0,dist=0.0;
703  TPZVec<REAL> point0(3),point1(3);
704  TPZGeoNode *node0,*node1;
705  int nvertices = Reference()->NNodes();
706  for(i=0;i<nvertices;i++){
707  for(j=i+1;j<nvertices;j++){
708  node0 = Reference()->NodePtr(i);
709  node1 = Reference()->NodePtr(j);
710  for(k=0;k<3;k++){
711  point0[k] = node0->Coord(k);
712  point1[k] = node1->Coord(k);
713  }
714  dist = TPZGeoEl::Distance(point0,point1);
715  if(dist < mindist) mindist = dist;
716  }
717  }
718 
719  return mindist;
720 }
721 
722 
726 void TPZCompEl::Write(TPZStream &buf, int withclassid) const
727 {
729  buf.Write(&fIndex,1);
730  buf.Write(&fReferenceIndex,1);
731 }
732 
736 void TPZCompEl::Read(TPZStream &buf, void *context)
737 {
738  fMesh = dynamic_cast<TPZCompMesh *>(TPZPersistenceManager::GetInstance(&buf));
739  buf.Read(&fIndex,1);
740  buf.Read(&fReferenceIndex,1);
741 }
742 
743 void TPZCompEl::SetOrthogonalFunction(void (*orthogonal)(REAL x,int num,
744  TPZFMatrix<REAL> & phi,TPZFMatrix<REAL> & dphi)) {
746 }
747 
749  if(!fEl) {
750  LOGPZ_WARN(loggerSide, "Exiting Reference - non initialized side element reached");
751  return TPZGeoElSide();
752  }
753  TPZGeoElSide sideel(fEl->Reference(),fSide);
754  return sideel;
755 }
756 
757 void TPZCompElSide::SetSide(int side) {
758  fSide = side;
759 }
760 
762  int onlyinterpolated, int removeduplicates) {
763  TPZGeoElSide georef = Reference();
764  if(!georef.Element()) {
765  LOGPZ_WARN(loggerSide, "Exiting HigherLevelElementList - null reference reached");
766  return;
767  }
768  georef.HigherLevelCompElementList2(elvec,onlyinterpolated,removeduplicates);
769 }
770 
772  int onlyinterpolated, int removeduplicates) {
773  TPZGeoElSide georef = Reference();
774  if(!georef.Exists()) {
775  LOGPZ_WARN(loggerSide, "Exiting EqualLevelElementList - null reference reached");
776  return;
777  }
778  georef.EqualLevelCompElementList(elsidevec,onlyinterpolated,removeduplicates);
779 }
780 
782  int onlyinterpolated, int removeduplicates) {
783  TPZGeoElSide georef = Reference();
784  if(!georef.Exists()) {
785  LOGPZ_INFO(loggerSide, "Entering HigherDimensionElementList - null reference reached");
786  return;
787  }
788  georef.HigherDimensionElementList(elsidevec,onlyinterpolated);
789  if(removeduplicates) RemoveDuplicates(elsidevec);
790 }
791 
792 
794  RemoveConnectDuplicates(elvec);
795  int i, nelem = elvec.NElements();
796  for(i=0; i<nelem; i++) {
797  TPZGeoElSide geli = elvec[i].Reference();
798  if(!geli.Exists()) continue;
799  int j;
800  for(j=i+1; j<nelem; j++) {
801  TPZGeoElSide gelj = elvec[j].Reference();
802  if(!gelj.Exists()) continue;
803  if(geli.NeighbourExists(gelj)) {
804  int k;
805  LOGPZ_ERROR(loggerSide, "case not identified by RemoveConnectDuplicates");
806  for(k=j;k<nelem-1;k++) elvec[k] = elvec[k+1];
807  elvec.Resize(nelem-1);
808  nelem--;
809  j--;
810  }
811  }
812  }
813 }
814 
816  int onlyinterpolated, int removeduplicates) {
817  TPZCompElSide father = LowerLevelElementList(onlyinterpolated);
818  if(father.Exists()) ellist.Push(father);
819  EqualLevelElementList(ellist,onlyinterpolated,removeduplicates);
820  HigherLevelElementList(ellist,onlyinterpolated,removeduplicates);
821 }
822 
823 //retorna o elem. de menor nivel ao qual estou restrito
825  TPZGeoElSide georef = Reference();
826  if(!georef.Exists()) {
827  LOGPZ_WARN(loggerSide, "Exiting LowerLevelElementList - null reference reached");
828  return TPZCompElSide();
829  }
830  return georef.LowerLevelCompElementList2(onlyinterpolated);
831 }
832 
833 void TPZCompElSide::ExpandConnected(TPZStack<TPZCompElSide> &expandvec,int onlyinterpolated) {
834  //insidevec contem todos os elem. de maior nivel que dependem de mim,
835  //obtidos com HigherLevelElementList(..)
836  TPZGeoElSide georef = Reference();
837  if(!georef.Exists()) {
838  LOGPZ_WARN(loggerSide, "Exiting ExpandConnected - null reference reached");
839  return;
840  }
841  TPZStack<TPZCompElSide> highdimsidevec;
842  TPZStack<int> smallsides;
843  TPZCompElSide compside,compsidenext;
844  int64_t exnel = expandvec.NElements();
845  for (int64_t i=0;i<exnel;i++) {
846  TPZGeoElSide ref = expandvec[i].Reference();
847  smallsides.Resize(0);
848  ref.Element()->LowerDimensionSides(ref.Side(),smallsides);
849  for (int k=0;k<smallsides.NElements();k++) {
850  compside = TPZCompElSide(Element(),smallsides[k]);
851  compsidenext = compside.LowerLevelElementList(onlyinterpolated);
852  // TPZGeoElSide smallgeoside = compside.Reference();
853  while(compsidenext.Exists()) {
854  // TPZGeoElSide geoside = compsidenext.Reference();//linha para teste
855  if (compsidenext.Reference().NeighbourExists(this->Reference())) {
856  TPZCompElSide lowid = LowerIdElementList(compside,onlyinterpolated);
857  int64_t l=0;
858  while (l<expandvec.NElements() && lowid.Reference() != expandvec[l].Reference()) l++;
859  if(l == expandvec.NElements()) {
860  expandvec.Push(lowid);
861  }
862  break;
863  }
864  compside = compsidenext;
865  compsidenext = compside.LowerLevelElementList(onlyinterpolated);
866  }
867  }
868  }
869 }
870 
872  if(!expandvec.Element()) {
873  LOGPZ_WARN(loggerSide, "Exiting LowerIdElementList - empty list");
874  return TPZCompElSide();
875  }
876  TPZGeoElSide gelside = expandvec.Reference();
877  TPZStack<TPZGeoElSide> neighbourset;
878  gelside.AllNeighbours(neighbourset);
879  neighbourset.Push(gelside);
880  TPZGeoElSide lowidneigh(gelside);
881  int lowid = gelside.Id();
882  int in = 0, nneigh = neighbourset.NElements()-1;
883  while(in < nneigh) {
884  TPZCompEl *ref = neighbourset[in].Reference().Element();
885  if(neighbourset[in].Id() < lowid && ref && (!onlyinterpolated || dynamic_cast<TPZInterpolatedElement*>(ref) )) {
886  lowidneigh = neighbourset[in];
887  lowid = lowidneigh.Id();
888  }
889  in++;
890  }
891  return lowidneigh.Reference();
892 }
893 
895  int64_t i,k;
896  int64_t nelems = expandvec.NElements();
897  TPZStack<TPZCompElSide> locexpand;
898  for(i=0;i<nelems;i++) locexpand.Push(expandvec[i]);
899  expandvec.Resize(0);
900  for(k=0;k<nelems;k++){
901  //TPZCompEl *kel = locexpand[k].Element();
902  TPZInterpolatedElement *kel = dynamic_cast<TPZInterpolatedElement *> (locexpand[k].Element());
903  if(!kel) continue;
904  int kside = locexpand[k].Side();
905  i=k+1;
906  while(i<nelems){
907  //TPZCompEl *iel = locexpand[i].Element();
908  TPZInterpolatedElement *iel = dynamic_cast<TPZInterpolatedElement *> (locexpand[i].Element());
909  int iside = locexpand[i].Side();
910  //if(iel && kel->ConnectIndex(kside) == iel->ConnectIndex(iside))
911 
912  if(iel)
913  {
914  int a = kel->MidSideConnectLocId(kside);
915  int b = iel->MidSideConnectLocId(iside);
916  int64_t connecta = kel->ConnectIndex(a);
917  int64_t connectb = iel->ConnectIndex(b);
918  if(connecta == connectb)
919  {
920  locexpand[i] = TPZCompElSide();
921  }
922  }
923  i++;
924  }
925  }
926  for(i=0;i<nelems;i++)
927  if(locexpand[i].Element()) expandvec.Push(locexpand[i]);
928 }
929 
932 {
933  if(fEl)
934  {
935  TPZInterpolatedElement *intel = dynamic_cast<TPZInterpolatedElement *>(fEl);
936  if(intel)
937  {
938  int locid = intel->MidSideConnectLocId(fSide);
939  // verify whether there is a connect associated with this side
940  if(locid >= 0)
941  {
942  return intel->ConnectIndex(intel->MidSideConnectLocId(fSide));
943  }
944  else
945  {
946  return -1;
947  }
948  }
949  else
950  {
951  return fEl->ConnectIndex(fSide);
952  }
953  }
954  else return -1;
955 }
956 
957 
960 {
961  TPZMaterial * result = 0;
962  TPZGeoEl *gel = Reference();
963  if(fMesh && gel) result = fMesh->FindMaterial(gel->MaterialId());
964  return result;
965 }
966 
968 bool TPZCompEl::HasMaterial(const std::set<int> &materialids) const
969 {
970  if(!Reference()){
971  return false;
972  }
973  int mat_id = Reference()->MaterialId();
974  return materialids.find(mat_id) != materialids.end();
975 }
976 
985  TPZSolVec &sol, TPZGradSolVec &dsol,TPZFMatrix<REAL> &axes)
986 {
987  std::cout << __PRETTY_FUNCTION__ << " is not implemented - bailing out\n";
988  DebugStop();
989 }
990 
1004  TPZVec<REAL> &normal,
1005  TPZSolVec &leftsol, TPZGradSolVec &dleftsol,TPZFMatrix<REAL> &leftaxes,
1006  TPZSolVec &rightsol, TPZGradSolVec &drightsol,TPZFMatrix<REAL> &rightaxes)
1007 {
1008  std::cout << __PRETTY_FUNCTION__ << " is not implemented - bailing out\n";
1009  DebugStop();
1010 }
1011 
1022  const TPZFMatrix<REAL> &axes, TPZSolVec &sol, TPZGradSolVec &dsol)
1023 {
1024  std::cout << __PRETTY_FUNCTION__ << " is not implemented - bailing out\n";
1025  DebugStop();
1026 }
1027 
1033 {
1034  int ncon = NConnects();
1035  int index = -1;
1036  int count = 0;
1037  for (int ic=0; ic<ncon ; ic++) {
1038  int64_t locconnectindex = ConnectIndex(ic);
1039  TPZConnect &c = fMesh->ConnectVec()[locconnectindex];
1040  if (c.LagrangeMultiplier() && ! c.IsCondensed()) {
1041  index = ic;
1042  count++;
1043  }
1044  }
1045  if (count > 1) {
1046  DebugStop();
1047  }
1048  return index;
1049 }
1050 
1055 {
1056  TPZManVector<STATE,3> result(0);
1057  TPZGeoEl *gel = Reference();
1058  if (!gel) {
1059  return result;
1060  }
1061  TPZCompEl *celnotconst = (TPZCompEl *) this;
1062  TPZMaterial *material = Material();
1063  int nvar = material->NSolutionVariables(var);
1064  TPZIntPoints *intrule = gel->CreateSideIntegrationRule(gel->NSides()-1, 5);
1065  int dim = gel->Dimension();
1066  TPZManVector<REAL,3> xi(dim);
1067  TPZMaterialData data;
1068  TPZFNMatrix<9,REAL> jac(dim,dim),jacinv(dim,dim),axes(dim,3);
1069  REAL detjac;
1070  TPZManVector<STATE,3> sol(nvar);
1071  result.Resize(nvar, 0.);
1072  int npoints = intrule->NPoints();
1073  for (int ip =0; ip<npoints; ip++) {
1074  REAL weight;
1075  intrule->Point(ip, xi, weight);
1076  gel->Jacobian(xi, jac, axes, detjac, jacinv);
1077  celnotconst->Solution(xi, var, sol);
1078  for (int i=0; i <nvar; i++) {
1079  result[i] += weight*fabs(detjac)*sol[i];
1080  }
1081  }
1082  delete intrule;
1083  return result;
1084 }
1085 
1089 TPZVec<STATE> TPZCompEl::IntegrateSolution(const std::string &varname, const std::set<int> &matids)
1090 {
1091  TPZMaterial *mat = Material();
1092  if (mat) {
1093  int id = mat->Id();
1094  if (matids.find(id) != matids.end())
1095  {
1096  int varindex = mat->VariableIndex(varname);
1097  if (varindex != -1) {
1098  return IntegrateSolution(varindex);
1099  }
1100  else
1101  {
1102  // the indicated matid does not support the variable name??
1103  DebugStop();
1104  }
1105  }
1106  }
1107  TPZVec<STATE> result;
1108  return result;
1109 }
1110 
1112  DebugStop();
1113  return 0;
1114 }
1115 
1117 {
1118  if (fIntegrationRule) {
1119  delete fIntegrationRule;
1120  }
1121  fIntegrationRule = intrule;
1122 }
1123 
1125  return Hash("TPZCompEl");
1126 }
1127 
1128 
1130  return StaticClassId();
1131 }
1132 
1135 }
1136 
1138  if (fMesh == NULL || fMesh->Reference() == NULL) return NULL;
1139  return (fReferenceIndex == -1) ? NULL : fMesh->Reference()->ElementVec()[fReferenceIndex];
1140 }
void HigherLevelCompElementList2(TPZStack< TPZCompElSide > &elsidevec, int onlyinterpolated, int removeduplicates)
Returns all connected computational elements which have level higher to the current element if onlyi...
TPZFMatrix< STATE > & ElementSolution()
Access method for the element solution vectors.
Definition: pzcmesh.h:225
virtual TPZVec< STATE > IntegrateSolution(int var) const
Compute the integral of a variable.
Definition: pzcompel.cpp:1054
TPZGeoMesh * Reference() const
Returns a pointer to the geometrical mesh associated.
Definition: pzcmesh.h:209
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
int AllocateNewElement()
Makes more room for new elements.
Definition: pzadmchunk.h:184
static void(* fOrthogonal)(REAL x, int num, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi)
Pointer to function which returns num orthogonal functions at the point x.
Definition: pzshapelinear.h:48
Contains the TPZInt1d, TPZIntTriang, TPZIntQuad, TPZIntCube3D, TPZIntTetra3D, TPZIntPyram3D and TPZIn...
int Position(const int block_diagonal) const
Returns the position of first element block dependent on matrix diagonal.
Definition: pzblock.h:177
virtual int NPoints() const =0
Returns number of points for the cubature rule related.
void SetAllCreateFunctionsContinuous()
Definition: pzcmesh.h:508
virtual void LowerDimensionSides(int side, TPZStack< int > &smallsides) const =0
TPZCompElSide LowerLevelElementList(int onlyinterpolated)
Returns all connected elements which have level lower to the current element.
Definition: pzcompel.cpp:824
Implements computational element and a side. Computational Element.
Definition: pzcompel.h:632
TPZCompEl()
Simple Constructor.
Definition: pzcompel.cpp:117
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
Definition: pzconnect.h:30
TPZGeoNode * NodePtr(int i) const
Returns a pointer to the ith node of the element.
Definition: pzgeoel.cpp:2566
Contains 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.
virtual MElementType Type()
Return the type of the element.
Definition: pzcompel.cpp:195
virtual void PrintCoordinate(TPZVec< REAL > &point, int CoordinateIndex, std::ostream &out)
Prints one coordinate index corresponding to the point to the output stream.
Definition: pzcompel.cpp:380
int MaterialId() const
Returns the material index of the element.
Definition: pzgeoel.h:250
virtual void BuildConnectList(std::set< int64_t > &indepconnectlist, std::set< int64_t > &depconnectlist)
Builds the list of all connectivities related to the element including the connects pointed to by dep...
Definition: pzcompel.cpp:435
virtual void EvaluateError(std::function< void(const TPZVec< REAL > &loc, TPZVec< STATE > &val, TPZFMatrix< STATE > &deriv)> func, TPZVec< REAL > &errors, bool store_error)
Performs an error estimate on the elemen.
Definition: pzcompel.cpp:415
virtual void PrintSolution(TPZVec< REAL > &point, const char *VarName, std::ostream &out)
Prints the solution - sol - for the variable "VarName" at point specified in terms of the master elem...
Definition: pzcompel.cpp:358
REAL Coord(int i) const
Returns i-th coordinate of the current node.
Definition: pzgnode.h:99
TPZCompElSide LowerIdElementList(TPZCompElSide &expandvec, int onlyinterpolated)
Returns the element with lowest id of all direct neighbours of expandvec.
Definition: pzcompel.cpp:871
virtual void SetCreateFunctions(TPZCompMesh *mesh)
Sets create function in TPZCompMesh to create elements of this type.
Definition: pzcompel.cpp:1133
TPZGeoElSide Reference() const
Reference to the geometric element.
Definition: pzcompel.cpp:748
static REAL Distance(TPZVec< REAL > &centel, TPZVec< REAL > &centface)
Definition: pzgeoel.cpp:936
Contains declaration of TPZCompEl class which defines the interface of a computational element...
virtual int Dimension() const =0
Dimension of the element.
virtual int VariableIndex(const std::string &name)
Returns the variable index associated with the name.
Defines PZError.
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef)
Computes the element stifness matrix and right hand side.
Definition: pzcompel.h:794
TPZGeoEl * GetRefElPatch()
Returns the reference geometric element patch. Look for a geometric element which refers to a comput...
Definition: pzcompel.cpp:615
TPZCompElSide LowerLevelCompElementList2(int onlyinterpolated)
return the element/side pair which contains this/side and has a computational element associated ...
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Definition: pzgeoelside.h:83
virtual int NEquations()
Returns the number of equations of the element.
Definition: pzcompel.cpp:582
virtual void PrintTitle(const char *VarName, std::ostream &out)
Prints the variables names associated with the element material.
Definition: pzcompel.cpp:392
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
static int StaticClassId()
Definition: pzcompel.cpp:1124
virtual int NSides() const =0
Returns the number of connectivities of the element.
friend std::ostream & operator<<(std::ostream &s, TPZCompEl &el)
Output device operator.
Definition: pzcompel.cpp:353
static TPZSavable * GetInstance(const int64_t &objId)
Contains TPZBlockDiagonal class which defines block diagonal matrices.
virtual int SideDimension(int side) const =0
Return the dimension of side.
virtual void CalcBlockDiagonal(TPZStack< int64_t > &connectlist, TPZBlockDiagonal< STATE > &block)
Calculates the diagonal block.
Definition: pzcompel.cpp:51
void EqualLevelCompElementList(TPZStack< TPZCompElSide > &elsidevec, int onlyinterpolated, int removeduplicates)
Returns all connected computational elements which have equal level to the current element...
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Definition: pzmanvector.h:426
Contains the TPZTransfer class which implements a rectangular sparse block matrix.
virtual void LoadElementReference()
Loads the geometric element reference.
Definition: pzcompel.cpp:601
static int gOrder
Default interpolation order.
Definition: pzcompel.h:585
Contains TPZShapeLinear class which implements the shape functions of a linear one-dimensional elemen...
void SetMesh(TPZCompMesh *mesh)
Sets the grid of the element.
Definition: pzcompel.cpp:281
void SetSide(int side)
Sets the side index.
Definition: pzcompel.cpp:757
#define LOGPZ_FATAL(A, B)
Define log for fatal errors (cout)
Definition: pzlog.h:95
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...
int64_t ConnectIndex() const
Returns the index of the middle side connect alon fSide.
Definition: pzcompel.cpp:931
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
unsigned char LagrangeMultiplier() const
Access method to return the indication whether the connect is associated with a pressure lagrange mul...
Definition: pzconnect.h:230
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
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
int64_t SequenceNumber() const
Returns the Sequence number of the connect object.
Definition: pzconnect.h:158
void Read(TPZStream &buf, void *context) override
Read the element data from a stream.
Definition: pzcompel.cpp:736
void Push(const T object)
Pushes a copy of the object on the stack.
Definition: pzstack.h:80
void EqualLevelElementList(TPZStack< TPZCompElSide > &elsidevec, int onlyinterpolated, int removeduplicates)
Returns all connected elements which have equal level to the current element This method will not put...
Definition: pzcompel.cpp:771
#define LOGPZ_INFO(A, B)
Define log for informations.
Definition: pzlog.h:89
int64_t fDepConnectIndex
Definition: pzconnect.h:69
void AllNeighbours(TPZStack< TPZGeoElSide > &allneigh)
Returns the set of neighbours which can directly be accessed by the datastructure.
Definition: pzgeoelside.h:333
virtual void Divide(int64_t index, TPZVec< int64_t > &subindex, int interpolate=0)
Divide the computational element. If interpolate = 1, the solution is interpolated to the sub element...
Definition: pzcompel.cpp:410
virtual void LoadSolution()
Loads the solution within the internal data structure of the element.
Definition: pzcompel.cpp:200
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
Structure to reference dependency.
Definition: pzconnect.h:67
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
static void RemoveConnectDuplicates(TPZStack< TPZCompElSide > &expandvec)
Remove entries of the vector which share a connect along the side This should be equivalent to Remove...
Definition: pzcompel.cpp:894
int64_t Index() const
Returns the index of the element within the element vector of the mesh.
Definition: pzgeoel.h:730
virtual bool HasMaterial(const std::set< int > &materialids) const
Verifies if the material associated with the element is contained in the set.
Definition: pzcompel.cpp:968
Contains TPZMatrixclass which implements full matrix (using column major representation).
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...
void HigherDimensionElementList(TPZStack< TPZCompElSide > &elsidevec, int onlyinterpolated)
Pushes all connected computational elements which have higher dimension than the current element/side...
#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
Contains declaration of TPZConnect class which represents a set of shape functions associated with a ...
static void RemoveDuplicates(TPZStack< TPZCompElSide > &elvec)
Will remove elements which are direct neighbours from elvec (and elsides)
Definition: pzcompel.cpp:793
Free store vector implementation.
virtual int ComputeIntegrationOrder() const
Definition: pzcompel.cpp:1111
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
TPZMaterial * FindMaterial(int id)
Find the material with identity id.
Definition: pzcmesh.cpp:297
TPZCompEl * Reference() const
Return a pointer to the element referenced by the geometric element.
Definition: pzgeoel.h:750
void SetIndex(int64_t index)
Sets element index of the mesh fELementVec list.
Definition: pzcompel.cpp:577
int HasDependency() const
Returns whether exist dependecy information.
Definition: pzconnect.h:292
TPZManVector< TNode > fBlock
Nodes vector.
Definition: pzblock.h:218
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
Definition: pzcmesh.h:213
int64_t fReferenceIndex
Index of reference element.
Definition: pzcompel.h:71
int Exists() const
Verifies if the object is non null (initialized)
Definition: pzcompel.h:697
TPZDepend * fNext
Definition: pzconnect.h:71
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
void BuildConnectList(int64_t index, std::set< int64_t > &indepconnectlist, std::set< int64_t > &depconnectlist, TPZCompMesh &mesh)
Builds the list of all connectivities related to ConnectIndex including the connects pointed to by de...
Definition: pzconnect.cpp:509
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Definition: pzlog.h:93
void AddBlock(int64_t i, TPZFMatrix< TVar > &block)
Adds a block to current matrix.
Definition: pzblockdiag.cpp:25
virtual void ComputeSolution(TPZVec< REAL > &qsi, TPZMaterialData &data)
Definition: pzcompel.h:462
Contains declaration of TPZCompMesh class which is a repository for computational elements...
virtual TPZConnect & Connect(int i) const
Returns a pointer to the ith node.
Definition: pzcompel.cpp:298
unsigned char NState() const
Number of state variables associated with the connect.
Definition: pzconnect.h:146
A simple stack.
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.
int64_t Id()
Contains TPZMatrix<TVar>class, root matrix class.
virtual int NNodes() const =0
Returns the number of nodes of the element.
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
Definition: pzelmat.h:30
virtual int NConnects() const =0
Returns the number of nodes of the element.
void ApplyConstraints()
Apply the constraints applied to the nodes by transforming the tangent matrix and right hand side...
Definition: pzelmat.cpp:186
TPZGeoEl * Element() const
Definition: pzgeoelside.h:162
TPZFNMatrix< 50, REAL > fDepMatrix
Definition: pzconnect.h:70
void Initialize(const TPZVec< int > &blocksize)
Initializes current matrix based on blocksize.
Definition: pzblockdiag.cpp:64
virtual std::list< TPZOneShapeRestraint > GetShapeRestraints() const
Return a list with the shape restraints.
Definition: pzcompel.h:432
REAL LesserEdgeOfEl()
Will return the smallest distance between two nodes of the reference element.
Definition: pzcompel.cpp:697
static int idf[6]
T Pop()
Retrieve an object from the stack.
Definition: pzstack.h:87
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
REAL dist(TPZVec< T1 > &vec1, TPZVec< T1 > &vec2)
Definition: pzvec_extras.h:124
virtual void CalcResidual(TPZElementMatrix &ef)
Computes the element right hand side.
Definition: pzcompel.cpp:610
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
Definition: pzcompel.cpp:1137
Implements a geometric node in the pz environment. Geometry.
Definition: pzgnode.h:31
virtual int NSolutionVariables(int var)
Returns the number of variables associated with the variable indexed by var.
TPZCompElSide Reference() const
Returns a pointer to the elementside referenced by the geometric elementside.
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...
MElementType
Define the element types.
Definition: pzeltype.h:52
TPZDepend * FirstDepend()
Definition: pzconnect.h:296
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
static void BuildDependencyOrder(TPZVec< int64_t > &connectlist, TPZVec< int > &DependenceOrder, TPZCompMesh &mesh)
This method builds the vector DependenceOrder which indicates in which order constrained nodes need t...
Definition: pzconnect.cpp:556
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
Contains TPZSolver class which defines a abstract class of solvers which will be used by matrix class...
virtual void Print(std::ostream &out=std::cout) const
Prints element data.
Definition: pzcompel.cpp:322
static int sidedimension[27]
Vector of the dimension for each side.
Definition: tpzcube.cpp:100
int NElConnected() const
Returns fNElConnected.
Definition: pzconnect.h:264
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
int Side() const
Definition: pzgeoelside.h:169
Contains declaration of TPZInterpolatedElement class which implements computational element of the in...
int Id() const
Definition: TPZMaterial.h:170
void Fill(const T &copy, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
Definition: pzvec.h:460
int Exists() const
Definition: pzgeoelside.h:175
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
void SetFree(int index)
Indicate an element as free.
Definition: pzadmchunk.h:199
void Write(TPZStream &buf, int withclassid) const override
Save the element data to a stream.
Definition: pzcompel.cpp:726
Contains the TPZTransform<> class which implements an affine transformation between points in paramet...
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
int NeighbourExists(const TPZGeoElSide &neighbour) const
Returns 1 if neighbour is a neighbour of the element along side.
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
void HigherDimensionElementList(TPZStack< TPZCompElSide > &elsidevec, int onlyinterpolated, int removeduplicates)
Pushes all element/sides which have higher dimension than the current element/side.
Definition: pzcompel.cpp:781
void ConnectedElementList(TPZStack< TPZCompElSide > &elsidevec, int onlyinterpolated, int removeduplicates)
Returns all connected elements to the current element.
Definition: pzcompel.cpp:815
virtual TPZIntPoints * Clone() const =0
Make a clone of the related cubature rule.
virtual ~TPZCompEl()
Simple destructor.
Definition: pzcompel.cpp:173
REAL MaximumRadiusOfEl()
Will return the maximum distance between the nodes of the reference element.
Definition: pzcompel.cpp:671
virtual int PressureConnectIndex() const
Returns the index of the pressure connect.
Definition: pzcompel.cpp:1032
virtual void Print(std::ostream &out=std::cout)
Print all relevant data of the element to cout.
Definition: pzgeoel.cpp:238
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
bool IsCondensed() const
Access method to return the indication whether the connect is condensed or not.
Definition: pzconnect.h:223
virtual REAL CompareElement(int var, char *matname)
This method computes the norm of the difference of a post processed variable with @ the same post pro...
Definition: pzcompel.cpp:593
void ExpandConnected(TPZStack< TPZCompElSide > &expandvec, int onlyinterpolated)
Find the list element/side of the current element restrict nodes and elements.
Definition: pzcompel.cpp:833
TPZGeoEl * Father() const
Computes the normal vectors needed for forming HDiv vector valued shape functions.
Definition: pzgeoel.cpp:2574
virtual int HasDependency()
Returns 1 if the element has at least one dependent node. Returns 0 otherwise.
Definition: pzcompel.cpp:565
int64_t fIndex
Element index into mesh element vector.
Definition: pzcompel.h:67
TPZFMatrix< STATE > & Solution()
Access the solution vector.
Definition: pzcmesh.h:219
static void WritePointer(const TPZSavable *obj, TPZStream *stream)
Implements computational element based on an interpolation space. Computational Element.
Definition: pzintel.h:27
static void SetOrthogonalFunction(void(*orthogonal)(REAL x, int num, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi))
Sets the orthogonal function which will be used throughout the program by default this function is th...
Definition: pzcompel.cpp:743
virtual void Point(int i, TPZVec< REAL > &pos, REAL &w) const =0
Returns i-th point at master element and related weight.
TPZCompMesh * fMesh
Computational mesh to which the element belongs.
Definition: pzcompel.h:64
virtual void Read(bool &val)
Definition: TPZStream.cpp:91
virtual int MidSideConnectLocId(int is) const
Returns the local id of the connect in the middle of the side.
Definition: pzintel.cpp:83
TPZAdmChunkVector< TPZGeoEl * > & ElementVec()
Methods for handling pzlists.
Definition: pzgmesh.h:138