NeoPZ
TPZAgglomerateEl.cpp
Go to the documentation of this file.
1 
6 #include "TPZAgglomerateEl.h"
7 #include "TPZInterfaceEl.h"
8 #include "pzdiscgal.h"
9 #include "pzcompel.h"
10 #include "pzgeoel.h"
11 #include "pzgeoelside.h"
12 #include "pzcmesh.h"
13 #include "pzgmesh.h"
14 #include "pzmanvector.h"
15 #include "pzadmchunk.h"
16 #include "pzquad.h"
17 #include "pzelmat.h"
18 #include "pzgraphel.h"
19 #include "pzgraphelq2dd.h"
20 #include "pzgraphelq3dd.h"
21 #include "pzgraphel1d.h"
22 #include "pzgraphel1dd.h"
23 #include "pztrigraphd.h"
24 #include "pztrigraph.h"
25 #include "pzgraphel.h"
26 #include "pzerror.h"
27 #include "tpzagglomeratemesh.h"
28 #include "pzgraphmesh.h"
29 
30 using namespace std;
31 
32 TPZAgglomerateElement::TPZAgglomerateElement(int nummat,int64_t &index,TPZCompMesh &aggcmesh,TPZCompMesh *finemesh) :
33 TPZRegisterClassId(&TPZAgglomerateElement::ClassId),TPZCompElDisc(aggcmesh,index) {
34 
41  fMotherMesh = finemesh;
42 
43  //<!> Initialized as bignumber because I expect the radius will be lesser than that.
45 
46  //<!>It is set up as zero. It must be initialized after.
47  fNFaces = 0;
48 
49  fMaterialId = nummat;
51 }
52 
55 {
56 }
57 
58 void TPZAgglomerateElement::AddSubElementIndex(TPZCompMesh *aggcmesh,int64_t subel,int64_t father){
59 
60  TPZAgglomerateElement *agg = dynamic_cast<TPZAgglomerateElement *>(aggcmesh->ElementVec()[father]);
61  if(!agg){
62  for(int i=0;i<20;i++)
63  PZError << "TPZAgglomerateElement::AddSubElementIndex null element\n";
64  return;
65  }
66  agg->fIndexes.Push(subel);
67  //a partir daqui os sub-elementos conhecem o aglomerado
68  //depois a malha fina recupera as refer�cias originais
69  // agg->SetReference2(agg->NIndexes()-1);
70 }
71 
73 
74  int indsize = NIndexes();
75  //verificar se os materiais dos sub-elementos s� iguais
76  int i,maxdeg = -1,mat,mat2;//bc degree
77  mat = SubElement(0)->Material()->Id();
78  for(i=1;i<indsize;i++){
79  mat2 = SubElement(i)->Material()->Id();
80  if(mat2 != mat){
81  for(int k=0;k<10;k++)
82  PZError << "TPZAgglomerateElement::TPZAgglomerateElement data error, distinct material\n";
83  DebugStop();
84  }
85  }
86  if(indsize < 1){
87  PZError << "TPZAgglomerateElement::TPZAgglomerateElement empty list\n";
88  return;
89  }
90  //tomando o grau como o m�imo grau dos sub-elementos
91  for(i=0;i<indsize;i++){
92  int deg = dynamic_cast<TPZCompElDisc *>(SubElement(i))->Degree();
93  if(deg > maxdeg) maxdeg = deg;
94  }
95  SetDegree(maxdeg);
96  CenterPoint();
97  REAL cons = NormalizeConst();
98  SetConstC(cons);
99  //caso o conjunto de elementos sendo aglomerado preenchen totalmente
100  //um nico elemento geom�rico esse ser�a referencia
101  // ISTO E PURA PERFUMARIA, O elemento deve funcionar sem isto
102  // TPZGeoEl *ref = CalculateReference();
103  // TPZCompElDisc::SetReference(ref);
104  // if(ref) ref->SetReference(this);
105 }
106 
108  //acumula as regras de integra�o dos elementos aglomerados (descont�uos)
109  int64_t nsubs = NIndexes(),i;
110  for(i=0; i<nsubs; i++){
111  TPZCompElDisc *disc = dynamic_cast<TPZCompElDisc *>(SubElement(i));
112  if(!disc){
113  PZError << "TPZAgglomerateElement::AccumulateIntegrationRule, null index element\n";
114  DebugStop();
115  }
116  //acumule integration rule
117  disc->AccumulateIntegrationRule(degree,point,weight);
118  }
119 }
120 
122 
123  int64_t indsize = NIndexes(),i;
124  TPZVec<REAL> volumes(indsize);
125  for(i=0;i<indsize;i++){
126  // TPZCompEl *cel = FineElement(i);
127  TPZCompElDisc *disc = dynamic_cast<TPZCompElDisc *>(SubElement(i));
128  if(!disc) {
129  volumes[i] = 0.;
130  } else {
131  volumes[i] = disc->VolumeOfEl();
132  }
133  }
134  REAL voltot = 0.0;
135  for(i=0;i<indsize;i++) voltot += volumes[i];
136  REAL centx=0.0,centy=0.0,centz=0.0;
137  for(i=0;i<indsize;i++){
138  //o decont�uo tem fCenterPoint
139  // TPZCompElDisc *cel = dynamic_cast<TPZCompElDisc *>(FineElement(i));
140  TPZCompElDisc *cel = dynamic_cast<TPZCompElDisc *>(SubElement(i));
141  if(!cel) continue;
142  centx += cel->CenterPoint(0) * volumes[i];
143  centy += cel->CenterPoint(1) * volumes[i];
144  centz += cel->CenterPoint(2) * volumes[i];
145  }
146  SetCenterPoint(0,centx/voltot);
147  SetCenterPoint(1,centy/voltot);
148  SetCenterPoint(2,centz/voltot);
149 }
150 
152  for(int i = 0; i < 3; i++)
153  center[i] = fCenterPoint[i];
154 }
155 
157 
162  REAL volume = 0.0;
163  int64_t nindex = NIndexes(),i;
164  for(i=0;i<nindex;i++){
165  TPZCompEl *cel = dynamic_cast<TPZCompElDisc *>(SubElement(i));
166  if(!cel) continue;
167  volume += cel->VolumeOfEl();
168  }
169  return volume;
170 }
171 
172 
174 
175  PZError << "TPZAgglomerateElement::CalcResidual DEVE SER IMPLEMENTADO";
176 }
177 
179 
180  if(Reference()) return TPZCompElDisc::CalcStiff(ek,ef);
181 
182  if(!Material()){
183  cout << "TPZCompElDisc::CalcStiff : no material for this element\n";
184  ek.Reset();
185  ef.Reset();
186  return;
187  }
188  int ncon = NConnects();
189  int dim = Dimension();
190  TPZMaterial *mat = Material();
191  int nstate = mat->NStateVariables();
192  int nshape = NShapeF();
193  TPZBlock<STATE> &block = Mesh()->Block();
194  TPZFMatrix<STATE> &MeshSol = Mesh()->Solution();
195  int64_t numbersol = MeshSol.Cols();
196  int numeq = nshape * nstate;
197  int numloadcases = mat->NumLoadCases();
198 
199 
200  ek.fMat.Redim(numeq,numeq);
201  ef.fMat.Redim(numeq,numloadcases);
202  if(ncon){//pode ser no minimo ncon = 1
203  ek.fBlock.SetNBlocks(ncon);
204  ef.fBlock.SetNBlocks(ncon);
205  ek.fBlock.Set(0,NShapeF()*nstate);
206  ef.fBlock.Set(0,NShapeF()*nstate);
207  }
208  ek.fConnect.Resize(ncon);
209  ef.fConnect.Resize(ncon);
210  for(int i=0;i<ncon;i++){
211  (ef.fConnect)[i] = ConnectIndex(i);
212  (ek.fConnect)[i] = ConnectIndex(i);
213  }
214  if(ncon==0) return;//elemento CC no passa
215  REAL weight;
216  int integ = 2*Degree();
217  TPZStack<REAL> points,weights;
218  //acumula as regras dos obtidos por aglomeracao
219  AccumulateIntegrationRule(integ,points,weights);//integra fi*fj
220  int ip,npoints = weights.NElements();
221 
222  TPZMaterialData data;
223  this->InitMaterialData(data);
224  for(ip=0;ip<npoints;ip++){
225  data.x[0] = points[3*ip];
226  data.x[1] = points[3*ip+1];
227  data.x[2] = points[3*ip+2];
228  weight = weights[ip];
229  ShapeX(data.x,data.phi,data.dphix);
230  //solucao da iteracao anterior
231  for (int64_t is=0; is<numbersol; is++) {
232  data.sol[is].Fill(0.);
233  data.dsol[is].Zero();
234  }
235  for(int in=0; in<ncon; in++) {
236  TPZConnect *df = &Connect(in);
237  int64_t dfseq = df->SequenceNumber();
238  int dfvar = block.Size(dfseq);
239  int64_t pos = block.Position(dfseq);
240  int64_t iv = 0;
241  for(int64_t jn=0; jn<dfvar; jn++) {
242  for (int64_t is=0; is<numbersol; is++) {
243  data.sol[is][iv%nstate] += (STATE)data.phi(iv/nstate,0)*MeshSol(pos+jn,is);
244  for(int d=0; d<dim; d++) data.dsol[is](d,iv%nstate) += (STATE)data.dphix(d,iv/nstate)*MeshSol(pos+jn,is);
245  }
246  iv++;
247  }
248  }
249  Material()->Contribute(data,weight,ek.fMat,ef.fMat);
250  }
251 }
252 
253 
255 
256 #ifdef PZDEBUG
257  int64_t nsubs = NIndexes();
258  if(sub < 0 || sub > nsubs){
259  PZError << "TPZAgglomerateElement::SubElement sub-element out of range\n";
260  return NULL;
261  }
262 #endif
263 
264  return fMotherMesh->ElementVec()[fIndexes[sub]];
265 }
266 
267 
269  //maior distancia entre o ponto interior e os v�tices do elemento
270  REAL maxsub,maxall = -1.0;
271  int64_t nindex = NIndexes(),i;
272  for(i=0;i<nindex;i++){
273  TPZCompElDisc *cel = dynamic_cast<TPZCompElDisc *>(SubElement(i));
274  if(!cel) continue;
275  maxsub = cel->NormalizeConst();
276  if(maxall < maxsub) maxall = maxsub;
277  }
278  return maxall;
279 }
280 
281 
283  if(!Material())
284  {
285  PZError << "\nTPZCompElDisc::CreateMidSideConnect Material nulo\n";
286  DebugStop();
287  }
288 
290  int dim = Dimension();
291  int InterfaceDimension = this->Material()->Dimension() - 1;
292 
293  if(dim == InterfaceDimension){
294  // o atual �um elemento BC
295  SetConnectIndex(0, -1);
296  SetDegree(-1);//=> nshape = 0
297  } else {
298  int nvar = Material()->NStateVariables();
299  int nshape = NShapeF();
300  int order = 0;
301  int64_t newnodeindex = Mesh()->AllocateNewConnect(nshape, nvar, order);
302  SetConnectIndex(0,newnodeindex);
303  TPZConnect &newnod = Mesh()->ConnectVec()[newnodeindex];
304  int64_t seqnum = newnod.SequenceNumber();
305  Mesh()->Block().Set(seqnum,nvar*nshape);
306  Mesh()->ConnectVec()[ConnectIndex()].IncrementElConnected();
307  }
308 
309  return ConnectIndex();
310 }
311 
313  return this->Material()->Dimension();
314 }
315 
316 void TPZAgglomerateElement::Print(std::ostream &out) const {
317 
318  out << "\nTPZAgglomerateElement element : \n";
319  out << "\tComputational mesh : " << fMotherMesh << endl;
320  out << "\tAgglomerate elements indexes : ";
321  int64_t naggel = NIndexes(),i;
322  for(i=0;i<naggel;i++) out << fIndexes[i] << " ";
323  out << "\n\tMaterial id : " << fMotherMesh->ElementVec()[fIndexes[0]]->Material()->Id() << endl
324  << "\tDegrau of interpolation : " << Degree() << endl
325  << "\tConnect index : " << ConnectIndex() << endl
326  << "\tNormalizing constant : " << ConstC() << endl
327  << "\tCenter point of the element : ";
328  for(i=0;i<2;i++) out << TPZCompElDisc::CenterPoint(i) << " , ";
329  out << TPZCompElDisc::CenterPoint(i) << endl;
330 }
331 
333  if(!Reference()) return;
334  int matid = Material()->Id();
335  int nsides = NSides();
336  bool to_postpro = grmesh.Material_Is_PostProcessed(matid);
337  if(dimension == 2 && to_postpro){
338  if(nsides == 9){
339  new TPZGraphElQ2dd(this,&grmesh);
340  return;
341  }
342  if(nsides == 7){
343  new TPZGraphElTd(this,&grmesh);
344  return;
345  }
346  }
347  if(dimension == 3 && to_postpro){
348  new TPZGraphElQ3dd(this,&grmesh);
349  }
350  if(dimension == 1 && to_postpro){
351  new TPZGraphEl1dd(this,&grmesh);
352  }
353 }
354 
356 
357  if(Reference()) return Reference()->NSides();
358  return -1;
359 }
360 
362  //agrupa na lista todos os elementos discontinuos
363  //agrupados no elemento aglomerado atual
364  int64_t indsize = NIndexes(),i;
365  for(i=0;i<indsize;i++){
366  // TPZCompEl *cel = FineElement(i);
367  TPZCompElDisc *cel = dynamic_cast<TPZCompElDisc *>(SubElement(i));
368  if(!cel) continue;
369  if(cel->Type() == EAgglomerate){
370  dynamic_cast<TPZAgglomerateElement *>(cel)->ListOfDiscEl(elvec);
371  } else if(cel->Type() == EDiscontinuous){
372  elvec.Push(cel);//guarda todos os descont�uos
373  } else {
374  PZError << "TPZAgglomerateElement::NSides unknow type element\n";
375  }
376  }
377 }
378 
379 //#warning "TPZAgglomerateElement::IndexesDiscSubEls is inconsistent"
381  //agrupa na lista todos os indexes dos elementos discontinuos
382  //agrupados no elemento aglomerado atual
383  int64_t indsize = NIndexes(),i;
384  for(i=0;i<indsize;i++){
385  // TPZCompEl *cel = FineElement(i);
386  TPZCompEl *cel = SubElement(i);
387  if(cel->Type() == EAgglomerate){
388  dynamic_cast<TPZAgglomerateElement *>(cel)->IndexesDiscSubEls(elvec);
389  } else if(cel->Type() == EDiscontinuous){
390  elvec.Push(cel->Index());//guarda todos os descont�uos
391  } else {
392  PZError << "TPZAgglomerateElement::NSides unknow type element\n";
393  }
394  }
395 }
396 
397 /*
398  void TPZAgglomerateElement::CreateMaterialCopy(TPZCompMesh &aggcmesh){
399 
400  //criando copias dos materiais
401  int nmats = fMotherMesh->MaterialVec().NElements(),i;
402  for(i=0;i<nmats;i++){//achando material de volume
403  TPZMaterial *mat = fMotherMesh->MaterialVec()[i];
404  if(!mat) continue;
405  if(mat->Id() > 0){
406  // if( !strcmp(mat->Name(),"TPZEulerConsLaw") ){
407  // TPZEulerConsLaw *euler = dynamic_cast<TPZEulerConsLaw *>(mat);
408  // mat = euler->NewMaterial();//mat = new TPZEulerConsLaw(*euler);//copia
409  // aggcmesh.InsertMaterialObject(mat);
410  // }
411  TPZDiscontinuousGalerkin * consmat = dynamic_cast<TPZDiscontinuousGalerkin *>(mat);
412  if ( consmat ){
413  mat = consmat->NewMaterial();
414  aggcmesh.InsertMaterialObject(mat);
415  } else {
416  PZError << "TPZAgglomerateElement::CreateMaterialCopy material not defined, implement now (Tiago)!\n";
417  }
418  }
419  }
420  for(i=0;i<nmats;i++){//achando material de CC
421  TPZMaterial *mat = fMotherMesh->MaterialVec()[i];
422  if(!mat) continue;
423  if(mat->Id() < 0){//CC: id < 0
424  TPZBndCond *bc = dynamic_cast<TPZBndCond *>(mat);
425  if(!bc) PZError << "TPZCompElDisc::CreateAgglomerateMesh null bc material\n";
426  int nummat = bc->Material()->Id();//mat. vol.
427  TPZMaterial *material = aggcmesh.FindMaterial(nummat);
428  if(!material) PZError << "TPZCompElDisc::CreateAgglomerateMesh volume material not exists"
429  << " (implement Tiago)\n";
430  TPZBndCond *copy = new TPZBndCond(*bc,material);
431  aggcmesh.InsertMaterialObject(copy);
432  }
433  }
434  }
435  */
436 
437 /*
438  TPZGeoEl *TPZAgglomerateElement::CalculateReference(){
439 
440  //return TPZCompElDisc::Reference();
441  //porenquanto interfaces n� s� aglomeradas
442  //if(Dimension() == gInterfaceDimension) return NULL;
443 
444  TPZStack<TPZCompEl *> elvec;
445  ListOfDiscEl(elvec);
446  int size = elvec.NElements(),i,nlevels = 1;
447  TPZGeoEl *ref0 = elvec[0]->Reference();
448  if(size == 1) return ref0;
449 
450  TPZGeoEl *fat = FatherN(ref0,nlevels);
451  while(fat){
452  for(i=1;i<size;i++){
453  TPZGeoEl *ref = elvec[i]->Reference();
454  if( FatherN(ref,nlevels) != fat ) break;
455  }
456  if( i < size ){
457  nlevels++;
458  fat = FatherN(ref0,nlevels);
459  } else {
460  break;//o pai maior foi achado
461  }
462  }
463  if( fat && size == NSubCompEl(fat) ) return fat;
464  return NULL;
465  }
466 
467  int TPZAgglomerateElement::NSubsOfLevels(TPZGeoEl *father,int nlevels){
468 
469  //quantos sub-elementos father cont� at�nlevels n�eis abaixo dele
470  if(!father) return 0;
471  if(nlevels == 1) return father->NSubElements();
472  int numberels = 0,i,lev = 1;
473  while(lev < nlevels){
474  int nsubs = father->NSubElements();
475  numberels = nsubs;
476  for(i=0;i<nsubs;i++){
477  TPZGeoEl *sub = father->SubElement(i);
478  if(!sub->Reference()) NSubsOfLevels(sub,lev);//s�computacionais
479  numberels += NSubsOfLevels(sub,nlevels-1);
480  }
481  lev++;
482  }
483  return numberels;
484  }
485 
486  int TPZAgglomerateElement::NSubCompEl(TPZGeoEl *father){
487 
488  //quantos sub-elementos computacionais father aglomera
489  if(!father) return 0;
490  int numberels = 0,i,nsubs = father->NSubElements();
491  for(i=0;i<nsubs;i++){
492  TPZGeoEl *sub = father->SubElement(i);
493  if(!sub) return 0;
494  if(!sub->Reference()){
495  numberels += NSubCompEl(sub);//s�computacionais
496  } else {
497  numberels++;
498  }
499  }
500  return numberels;
501  }
502 
503  TPZGeoEl *TPZAgglomerateElement::FatherN(TPZGeoEl *sub,int n){
504 
505  //procura-se o ancestral n n�eis acima de sub
506  if(!sub) return NULL;
507  if(n == 0) return sub;
508  int niv = 1;
509  TPZGeoEl *fat;
510  while( niv < (n+1) ){
511  fat = sub->Father();
512  if(!fat) return NULL;
513  sub = fat;
514  niv++;
515  }
516  return fat;
517  }
518  */
519 
520 //int Level(TPZGeoEl *gel);
522  int nivel,int64_t &numaggl,int dim){
523  //todo elemento de volume deve ser agrupado nem que for para um s�elemento
524  finemesh->SetDimModel(dim);
525  cout << "\nTPZAgglomerateElement::ListOfGroupings para malha 2D\n";
526  cout << "Este metodo somente funciona para agrupar elementos descontinuos \n";
527  int64_t nel = finemesh->NElements(),i;
528  //n� todo index �sub-elemento
529  accumlist.Resize(nel,-1);
530  int mdim = finemesh->Dimension();
531  int sdim = mdim - 1;//dimens� superficial
532  for(i=0;i<nel;i++){
533  TPZCompEl *cel = finemesh->ElementVec()[i];
534  if(!cel) continue;
535  TPZGeoEl *gel = cel->Reference();
536  if(!gel) {
537  cout << "TPZAgglomerateElement::ListOfGroupings nao funciona para esta malha\n";
538  return;
539  }
540  int type = cel->Type(),eldim = cel->Dimension();
541  //agrupando elementos computacionais de volume
542  if(type == EInterface) continue;//interface ser�clonada
543  if(eldim == sdim) continue;//discontinuo BC ser�clonado
544  TPZGeoEl *father = gel->Father();
545  if(!father) continue;
546  while(father && father->Level() != nivel) father = father->Father();//nova
547  if (!father) continue;//nova
548  //if(Level(father) != nivel) continue;//antiga
549  int64_t fatid = father->Id();
550  accumlist[i] = fatid;
551  }
552  //reordena a lista por ordem crescente do pai
553  TPZVec<int64_t> list(accumlist);
554  int64_t j;
555  for(i=0;i<nel;i++){
556  for(j=i+1;j<nel;j++){
557  if(list[i] > list[j]){
558  int aux = list[i];
559  list[i] = list[j];
560  list[j] = aux;
561  }
562  }
563  }
564  //conta o nmero de elementos obtidos por aglomera�
565  numaggl = 0;
566  int act2 = -1;
567  for(i=0;i<nel;i++){
568  int64_t act = list[i];
569  if(act == act2) continue;
570  for(j=i+1;j<nel;j++){
571  int64_t next = list[j];
572  if(next != act2){
573  numaggl++;
574  j = nel;
575  act2 = act;
576  }
577  }
578  }
579  //reformula o index do pai de 0 a nmax
580  TPZVec<int64_t> newlist(accumlist);
581  int64_t newfat = 0;
582  for(i=0;i<nel;i++){
583  int64_t fatid1 = newlist[i];
584  if(fatid1 < 0) continue;
585  accumlist[i] = newfat;
586  newlist[i] = -1;
587  for(j=i+1;j<nel;j++){
588  int64_t fatid2 = newlist[j];
589  if(fatid2 == fatid1){
590  accumlist[j] = newfat;
591  newlist[j] = -1;
592  }
593  }
594  newfat++;
595  }
596  if(newfat != numaggl) cout << "TPZAgglomerateElement::ListOfGroupings nmero de pais n� confere\n";
597  if(!newfat && !numaggl) cout << "TPZAgglomerateElement::ListOfGroupings lista de elementos aglomerados vacia\n";
598 }
599 
601 
602  cout << "TPZAgglomerateElement::Print agrupamento de indexes: saida AGRUPAMENTO.out\n";
603  ofstream out("AGRUPAMENTO.out");
604  int64_t size = listindex.NElements(),i,father = 0;
605  out << "\n\t\t\t* * * AGRUPAMENTO DE INDEXES * * *\n\n";
606  int exists = 0;
607  for(i=0;i<size;i++){
608  if(listindex[i] == father){
609  out << i << ' ';
610  exists = 1;
611  }
612  if( (i+1) == size && exists ){
613  out << "-> father = " << father << endl;
614  i = -1;
615  father++;
616  exists = 0;
617  }
618  }
619 }
620 
621 /*
622  int Level(TPZGeoEl *gel){
623  //retorna o n�el do elemento gel
624  if(!gel) return -1;
625  TPZGeoEl *fat = gel->Father();
626  if(!fat) return 0;
627  int niv = 0;
628  while(fat){
629  fat = fat->Father();
630  niv++;
631  }
632  return niv;
633  }
634  */
635 
637 
638  //projeta a solu�o dos elementos contidos na aglomera�o
639  //no elemento por eles aglomerado
640 
641  int dimension = Dimension();
642  int aggmatsize = NShapeF();
643  int nvar = Material()->NStateVariables();
644  TPZFMatrix<STATE> aggmat(aggmatsize,aggmatsize,0.);
645  TPZFMatrix<STATE> loadvec(aggmatsize,nvar,0.);
646  //verificar que o grau do grande �<= que o grau de cada um dos pequenos ???
647  int64_t size = NIndexes(),i;
648  int mindegree = 1000,coarsedeg = Degree(),maxdegree = 0;
649  for(i=0;i<size;i++){
650  TPZCompElDisc *disc =
651  // dynamic_cast<TPZCompElDisc *>(FineElement(i));
652  dynamic_cast<TPZCompElDisc *>(SubElement(i));
653  int degree = disc->Degree();
654  if(mindegree > degree) mindegree = degree;
655  if(maxdegree < degree) maxdegree = degree;
656  }
657  if(coarsedeg > mindegree){
658  //PZError << "TPZAgglomerateElement::RestrictionOperator incompatible degrees\n";
659  //return;
660  cout << "TPZAgglomerateElement::RestrictionOperator MUDANDO A ORDEM DO ELEMENTO\n";
661  SetDegree(mindegree);
662  coarsedeg = mindegree;
663  }
664  //para integrar uh * fi sobre cada o sub-elemento:
665  //fi base do grande, uh solu�o sobre os pequenos
666  // TPZIntPoints *intrule =
667  // ref->CreateSideIntegrationRule(ref->NSides()-1,maxdegree + coarsedeg);
668  //eventualmente pode criar uma regra para cada sub-elemento dentro do la�
669  //de integra�o para reduzir o nmero de pontos caso os grus s� distintos
670  TPZFMatrix<REAL> aggphix(aggmatsize,1);
671  TPZFMatrix<REAL> aggdphix(dimension,aggmatsize);
672  TPZStack<REAL> accintpoint, accweight;
673  TPZFMatrix<REAL> jacobian(dimension,dimension),jacinv(dimension,dimension);
674  TPZFMatrix<REAL> axes(3,3,0.);
675  TPZManVector<REAL,3> x(3,0.);
676  TPZVec<STATE> uh(nvar);
677  REAL weight;
678  int64_t in,jn,kn,ip,ind;
679  TPZCompElDisc *finedisc;
680 
681  for(ind=0;ind<size;ind++){
682  // finedisc = dynamic_cast<TPZCompElDisc *>(FineElement(ind));
683  finedisc = dynamic_cast<TPZCompElDisc *>(SubElement(ind));
684  finedisc->AccumulateIntegrationRule(maxdegree+coarsedeg,accintpoint,accweight);
685  int64_t npoints = accweight.NElements();
686 
687  for(ip=0;ip<npoints;ip++){
688  for(in=0; in<3; in++) x[in] = accintpoint[3*ip+in];
689  weight = accweight[ip];
690  ShapeX(x,aggphix,aggdphix);
691  finedisc->SolutionX(x,uh);
692  //projetando a solu�o fina no elemento aglomerado
693  //a soma dos detjac dos sub-elementos d�o detjac do grande
694  //a geometria do grande �a soma das geometrias dos pequenos
695  for(in=0; in<aggmatsize; in++) {
696  for(jn=0; jn<aggmatsize; jn++) {
697  //ordem do grande <= a menor ordem dos pequenos
698  // => a regra dos pequenos integra ok
699  aggmat(in,jn) += weight*aggphix(in,0)*aggphix(jn,0);
700  }
701  //a soma das regras dos pequenos cobre a geometria do grande
702  for(kn=0; kn<nvar; kn++) {
703  loadvec(in,kn) += (STATE)weight*(STATE)aggphix(in,0)*uh[kn];
704  }
705  }
706  }//fim for ip
707  }
708  //achando a solu�o restringida
709  aggmat.SolveDirect(loadvec,ELDLt);//ELU
710  //transferindo a solu�o obtida por restri�o
711  int64_t iv=0;
712  TPZBlock<STATE> &block = Mesh()->Block();
713  TPZConnect *df = &Connect(0);
714  int64_t dfseq = df->SequenceNumber();
715  int dfvar = block.Size(dfseq);
716  int64_t pos = block.Position(dfseq);
717  for(int d=0; d<dfvar; d++) {
718  //block(dfseq,0,d,0) = loadvec(iv/nvar,iv%nvar);
719  projectsol(pos+d,0) = loadvec(iv/nvar,iv%nvar);
720  iv++;
721  }
722 }
723 
725 
726 
727  int64_t j,l,nvertices;
728  TPZVec<REAL> point0(3),point1(3);
729  //TPZGeoNode *node0,*node1;
730  //procura-se a maior distancia entre dois nodos do conjunto de elementos
731  //em cada dire�o X, Y ou Z, retorna-se a menor dessas 3 distancias
733  AccumulateVertices(nodes);
734  nvertices = nodes.NElements();
735  REAL maxX=-1.,maxY=-1.,maxZ=-1.;
736  REAL distX,distY,distZ;
737  for(l=0;l<nvertices;l++){
738  for(j=l+1;j<nvertices;j++){
739  //node0 = nodes[l];
740  //node1 = nodes[j];
741  distX = fabs(nodes[l]->Coord(0) - nodes[j]->Coord(0));
742  distY = fabs(nodes[l]->Coord(1) - nodes[j]->Coord(1));
743  distZ = fabs(nodes[l]->Coord(2) - nodes[j]->Coord(2));
744  if(distX > maxX) maxX = distX;
745  if(distY > maxY) maxY = distY;
746  if(distZ > maxZ) maxZ = distZ;
747  }
748  }
749  if(maxX < 1.e-8 && maxY < 1.e-8 && maxZ < 1.e-8) {
750  PZError << "TPZCompElDisc::LesserEdgeOfEl degenerate element\n";
751  }
752  if(maxX < 1.e-8) maxX = 1000000.0;
753  if(maxY < 1.e-8) maxY = 1000000.0;
754  if(maxZ < 1.e-8) maxZ = 1000000.0;
755  maxX = maxX < maxY ? maxX : maxY;
756  maxX = maxX < maxZ ? maxX : maxZ;
757  return maxX;
758 }
759 
760 
761 /*
762  if(0){
763  //procurando a menor distancia entre dois nodos de qualquer um dos sub-elementos???!!!
764  for(i=0;i<size;i++){
765  TPZCompEl *comp = This->MotherMesh()->ElementVec()[elvec[i]];
766  TPZGeoEl *geo = comp->Reference();
767  if(!geo) PZError << "TPZAgglomerateElement::Solution null reference\n";
768  int nvertices = geo->NNodes();
769  for(l=0;l<nvertices;l++){
770  for(j=l+1;j<nvertices;j++){
771  node0 = geo->NodePtr(l);
772  node1 = geo->NodePtr(j);
773  for(k=0;k<3;k++){
774  point0[k] = node0->Coord(k);
775  point1[k] = node1->Coord(k);
776  }
777  dist = TPZGeoEl::Distance(point0,point1);
778  if(dist < mindist) mindist = dist;
779  }
780  }
781  }
782  }
783  return mindist;
784  */
785 
786 
788  int64_t nsubs = fIndexes.NElements();
789  int64_t in;
790  for(in=0; in<nsubs; in++) {
791  TPZCompEl *cel = fMotherMesh->ElementVec()[fIndexes[in]];
792  if(!cel) continue;
793  TPZCompElDisc *cdisc = dynamic_cast<TPZCompElDisc *>(cel);
794  if(!cdisc) continue;
795  cdisc->AccumulateVertices(nodes);
796  }
797 }
798 
799 
800 
802 
816  int64_t nlist = accumlist.NElements();
817  if(numaggl < 1 || nlist < 2){
818  PZError << "TPZCompElDisc::CreateAgglomerateMesh number agglomerate elements"
819  << " out of range\nMALHA AGGLOMERADA N� CRIADA\n";
820  // aggmesh = new TPZCompMesh(*finemesh);
821  return 0;
822  }
823  //TPZFlowCompMesh aggmesh(finemesh->Reference());
824  int64_t index,nel = finemesh->NElements(),nummat,size = accumlist.NElements(),i;
825  TPZAgglomerateMesh *aggmesh = new TPZAgglomerateMesh(finemesh);
826  //copiando materiais para nova malha
827  //finemesh->fMaterials eh copiado para aggmesh
828  finemesh->CopyMaterials(*aggmesh);
829 
830  TPZVec<int64_t> IdElNewMesh(accumlist.NElements());
831  IdElNewMesh.Fill(-1);
832 
833  //criando agrupamentos iniciais
834  for(i=0;i<numaggl;i++){
835  int64_t k = 0;
836  //o elemento de index k tal que accumlist[k] == i vai aglomerar no elemento de index/id i
837  while( accumlist[k] != i && k < size) k++;
838 
839 #ifdef PZDEBUG
840  if(k == size){
841  PZError << "TPZCompElDisc::CreateAgglomerateMesh material not found\n";
842  DebugStop();
843  }
844 #endif
845 
846  nummat = finemesh->ElementVec()[k]->Material()->Id();
847  //criando elemento de index/id i e inserindo na malha aggmesh
848  new TPZAgglomerateElement(nummat,index,*aggmesh,finemesh);
849  IdElNewMesh[k] = index;
850  }
851 
852  //inicializando os aglomerados e clonando elementos BC
853  int meshdim = finemesh->Dimension(),type,eldim;
854  int64_t father;
855  int surfacedim = meshdim-1;
856  for(i=0;i<nel;i++){
857  TPZCompEl *cel = finemesh->ElementVec()[i];
858  if(!cel) continue;
859  father = accumlist[i];
860  type = cel->Type();
861  eldim = cel->Dimension();
862  if(type == EDiscontinuous || type == EAgglomerate){//elemento descont�uo de volume ou aglomerado
863  if(eldim == meshdim){
864  if(father == -1){
865  PZError << "TPZCompElDisc::CreateAgglomerateMesh element null father\n";
866  if(aggmesh) delete aggmesh;
867  return 0;
868  }
869  //incorporando o index do sub-elemento
870  //o elemento de index i vai para o pai father = accumlist[i]
872  IdElNewMesh[i] = father;
873  } else if(eldim == surfacedim){
874  //clonando o elemento descont�uo BC, o clone existira na malha aglomerada
875  TPZCompEl * AggCell = dynamic_cast<TPZCompElDisc *>(cel)->Clone(*aggmesh,index);
876  IdElNewMesh[i] = AggCell->Index();
877  }
878  }
879  }
880 
881  //agora os geom�ricos apontam para os respectivos aglomerados
882  //computacionais recuperaram as refer�cias com TPZCompMesh::LoadReferences()
883  for(i=0;i<nel;i++){
884  TPZCompEl *cel = finemesh->ElementVec()[i];
885  if(!cel) continue;
886  if(cel->Type() == EInterface){//elemento interface
887  TPZInterfaceElement *interf = dynamic_cast<TPZInterfaceElement *>(cel);
888  TPZCompEl *leftel = interf->LeftElement(),*rightel = interf->RightElement();
889  int64_t indleft = leftel->Index();
890  int64_t indright = rightel->Index();
891  if(accumlist[indleft] == -1 && accumlist[indright] == -1){
892  //no m�imo um elemento pode ser BC
893  PZError << "TPZCompElDisc::CreateAgglomerateMesh data error\n";
894  if(aggmesh) delete aggmesh;
895  return 0;
896  }
897  int64_t index;
898  //interfaces com esquerdo e direito iguais n� s� clonadas
899  if(accumlist[indleft] == accumlist[indright]) continue;
900 
901  //clonando o elemento interface: a interface existir�na malha aglomerada
902  //leftel and rightel
903  int64_t leftid = interf->LeftElement()->Index();
904  int64_t leftside = interf->LeftElementSide().Side();
905  leftid = IdElNewMesh[leftid];
906 #ifdef PZDEBUG
907  if (leftid == -1){
908  PZError << "\nLeftid cannot be -1." << endl;
909  }
910 #endif
911  TPZCompElDisc * leftagg = dynamic_cast<TPZCompElDisc*> (aggmesh->ElementVec()[leftid]) ;
912 
913  int64_t rightid = interf->RightElement()->Index();
914  int64_t rightside = interf->RightElementSide().Side();
915  rightid = IdElNewMesh[rightid];
916 #ifdef PZDEBUG
917  if (rightid == -1){
918  PZError << "\nRightid cannot be -1." << endl;
919  }
920 #endif
921  TPZCompElDisc * rightagg = dynamic_cast<TPZCompElDisc*> (aggmesh->ElementVec()[rightid]) ;
922 
923  TPZCompElSide leftcompelside(leftagg, leftside), rightcompelside(rightagg, rightside);
924  interf->CloneInterface(*aggmesh,index, /*leftagg*/leftcompelside, /*rightagg*/rightcompelside);
925 
926  }
927  }
928 
929  nel = aggmesh->ElementVec().NElements();
930 
931  //inizializando elementos aglomerados preenchendo os demais dados
932  for(i=0;i<nel;i++){
933  TPZCompEl *cel = aggmesh->ElementVec()[i];
934  if(cel->Type() == EAgglomerate){//agglomerate element
935  TPZAgglomerateElement *agg = dynamic_cast<TPZAgglomerateElement *>(cel);
936  agg->InitializeElement();
937  //it is set up as zero. It will be computed below.
938  agg->SetNInterfaces(0);
939  }
940  }
941 
942  int dim = aggmesh->Dimension();
943  //<!>Loop over all elements to compute for each interface the distance between interface's center point to volume's center point.
944  //The lessest distance is adopted as the element's inner radius (fInnerRadius).
945  //It is also computed, the number of interfaces of an agglomerate element (fNFaces).
946  for(i = 0; i < nel; i++){
947 
948  TPZCompEl *cel = aggmesh->ElementVec()[i];
949 
950  TPZInterfaceElement * interfaceEl = dynamic_cast<TPZInterfaceElement * > (cel);
951 
952  if (interfaceEl) {
953 
954  TPZCompElDisc * LeftEl = dynamic_cast<TPZCompElDisc*>( interfaceEl -> LeftElement() );
955  TPZCompElDisc * RightEl = dynamic_cast<TPZCompElDisc*>( interfaceEl -> RightElement() );
956 
957  TPZManVector<REAL, 3> InterfaceCenter(3), RefInterfaceCenter(3), LeftCenter(3), RightCenter(3);
958 
959  LeftEl->CenterPoint(LeftCenter);
960  RightEl->CenterPoint(RightCenter);
961 
962 
963  REAL LeftDistance = -1., RightDistance = -1.;
964  int nsides = interfaceEl->Reference()->NSides();
965 
966 
967  for (int irib = 0; irib < nsides; irib++){
968  REAL left = 0., right = 0.;
969  //Getting the node coordinate
970  interfaceEl->Reference()->CenterPoint(irib, RefInterfaceCenter);
971  interfaceEl->Reference()->X(RefInterfaceCenter, InterfaceCenter);
972 
973  for (int isum = 0; isum < dim; isum++)
974  {
975  left += (LeftCenter[isum] - InterfaceCenter[isum]) * (LeftCenter[isum] - InterfaceCenter[isum]);
976  right += (RightCenter[isum] - InterfaceCenter[isum]) * (RightCenter[isum] - InterfaceCenter[isum]);
977  }
978  left = sqrt(left);
979  right = sqrt(right);
980  if(left < LeftDistance || LeftDistance < 0.) LeftDistance = left;
981  if(right < RightDistance || RightDistance < 0.) RightDistance = right;
982  }
983 
984 
985  //if the stored inner radius is bigger than the computed one, the computed one takes its place, because of we are computing the INNER radius.
986  //only Agglomerate must be used here. CompElDisc have Reference()->ElementRadius()
987  TPZAgglomerateElement *LeftAgg = dynamic_cast <TPZAgglomerateElement*> (LeftEl);
988 
989  if (LeftAgg){
990  if ( LeftDistance < LeftAgg->InnerRadius2() )
991  LeftAgg->SetInnerRadius(LeftDistance);
992  LeftAgg ->SetNInterfaces(LeftAgg->NInterfaces() + 1);
993  }
994 
995  TPZAgglomerateElement *RightAgg = dynamic_cast <TPZAgglomerateElement*> (RightEl);
996 
997  if (RightAgg){
998  if ( RightDistance < RightAgg->InnerRadius2() )
999  RightAgg->SetInnerRadius(RightDistance);
1000  RightAgg->SetNInterfaces(RightAgg->NInterfaces() + 1);
1001  }
1002 
1003 
1004  }//end of if
1005 
1006  }//end of loop over elements
1007  return aggmesh;
1008 
1009 }//end of method
1010 
1011 void TPZAgglomerateElement::ComputeNeighbours(TPZCompMesh *mesh, map<TPZCompElDisc *,set<TPZCompElDisc *> > &neighbour) {
1012 
1013  int64_t nelem = mesh->NElements();
1014  int64_t iel;
1015  // int meshdim = mesh->Dimension();
1016  for(iel=0; iel<nelem; iel++) {
1017  TPZCompEl *cel = mesh->ElementVec()[iel];
1018  TPZInterfaceElement *inter = dynamic_cast<TPZInterfaceElement *>(cel);
1019  if(!inter) continue;
1020  TPZCompElDisc * LeftEl = dynamic_cast<TPZCompElDisc*>( inter->LeftElement() );
1021  TPZCompElDisc * RightEl = dynamic_cast<TPZCompElDisc*>( inter->RightElement());
1022  if(LeftEl->Dimension() == RightEl->Dimension()) {
1023  neighbour[LeftEl].insert(RightEl);
1024  neighbour[RightEl].insert(LeftEl);
1025  }
1026  }
1027 }
1028 
1029 
1034  return Hash("TPZAgglomerateElement") ^ TPZCompElDisc::ClassId() << 1;
1035 }
1036 
1037 #ifndef BORLAND
1039 #endif
1040 
1043 void TPZAgglomerateElement::Write(TPZStream &buf, int withclassid) const
1044 {
1045  TPZCompElDisc::Write(buf,withclassid);
1046  TPZAgglomerateMesh *mesh = dynamic_cast<TPZAgglomerateMesh *> (Mesh());
1047  if(!mesh)
1048  {
1049  cout << "TPZAgglomerateEl::Write built from non agglomeratemesh at " << __FILE__ << ":" << __LINE__ << endl;
1050  }
1051  buf.Write(fIndexes);
1052  buf.Write(&fInnerRadius,1);
1053  buf.Write(&fNFaces,1);
1054 }
1055 
1059 void TPZAgglomerateElement::Read(TPZStream &buf, void *context)
1060 {
1061  TPZCompElDisc::Read(buf,context);
1062  TPZAgglomerateMesh *mesh = dynamic_cast<TPZAgglomerateMesh *> (Mesh());
1063  if(!mesh)
1064  {
1065  cout << "TPZAgglomerateEl::Read built from non agglomeratemesh at " << __FILE__ << ":" << __LINE__ << endl;
1066  fMotherMesh = 0;
1067  } else {
1068  fMotherMesh = mesh->FineMesh();
1069  }
1070  buf.Read(fIndexes);
1071  buf.Read(&fInnerRadius,1);
1072  buf.Read(&fNFaces,1);
1073 }
1074 
int64_t NElements() const
Number of computational elements allocated.
Definition: pzcmesh.h:169
void IndexesDiscSubEls(TPZStack< int64_t > &elvec)
Returns a vector of all indexes of the discontinuous elements in cluster.
bool Material_Is_PostProcessed(int matid)
Return a directive if the material id is being postprocessed.
Represents a graphical mesh used for post processing purposes. Post processing.
Definition: pzgraphmesh.h:34
Contains the TPZGraphElTd class which implements the graphical discontinuous triangular element...
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
void Read(TPZStream &buf, void *context) override
Read the element data from a stream.
virtual void AccumulateIntegrationRule(int degree, TPZStack< REAL > &point, TPZStack< REAL > &weight)
virtual void Print(std::ostream &out=std::cout) const override
Prints the features of the element.
Contains the TPZInt1d, TPZIntTriang, TPZIntQuad, TPZIntCube3D, TPZIntTetra3D, TPZIntPyram3D and TPZIn...
REAL CenterPoint(int index) const
int Position(const int block_diagonal) const
Returns the position of first element block dependent on matrix diagonal.
Definition: pzblock.h:177
virtual int NShapeF() const override
Returns the shapes number of the element.
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
Definition: pzmatrix.h:52
void SolutionX(TPZVec< REAL > &x, TPZVec< STATE > &uh)
Computes the solution in function of a point in cartesian space.
Contains declaration of TPZGeoElSide class which represents an element and its side, and TPZGeoElSideIndex class which represents an TPZGeoElSide index.
TPZManVector< REAL, 3 > x
value of the coordinate at the integration point
To export a graphical one dimensional discontinuous element. Post processing.
Definition: pzgraphel1dd.h:22
virtual MElementType Type()
Return the type of the element.
Definition: pzcompel.cpp:195
virtual void InitMaterialData(TPZMaterialData &data)
Initialize a material data and its attributes based on element dimension, number of state variables a...
static TPZAgglomerateMesh * CreateAgglomerateMesh(TPZCompMesh *finemesh, TPZVec< int64_t > &accumlist, int64_t numaggl)
virtual int NConnects() const override
Returns the number of connects.
void SetInnerRadius(REAL InnerRadius) override
Sets the inner radius value.
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
TPZStack< int64_t > fConnect
Vector of pointers to TPZConnect objects.
Definition: pzelmat.h:39
virtual int64_t AllocateNewConnect(int nshape, int nstate, int order)
Returns an index to a new connect.
Definition: pzcmesh.h:693
void CenterPoint()
Computes the center of the mass to clustered elements.
void ProjectSolution(TPZFMatrix< STATE > &projectsol)
TPZFNMatrix< 1000, STATE > fMat
Pointer to a blocked matrix object.
Definition: pzelmat.h:41
Contains declaration of TPZCompEl class which defines the interface of a computational element...
void Read(TPZStream &buf, void *context) override
Read the element data from a stream.
To export a graphical two-dimensional discontinuous element. Post processing.
Definition: pzgraphelq2dd.h:16
To export a graphical three dimensional discontinuous element. Post processing.
Definition: pzgraphelq3dd.h:20
virtual int Dimension() const =0
Dimension of the element.
Defines PZError.
void SetNInterfaces(int nfaces) override
Sets element&#39;s number of interfaces.
void degree(int root, int adj_num, int adj_row[], int adj[], int mask[], int deg[], int *iccsze, int ls[], int node_num)
Definition: rcm.cpp:875
virtual int Dimension() const =0
Returns the integrable dimension of the material.
Contains the TPZGraphEl class which implements the graphical one-, two- and three-dimensional element...
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
Declarates the TPZBlock<REAL>class which implements block matrices.
TPZCompEl * CloneInterface(TPZCompMesh &aggmesh, int64_t &index, TPZCompElSide &left, TPZCompElSide &right) const
Method used in TPZAgglomerateElement::CreateAgglomerateMesh.
int64_t NElements() const
Access method to query the number of elements of the vector.
virtual int NSides() const =0
Returns the number of connectivities of the element.
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)=0
It computes a contribution to the stiffness matrix and load vector at one integration point...
TPZBlock< STATE > fBlock
Block structure associated with fMat.
Definition: pzelmat.h:43
Contains the TPZGraphEl1d class which implements the graphical one dimensional element.
TPZCompMesh * fMotherMesh
Mesh for the clusters which elements are part and from that the current mesh was obtained.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Definition: pzmanvector.h:426
int Dimension() const override
It returns dimension from the elements.
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
TPZStack< int64_t > fIndexes
Indexes into the fine mesh of computational subelements in the clusters by the current.
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
virtual void AccumulateIntegrationRule(int degree, TPZStack< REAL > &point, TPZStack< REAL > &weight) override
Accumulates integration rule to deformed element.
void SetConnectIndex(int, int64_t index) override
Set the index i to node inode.
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 REAL NormalizeConst()
Calculates the normalizing constant of the bases of the element.
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...
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
Definition: pzcompel.cpp:959
void Write(TPZStream &buf, int withclassid) const override
Save the element data to a stream.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
Definition: pzvec.h:373
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
int64_t SequenceNumber() const
Returns the Sequence number of the connect object.
Definition: pzconnect.h:158
void Push(const T object)
Pushes a copy of the object on the stack.
Definition: pzstack.h:80
int Level()
Returns the number of ancestors.
Definition: pzgeoel.cpp:319
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
Contains declaration of.
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
Contains the TPZGraphElQ2dd class which implements the graphical two-dimensional discontinuous elemen...
#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...
TPZCompElSide & LeftElementSide()
Returns left neighbor.
virtual REAL LesserEdgeOfEl()
Computes a measure of the element.
REAL fInnerRadius
Stores the element&#39;s inner radius.
TPZCompMesh * Mesh() const
Return a pointer to the grid of the element.
Definition: pzcompel.cpp:288
Free store vector implementation.
int ClassId() const override
Returns the unique identifier for reading/writing objects to streams.
int Dimension() const
Returns the dimension of the simulation.
Definition: pzcmesh.h:148
int ClassId() const override
Returns the unique identifier for reading/writing objects to streams.
To export a graphical discontinuous triangular element. Post processing.
Definition: pztrigraphd.h:16
virtual int64_t CreateMidSideConnect() override
It creates new conect that it associates the degrees of freedom of the element and returns its index...
virtual void AccumulateVertices(TPZStack< TPZGeoNode *> &nodes) override
Accumulate the vertices of the agglomerated elements.
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
Contains the TPZGraphElT class which implements the graphical triangular element. ...
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
Definition: pzcmesh.h:213
Contains the TPZGraphMesh class which represents a graphical mesh used for post processing purposes...
TPZCompElSide & RightElementSide()
Returns right neighbor.
static void AddSubElementIndex(TPZCompMesh *aggcmesh, int64_t subel, int64_t destind)
Insert the subelement index.
virtual void AccumulateVertices(TPZStack< TPZGeoNode *> &nodes)
Accumulates the vertices of the agglomerated elements.
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
int SetNBlocks(const int num_of_blocks)
Sets number of blocks on diagonal matrix.
Definition: pzblock.cpp:91
Contains declaration of TPZCompMesh class which is a repository for computational 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
static REAL gBigNumber
Big number to penalization method, used for Dirichlet conditions.
Definition: TPZMaterial.h:83
int64_t ConnectIndex(int side=0) const override
Returns the connect index from the element.
void SetDimModel(int dim)
Set de dimension of the domain of the problem.
Definition: pzcmesh.h:139
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
Computes the contribution over an interface between two discontinuous elements. Computational Element...
TPZManVector< REAL, 3 > fCenterPoint
It keeps the interior point coordinations of the element.
Definition: TPZCompElDisc.h:87
virtual TPZCompEl * Clone(TPZCompMesh &mesh) const override
Method for creating a copy of the element.
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
Definition: pzelmat.h:30
static void ComputeNeighbours(TPZCompMesh *mesh, std::map< TPZCompElDisc *, std::set< TPZCompElDisc *> > &neighbours)
void CalcResidual(TPZFMatrix< REAL > &Rhs, TPZCompElDisc *el)
Computes the residual of the solution to father element from clustered subelements.
void Write(TPZStream &buf, int withclassid) const override
void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef) override
Assembles the differential equation to model over the element defined by clustered subelements...
void ListOfDiscEl(TPZStack< TPZCompEl *> &elvec)
Returns a vector of all discontinuous elements in cluster.
int fMaterialId
Material id of the agglomerated element.
Implements a mesh that contains agglomerated elements. Computational Mesh.
int64_t Id() const
Returns the Id of the element.
Definition: pzgeoel.h:223
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef) override
Computes the element stiffness matrix and right hand side.
void CreateGraphicalElement(TPZGraphMesh &grmesh, int dimension) override
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
Definition: pzcompel.cpp:1137
TPZCompEl * LeftElement() const
Returns the left element from the element interface.
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...
TPZCompEl * SubElement(int64_t sub) const
Returns the "sub" subelement.
TPZCompMesh * FineMesh()
Returns a pointer to the associated fine mesh.
REAL VolumeOfEl() override
Returns the volume of the geometric element referenced.
void Reset(TPZCompMesh *mesh=NULL, MType type=Unknown)
Reset the data structure.
Definition: pzelmat.h:59
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
void SetConstC(REAL c)
void InitializeElement()
Initialize the characteristics data of the clustered elements.
int NumLoadCases()
returns the number of load cases for this material object
Definition: TPZMaterial.h:186
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
int64_t NIndexes() const
Returns the number of clustered subelements.
int Side() const
Returns the side index.
Definition: pzcompel.h:688
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
virtual void SetDegree(int degree)
Assigns the degree of the element.
int NInterfaces() override
Retunrs the number of interfaces.
virtual int Degree() const
Returns the degree of interpolation of the element.
void CopyMaterials(TPZCompMesh &mesh) const
Copies the materials of this mesh to the given mesh.
Definition: pzcmesh.cpp:1797
Contains declaration of TPZAgglomerateMesh which implements a mesh that contains agglomerated element...
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.
void SetCenterPoint(int i, REAL x)
Contains the TPZGraphEl1dd class which implements the graphical one dimensional discontinuous element...
virtual REAL VolumeOfEl()
Returns the volume of the geometric element associated.
Definition: pzcompel.h:132
This class implements a discontinuous element (for use with discontinuous Galerkin). Computational Element.
Definition: TPZCompElDisc.h:35
virtual REAL VolumeOfEl() override
Returns the volume of the geometric element associated.
REAL InnerRadius2()
Returns the inner radius value.
virtual void ShapeX(TPZVec< REAL > &X, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphi)
Contains the TPZDiscontinuousGalerkin class which implements the interface for discontinuous Galerkin...
int fNFaces
Stores the number of interfaces of the element.
int Dimension() const override
Returns dimension from the element.
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
TPZSolVec sol
vector of the solutions at the integration point
int NSides()
Returns the number of sides. If all the volumes agglomerated have the same number, it returns this number, else it returns -1.
TPZGeoEl * Father() const
Computes the normal vectors needed for forming HDiv vector valued shape functions.
Definition: pzgeoel.cpp:2574
Contains the TPZGraphElQ3dd class which implements the graphical three dimensional discontinuous elem...
TPZFMatrix< STATE > & Solution()
Access the solution vector.
Definition: pzcmesh.h:219
static void ListOfGroupings(TPZCompMesh *finemesh, TPZVec< int64_t > &accumlist, int nivel, int64_t &numaggl, int dim)
virtual MElementType Type() override
Type of the element.
Implements an interface to register a class id and a restore function. Persistence.
Definition: TPZSavable.h:150
virtual int SolveDirect(TPZFMatrix< TVar > &F, const DecomposeType dt, std::list< int64_t > &singular)
Solves the linear system using Direct methods.
Definition: pzmatrix.cpp:710
REAL NormalizeConst() override
Calculates the normalizing constant of the bases of the element.
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
Implements an agglomerated discontinuous element. Computational Element.
virtual void Read(bool &val)
Definition: TPZStream.cpp:91
REAL ConstC() const
It returns the constant that normalizes the bases of the element.