NeoPZ
TPZNLMultGridAnalysis.cpp
Go to the documentation of this file.
1 
6 #include <math.h> // for fabs
7 #include <stdio.h> // for NULL
8 #include <string.h> // for strcmp
9 #include <time.h> // for clock, CLOCKS_PER_SEC
10 #include <iostream> // for operator<<, string, basic_ostream, cout
11 #include <map> // for map, map<>::iterator, __map_iterator
12 #include <utility> // for pair
13 #include "TPZCompElDisc.h" // for TPZCompElDisc
14 #include "pzadmchunk.h" // for TPZAdmChunkVector
15 #include "TPZChunkVector.h" // for TPZChunkVector
16 #include "pzcmesh.h" // for TPZCompMesh
17 #include "pzcompel.h" // for TPZCompEl
18 #include "pzconslaw.h" // for TPZConservationLaw
19 #include "pzdxmesh.h" // for TPZDXGraphMesh
20 #include "pzvtkmesh.h" // for TPZDXGraphMesh
21 #include "pzeltype.h" // for MElementType::EDiscontinuous, MEleme...
22 #include "pzerror.h" // for PZError
23 #include "pzflowcmesh.h" // for TPZFlowCompMesh
24 #include "pzfunction.h" // for TPZFunction
25 #include "pzgeoel.h" // for TPZGeoEl
26 #include "pzgmesh.h" // for TPZGeoMesh
27 #include "TPZMaterial.h" // for TPZMaterial
28 #include "pzskylstrmatrix.h" // for TPZSkylineStructMatrix
29 #include "pzsolve.h" // for TPZMatrixSolver, TPZSolver, TPZMatri...
30 #include "pzstepsolver.h" // for TPZStepSolver
31 #include "pzstrmatrix.h" // for TPZStructMatrixOR
32 #include "pztransfer.h" // for TPZTransfer
33 #include "pzvec.h" // for TPZVec
34 #include "tpzagglomeratemesh.h" // for TPZAgglomerateMesh
35 #include "tpzautopointer.h" // for TPZAutoPointer
36 #include "TPZAgglomerateEl.h" // for TPZAgglomerateElement
37 using namespace std;
38 
39 
41 
42  if( index < 0 || index >= fMeshes.NElements() )
43  PZError << "TPZNonLinMultGridAnalysis::IMesh mesh index out of range\n";
44  return fMeshes[index];
45 }
46 
48 TPZAnalysis(cmesh), fBegin(0), fInit(0) {
49  cmesh->SetName("* * * MALHA INICIAL * * *");
50  fMeshes.Push(cmesh);
51  TPZStepSolver<STATE> solver;
52  solver.SetDirect(ELDLt);
53  TPZMatrixSolver<STATE> *clone = dynamic_cast<TPZMatrixSolver<STATE> *>(solver.Clone());
54  SetSolver(*clone);
55  fSolvers.Push(clone);
58 }
59 
61  while (fMeshes.NElements()) delete fMeshes.Pop();
62  while(fSolutions.NElements()) delete fSolutions.Pop();
63  while(fSolvers.NElements()) delete fSolvers.Pop();
64  while(fPrecondition.NElements()) delete fPrecondition.Pop();
65 }
66 
67 
69 
72  cout << "TPZNonLinMultGridAnalysis::AppendMesh can only be called after solving the coarse mesh\n";
73  return;
74  }
75  fMeshes.Push(mesh);
76 }
77 
79 
80  if(fMeshes.NElements() == 1) {
81  cout << "TPZNonLinMultGridAnalysis cannot delete the root mesh, sorry\n";
82  return 0;
83  }
84  if(fSolutions.NElements() == fMeshes.NElements()) delete fSolutions.Pop();
85  delete fSolvers.Pop();
89  return fMeshes.Pop();
90 }
91 
93  int levelnumbertogroup){
94 
95  TPZVec<int64_t> accumlist;
96  int dim = finemesh->Dimension();
97  int64_t numaggl;
98  TPZAgglomerateElement::ListOfGroupings(finemesh,accumlist,levelnumbertogroup,numaggl,dim);
99  TPZCompMesh *aggmesh;
100  aggmesh = TPZAgglomerateElement::CreateAgglomerateMesh(finemesh,accumlist,numaggl);
101  return aggmesh;
102 }
103 
104 TPZCompMesh *TPZNonLinMultGridAnalysis::UniformlyRefineMesh(TPZCompMesh *coarcmesh,int levelnumbertorefine,int setdegree) {
105 
106  if(levelnumbertorefine < 1) return coarcmesh;
107  TPZGeoMesh *gmesh = coarcmesh->Reference();
108  if(!gmesh) {
109  cout << "TPZMGAnalysis::UniformlyRefineMesh mesh with null reference, cancelled method\n";
110  return 0;
111  }
112  cout << "\nTPZNonLinMultGridAnalysis::UniformlyRefineMesh uniforme division of coarcmesh,"
113  << " levels to be fine = " << levelnumbertorefine << endl;
114 
115  gmesh->ResetReference();
116  TPZCompMesh *finemesh;
117 
118  finemesh = new TPZFlowCompMesh(gmesh);
119 
120  std::map<int, TPZMaterial * >::iterator m;
121  for(m=coarcmesh->MaterialVec().begin(); m != coarcmesh->MaterialVec().end(); m++) {
122  TPZMaterial * mat = m->second;
123  if(!mat) continue;
124  mat->Clone(finemesh->MaterialVec());
125  }
126  TPZAdmChunkVector<TPZCompEl *> &elementvec = coarcmesh->ElementVec();
127  int64_t el,nelem = elementvec.NElements();
128  for(el=0; el<nelem; el++) {
129  TPZCompEl *cel = elementvec[el];
130  if(!cel) continue;
131  if(cel->Type() == EAgglomerate){
132  PZError << "TPZNonLinMultGridAnalysis::UniformlyRefineMesh mesh error,"
133  << " not refined\n";
134  return new TPZCompMesh(NULL);
135  }
136  if(cel->Type() != EDiscontinuous) continue;
137  TPZCompElDisc *disc = dynamic_cast<TPZCompElDisc *>(cel);
138  int degree = disc->Degree();
139 
140  TPZGeoEl *gel = disc->Reference();
141  if(!gel) {
142  cout << "TPZMGAnalysis::UniformlyRefineMesh encountered an element without"
143  << " geometric reference\n";
144  continue;
145  }
146  TPZStack<TPZGeoEl *> sub,sub1;
147  //GetRefinedGeoEls(geo,sub);
148  int lev = 0,k,nsons,i;
149  gel->Divide(sub);
150  lev++;
151  while(lev < levelnumbertorefine){
152  int nsubs = sub.NElements();
153  TPZVec<TPZGeoEl *> copy(sub);
154  sub.Resize(0);
155  for(i=0;i<nsubs;i++){
156  copy[i]->Divide(sub1);
157  nsons = sub1.NElements();
158  for(k=0;k<nsons;k++) sub.Push(sub1[k]);
159  }
160  lev++;
161  }
162  int nsub = sub.NElements(),isub;
163  int64_t index;
164  //o construtor adequado ja deveria ter sido definido
165  for(isub=0; isub<nsub; isub++) {
166  disc = dynamic_cast<TPZCompElDisc *>(finemesh->CreateCompEl(sub[isub],index));
167  if(setdegree > 0 && setdegree != degree) disc->SetDegree(degree);
168  //caso setdegree < 0 preserva-se o grau da malha inicial
169  }
170  }
171  finemesh->AdjustBoundaryElements();
172  return finemesh;
173 }
174 
176  //APLICAR ESTA FUN�O ANTES DE GERAR A MALHA COM O DX
177 
178  //caso o aglomerado tem refer�cia anulam-se as referencias
179  //dos sub-elementos 'geom�ricos' aglomerados por ele
180  //caso contr�io deixa-se um nico elemento geom�rico
181  //apontando para o aglomerado
182  //isso forma uma parti�o da malha atual por elementos computacionais
183 
184  int64_t nel = aggcmesh->NElements(),i;
185  TPZCompMesh *finemesh;
186  //n� todo index �sub-elemento
187  for(i=0;i<nel;i++){
188  TPZCompEl *cel = aggcmesh->ElementVec()[i];
189  if(!cel) continue;
190  if(cel->Type() == EInterface) continue;
191  if(cel->Type() == EDiscontinuous) continue;
192  TPZMaterial * mat = cel->Material();
193  if(!mat) PZError << "TPZNonLinMultGridAnalysis::ResetReference null material\n";
194  if(mat->Id() < 0) continue;
195  TPZGeoEl *gel = cel->Reference();
196  TPZAgglomerateElement *agg = dynamic_cast<TPZAgglomerateElement *>(cel);
197  if(!agg)
198  PZError << "TPZNonLinMultGridAnalysis::ResetReference not agglomerate element\n";
199  finemesh = agg->MotherMesh();
200  if(!finemesh)
201  PZError << "TPZNonLinMultGridAnalysis::ResetReference null fine mesh\n";
202  TPZStack<int64_t> vec;
203  agg->IndexesDiscSubEls(vec);
204  int64_t i,size = vec.NElements();
205  if(!size) PZError << "main::ResetReference error1\n";
206  TPZCompEl *sub0 = finemesh->ElementVec()[vec[0]],*sub;
207  for(i=1;i<size;i++){
208  sub = finemesh->ElementVec()[vec[i]];
209  TPZGeoEl *ref = sub->Reference();
210  if(!ref) PZError << "main::ResetReference error2\n";
211  ref->SetReference(NULL);
212  //o aglomerado n� tem geom�rico direto associado
213  //agora existe um nico geom�rico apontando
214  //para ele
215  }
216  if(gel){
217  TPZGeoEl * ref0 = sub0->Reference();
218  if(!ref0) PZError << "main::ResetReference error2\n";
219  ref0->SetReference(NULL);
220  //o aglomerado tem geom�rico direto associado
221  //e esse aponta para ele
222  }
223  }
224 }
225 
227 
228  int64_t nel = aggcmesh->NElements(),i;
229  //TPZCompMesh *finemesh;
230  //n� todo index �sub-elemento
231  for(i=0;i<nel;i++){
232  TPZCompEl *cel = aggcmesh->ElementVec()[i];
233  if(!cel) continue;
234  if(cel->Type() == EInterface) continue;
235  if(cel->Type() == EDiscontinuous) continue;
236  TPZMaterial * mat = cel->Material();
237  if(!mat) PZError << "TPZNonLinMultGridAnalysis::SetReference null material\n";
238  if(mat->Id() < 0) continue;
239  TPZAgglomerateElement *agg = dynamic_cast<TPZAgglomerateElement *>(cel);
240  if(!agg)
241  PZError << "TPZNonLinMultGridAnalysis::SetReference not agglomerate element\n";
242  TPZStack<int64_t> elvec;
243  agg->IndexesDiscSubEls(elvec);
244  //os computacionais da malha fina apontam para os respectivos geometricos
245  //os geometricos deveram apontar para o agglomerado que o agrupa;
246  //si existe um geometrico tal que as referencias dos agrupados no aglomerado
247  //formam uma particao unitaria desse entao esse geometrico ja
248  //aponta para esse aglomerado
249  int64_t indsize = elvec.NElements(),k;
250  for(k=0;k<indsize;k++){
251  TPZCompEl *cel = agg->MotherMesh()->ElementVec()[elvec[k]];
252  if(!cel){
253  PZError << "TPZNonLinMultGridAnalysis::SetReference null sub-element\n";
254  continue;
255  }
256  TPZGeoEl *ref = cel->Reference();
257  ref->SetReference(agg);
258  }
259  }
260 }
261 
262 void TPZNonLinMultGridAnalysis::CoutTime(clock_t &start,const char *title){
263  clock_t end = clock();
264  cout << title << endl;
265  clock_t segundos = ((end - start)/CLOCKS_PER_SEC);
266  cout << segundos << " segundos" << endl;
267  cout << segundos/60.0 << " minutos" << endl << endl;
268 }
269 
271 
272  TPZFlowCompMesh *fm = dynamic_cast<TPZFlowCompMesh *>(CompMesh);
273  TPZConservationLaw *law = dynamic_cast<TPZConservationLaw *>(mat);
274  REAL timestep = law->TimeStep();
275  if(timestep <= 0.0){
276  fFunction(mat,CompMesh);
277  return;
278  }
279  //int nstate = mat->NStateVariables();
280 
281  REAL maxveloc;//,gama = 1.4;
282  //maxveloc = fm->MaxVelocityOfMesh(nstate,gama);
283  maxveloc = fm->MaxVelocityOfMesh();
284  REAL deltax = CompMesh->LesserEdgeOfMesh();
285  //REAL deltax = CompMesh->DeltaX();
286  //REAL deltax = CompMesh->MaximumRadiusOfEl();
287  int degree = CompMesh->GetDefaultOrder();
288  law->SetTimeStep(maxveloc,deltax,degree); //JorgeC
289 }
290 
292 
293  //pelo menos duas iteracoes para calcular o residuo
294  if(numiter <= 1) numiter = 2;
295  TPZCompMesh *anmesh = an.Mesh();
296  int iter = 0;
297  cout << "PZAnalysis::SmoothingSolutionTest beginning of the iterative process iterac� = " << iter << endl;
298  an.Solution().Zero();
299  SetDeltaTime(anmesh,mat);
300  an.Run();
301  cout << "TPZNonLinMultGridAnalysis::SmoothingSolution iteration = " << ++iter << endl;
302  an.LoadSolution();
303  mat->SetForcingFunction(0);
304  REAL normsol = Norm(Solution());
305  TPZFMatrix<STATE> rhsim1 = an.Rhs();
306 
307  while(iter < numiter && normsol < tol) {
308 
309  an.Solution().Zero();
310  SetDeltaTime(anmesh,mat);
311  // rhsim1 = an.Rhs();//guarda o anterior res�uo
312  an.Run();
313  an.LoadSolution();
314  cout << "TPZNonLinMultGridAnalysis::SmoothingSolution iteracao = " << ++iter << endl;
315  normsol = Norm(Solution());
316  }
317  if(iter < numiter){
318  cout << "\nTPZNonLinMultGridAnalysis::SmoothingSolution the iterative process stopped"
319  << " due the great norm of the solution, norm solution = " << normsol << endl;
320  }
321  an.LoadSolution();
322  rhs = an.Rhs() - rhsim1;//ltimo residuo - res�uo anterior
323 }
324 
325 
327  TPZAnalysis &an,int marcha,const std::string &dxout) {
328  if(numiter <= 0){
329  cout << "PZAnalysis::SmoothingSolution NENHUMA RESOLU�O EFETUADA\n";
330  an.Solution().Zero();
331  return;
332  }
333  if(marcha){
334  //saida com o DX
335  SmoothingSolution2(tol,numiter,mat,an,marcha,dxout);
336  return;
337  }
338  TPZCompMesh *anmesh = an.Mesh();
339  cout << "PZAnalysis::SmoothingSolutionTest beginning of the iterative process\n";
340  int iter = 0;
341  an.Solution().Zero();
342  SetDeltaTime(anmesh,mat);
343  an.Run();
344  cout << "TPZNonLinMultGridAnalysis::SmoothingSolution iteration = " << ++iter << endl;
345  an.LoadSolution();
346  mat->SetForcingFunction(0);
347  REAL normsol = Norm(Solution());
348 
349  while(iter < numiter && normsol < tol) {
350 
351  an.Solution().Zero();
352  SetDeltaTime(anmesh,mat);
353  an.Run();
354  an.LoadSolution();
355  cout << "TPZNonLinMultGridAnalysis::SmoothingSolution iteracao = " << ++iter << endl;
356  normsol = Norm(Solution());
357  }
358  if(iter < numiter){
359  cout << "\nTPZNonLinMultGridAnalysis::SmoothingSolution the iterative process stopped"
360  << " due the great norm of the solution, norm solution = " << normsol << endl;
361  }
362  an.LoadSolution();
363 }
364 
366  TPZAnalysis &an,int marcha,const std::string &dxout) {
367 
368  TPZVec<std::string> scalar(1),vector(0), tensor(0);
369  scalar[0] = "pressure";
370  int dim = mat->Dimension();
371  TPZCompMesh *anmesh = an.Mesh();
372 // ResetReference(anmesh);//retira refer�cias para criar graph consistente
373  std::set<int> matids;
374  if (!mat) {
375  DebugStop();
376  }
377  matids.insert(mat->Id());
378  TPZVTKGraphMesh graph(anmesh, dim, matids, scalar, vector, tensor);
379 // TPZDXGraphMesh graph(anmesh,dim,mat,scalar,vector);
380 // SetReference(anmesh);//recupera as refer�cias retiradas
381  graph.SetFileName(dxout);
382  int resolution = 0;
383  graph.SetResolution(resolution);
384  graph.DrawMesh(dim);
385  int iter = 0,draw=0;
386  fInit = clock();
387  an.Solution().Zero();
388  fBegin = clock();
389  SetDeltaTime(anmesh,mat);
390  cout << "TPZNonLinMultGridAnalysis::SmoothingSolution iteration = " << ++iter
391  << " general time 0\n";
392  an.Run();
393  CoutTime(fBegin,"TPZNonLinMultGridAnalysis:: Fim system solution first iteration");
394  fBegin = clock();
395  an.LoadSolution();
396  REAL time = (REAL)iter;
397  graph.DrawSolution(draw++,time);
398  fBegin = clock();
399  mat->SetForcingFunction(0);
400  REAL normsol = Norm(Solution());
401 
402  while(iter < numiter && normsol < tol) {
403 
404  fBegin = clock();
405  an.Solution().Zero();
406  SetDeltaTime(anmesh,mat);
407  an.Run();
408  CoutTime(fBegin,"TPZNonLinMultGridAnalysis:: Fim system solution actual iteration");
409  CoutTime(fInit,"TPZNonLinMultGridAnalysis:: accumulated time");
410  fBegin = clock();
411  an.LoadSolution();
412  cout << "TPZNonLinMultGridAnalysis::SmoothingSolution iteracao = " << ++iter << endl;
413  normsol = Norm(Solution());
414  if( REAL(iter) / REAL(marcha) == draw || marcha == 1){
415  time = (REAL)iter;
416  graph.DrawSolution(draw++,time);
417  }
418  }
419  if(iter < numiter){
420  cout << "\nTPZNonLinMultGridAnalysis::SmoothingSolution the iterative process stopped"
421  << " due the great norm of the solution, norm solution = " << normsol << endl;
422  }
423  an.LoadSolution();
424  CoutTime(fInit,"TPZNonLinMultGridAnalysis::SmoothingSolution general time of iterative process");
425  time = (REAL)iter;
426  graph.DrawSolution(draw++,time);
427  ofstream out("SmoothingSolution2_ANALYSIS.out");
428  an.Print("\n\n* * * SOLUCAO PELO ANALYSIS: ltima solu�o * * *\n\n",out);
429  out.flush();
430  out.close();
431 }
432 
434  const std::string &decompose,TPZFMatrix<STATE> &res){
435 
437  ofstream out("CalcResidual_STIFF.out");
438  stiff->Print("\n\n\t\t\t* * * MATRIZ DE RIGIDEZ * * *\n\n",out);
439  int dim = stiff->Dim(),i,j;
440  res.Redim(dim,1);
441  //c�culo de stiff * solution
442  TPZFMatrix<STATE> tsup(dim,1),diag(dim,1),tinf(dim,1);
443 
444  if( !strcmp(decompose.c_str() , "LDLt") ) {
445  //tri�gulo superior
446  for(i=0;i<dim;i++){
447  STATE sum = 0.;
448  for(j=i+1;j<dim;j++){
449  sum += stiff->GetVal(i,j) * sol(j,0);
450  }
451  tsup(i,0) = sol(i,0) + sum;
452  }
453  //diagonal
454  for(i=0;i<dim;i++) diag(i,0) = stiff->GetVal(i,i) * tsup(i,0);
455  //tri�gulo inferior
456  for(i=0;i<dim;i++) {
457  STATE sum = 0.;
458  for(j=0;j<i;j++) {
459  sum += stiff->GetVal(i,j) * diag(j,0);
460  }
461  res(i,0) = sum + diag(i,0);
462  }
463 
464  if(0) {
465  ofstream out("MATRIZES_DECOMPOSI�O.out");
466  sol.Print("\n* * * sol * * *\n",out);
467  tsup.Print("\n* * * tsup * * *\n",out);
468  diag.Print("\n* * * diag * * *\n",out);
469  tinf.Print("\n* * * tinf * * *\n",out);
470  //rhs.Print("\n* * * rhs * * *\n",out);
471  res.Print("\n* * * res * * *\n",out);
472  stiff->Print("\n* * * stiff * * *\n",out);
473  out.flush();
474  out.close();
475  }
476  //cout << "\nNorma do res�uo: " << Norm(res) << endl;//ORIGINAL
477  } else {
478  cout << "TPZNonLinMultGridAnalysis::CalcResidual Calculation of the residue for this"
479  << " decomposition is not implemented, implements now!\n";
480  }
481 }
482 
483 
485  TPZFMatrix<STATE> &res,TPZAnalysis &an,const std::string &decompose){
486 
488  ofstream out("CalcResidual_STIFF.out");
489  stiff->Print("\n\n\t\t\t* * * MATRIZ DE RIGIDEZ * * *\n\n",out);
490  int dim = stiff->Dim(),i,j;
491  //c�culo de stiff * solution
492  TPZFMatrix<STATE> tsup(dim,1),diag(dim,1),tinf(dim,1);
493 
494  if( !strcmp(decompose.c_str() , "LDLt") ){
495  //tri�gulo superior
496  for(i=0;i<dim;i++){
497  STATE sum = 0.;
498  for(j=i+1;j<dim;j++){
499  sum += stiff->GetVal(i,j);
500  }
501  tsup(i,0) = sol(i,0) + sum;
502  }
503  //diagonal
504  for(i=0;i<dim;i++) diag(i,0) = stiff->GetVal(i,i) * tsup(i,0);
505  //tri�gulo superior
506  for(i=0;i<dim;i++){
507  STATE sum = 0.;
508  for(j=0;j<i;j++){
509  sum += stiff->GetVal(i,j) * diag(i,0);
510  }
511  tinf(i,0) = sum + diag(i,0);
512  }
513  //diferenca (f - stiff * x)
514  //TPZFMatrix<STATE> rhs = an.Rhs();
515  for(i=0;i<dim;i++) res(i,0) = anres.GetVal(i,0) - tinf(i,0);
516  sol.Print("\n* * * sol * * *\n",cout);
517  anres.Print("\n* * * anres * * *\n",cout);
518  tinf.Print("\n* * * tinf * * *\n",cout);
519  res.Print("\n* * * residuo * * *\n",cout);
520  } else {
521  cout << "TPZNonLinMultGridAnalysis::CalcResidual Calculation of the residue for this"
522  << " decomposition is not implemented, implements now!\n";
523  }
524 }
525 
526 
527 
528 
534 
535 void TPZNonLinMultGridAnalysis::OneGridAlgorithm(std::ostream &out,int nummat){
536  //ALGORITMO SIMPLES A UMA MALHA
537  int iter,marcha;
538  cout << "TPZNonLinMultGridAnalysis::OneGridAlgorithm Name of the out dx OneGridAlgorithm.dx\n";
539  int levelnumbertorefine = 1;
540  cout << "TPZNonLinMultGridAnalysis:: nmero de n�eis a dividir: ";
541  cin >> levelnumbertorefine;
542  TPZCompMesh *coarcmesh = fMeshes[0];//malha grosseira inicial
543  int setdegree = -1;//preserva o grau da malha inicial
544  TPZCompMesh *finemesh = UniformlyRefineMesh(coarcmesh,levelnumbertorefine,setdegree);
545  TPZMaterial * finemat = finemesh->FindMaterial(nummat);
546  int meshdim = coarcmesh->Dimension();
547  finemesh->SetDimModel(meshdim);
548  finemesh->SetName("\n\t\t\t* * * MALHA COMPUTACIONAL FINA * * *\n\n");
549  finemesh->Reference()->ResetReference();
550  finemesh->LoadReferences();
551  TPZAnalysis finean(finemesh);
552  TPZSkylineStructMatrix finestiff(finemesh);
553  finean.SetStructuralMatrix(finestiff);
554  TPZStepSolver<STATE> finesolver;
555  finesolver.SetDirect(ELDLt);
556  finean.SetSolver(finesolver);
557  finean.Solution().Zero();
558  SetDeltaTime(finemesh,finemat);//para calcular o passo e estimar o nmero de iterac�s
559  TPZConservationLaw *law = dynamic_cast<TPZConservationLaw *>(finemat);
560  law->SetTimeStep(-1);//para obter o c�culo antes da primeira soluc�
561  cout << "\nTPZNonLinMultGridAnalysis::OneGridAlgorithm Numero de iteracoes ? :\n";
562  cin >> iter;
563  cout << "\nTPZNonLinMultGridAnalysis::OneGridAlgorithm Marcha ? :\n";
564  cin >> marcha;
565  REAL sol_tol = 1.e1;//valor m�imo da ||solu�o||
566  std::string solout("OneGridAlgorithm.vtk");
567 // std::string solout("OneGridAlgorithm.dx");
568  SmoothingSolution(sol_tol,iter,finemat,finean,marcha,solout);
569 }
570 
576 
577 void TPZNonLinMultGridAnalysis::TwoGridAlgorithm(std::ostream &out,int nummat){
578 
579  ifstream INd("DADOS.in");
580  TPZCompMesh *coarcmesh = fMeshes[0];//malha grosseira inicial
581  TPZGeoMesh *geomesh = fMeshes[0]->Reference();//nica malha geom�rica
582  int meshdim = coarcmesh->Dimension();
583  //criando a malha fina
584  int levelnumbertorefine = 1;
585  cout << "TPZNonLinMultGridAnalysis:: nmero de n�eis a dividir: ";
586  INd >> levelnumbertorefine;
587  int setdegree = -1;//preserva o grau da malha inicial
588  //newmesh = 0: coarcmesh se tornou a malha fina
589  TPZCompMesh *finemesh = UniformlyRefineMesh(coarcmesh,levelnumbertorefine,setdegree);
590  finemesh->SetDimModel(meshdim);
591  finemesh->SetName("\n\t\t\t* * * MALHA COMPUTACIONAL FINA * * *\n\n");
592  //obtendo-se a malha menos fina por agrupamento
593  int levelnumbertogroup = levelnumbertorefine - 1;//sera obtido por agrupamento o n�el 0
594  cout << "TPZNonLinMultGridAnalysis:: nmero do n�el a ser agrupado: ";
595  INd >> levelnumbertogroup;
596  TPZCompMesh *aggmesh = AgglomerateMesh(finemesh,levelnumbertogroup);
597  aggmesh->SetName("\n\t\t\t* * * MALHA COMPUTACIONAL AGLOMERADA * * *\n\n");
598  aggmesh->SetDimModel(meshdim);
599  AppendMesh(aggmesh);
600  aggmesh->Reference()->SetName("\n\t\t\t* * * MALHA GEOM�RICA REFINADA * * *\n\n");
601  aggmesh->Reference()->Print(out);//malha geom�rica �uma s�
602  //out << "\n\n\t\t\t* * * MALHA AGLOMERADA * * *\n\n";
603  aggmesh->Print(out);
604  //out << "\n\n\t\t\t* * * MALHA FINA * * *\n\n";
605  finemesh->Print(out);
606  out.flush();
607 
608  //analysis na malha aglomerada
609  TPZAnalysis coarsean(fMeshes[1]);
610  TPZSkylineStructMatrix coarsestiff(fMeshes[1]);
611  coarsean.SetStructuralMatrix(coarsestiff);
612  TPZStepSolver<STATE> coarsesolver;
613  coarsesolver.SetDirect(ELDLt);
614  TPZMatrixSolver<STATE> *clone = dynamic_cast<TPZMatrixSolver<STATE> *>(coarsesolver.Clone());
615  coarsean.SetSolver(*clone);
616  fSolvers.Push(clone);
617  coarsean.Solution().Zero();
618  fSolutions.Push(new TPZFMatrix<STATE>(coarsean.Solution()));
619  fPrecondition.Push(0);
620  //analysis na malha fina
621  AppendMesh(finemesh);
622  TPZAnalysis finean(fMeshes[2]);
623  TPZSkylineStructMatrix finestiff(fMeshes[2]);
624  finean.SetStructuralMatrix(finestiff);
625  TPZStepSolver<STATE> finesolver;
626  finesolver.SetDirect(ELDLt);
627  clone = dynamic_cast<TPZMatrixSolver<STATE> *>(finesolver.Clone());
628  finean.SetSolver(*clone);
629  fSolvers.Push(clone);
630  finean.Solution().Zero();
631  fSolutions.Push(new TPZFMatrix<STATE>(finean.Solution()));
632  fPrecondition.Push(0);
633  //preparac� para aplicar m�odo multigrid a duas malhas
634  int preiter,positer,premarcha,posmarcha;
635  TPZMaterial * finemat = finemesh->FindMaterial(nummat);
636  int finedim = finemat->Dimension();
637  TPZMaterial * coarsemat = fMeshes[1]->FindMaterial(nummat);
638  int coarsedim = coarsemat->Dimension();
639  cout << "\nNumero de iteracoes pre-suavisamento? :\n";
640  INd >> preiter;
641  //preiter = 10;
642  cout << "main:: Parametro marcha : \n";
643  INd >> premarcha;
644  //premarcha = 0;
645  cout << "\nNumero de iteracoes p�-suavisamento? :\n";
646  INd >> positer;
647  //cout << "main:: Parametro marcha no p�-suavisamento :\n";
648  //INd >> posmarcha;
649  posmarcha = premarcha;
650  fMeshes[2]->Reference()->ResetReference();
651  fMeshes[2]->LoadReferences();
652  //ofstream *dxout = new ofstream("PreSmoothingEuler.dx");//par�etro de SmootSolution
653  //ofstream *dxout2 = new ofstream("PostSmoothingEuler.dx");
654  // TRANSFER�CIA DE SOLU�ES
655  TPZTransfer<STATE> transfer;
656  fMeshes[2]->BuildTransferMatrixDesc(*fMeshes[1],transfer);
657  TPZFMatrix<STATE> projectsol;
658  REAL normsolfine = 0.0,normsolcoar = 1.e10,erro;
659  REAL errsol = fabs(normsolcoar - normsolfine);
660  REAL gridtol = 0.01;
661  int64_t coarneq = fMeshes[1]->NEquations();
662  int64_t fineneq = fMeshes[2]->NEquations();
663  TPZFMatrix<STATE> finesol(fineneq,1,0.),fineres(fineneq,1),finesol0,projfinesol;
664  TPZFMatrix<STATE> coarsesol(coarneq,1,0.),projfineres(coarneq,1),rhs(coarneq,1),frhsk;
665  TPZFMatrix<STATE> finesolkeep,coarsesolkeep;
666  int mgmaxiter = 100,mgiter = 0;
667  TPZVec<std::string> scalar(1),vector(0);
668  scalar[0] = "pressure";
669  geomesh->ResetReference();
670  fMeshes[2]->LoadReferences();
671  if (!finemat) {
672  DebugStop();
673  }
674  std::set<int> matids;
675  matids.insert(finemat->Id());
676  TPZDXGraphMesh finegraph(fMeshes[2],finedim,matids,scalar,vector);
677  finegraph.SetFileName("FineSmoothing.dx");
678  finegraph.SetResolution(0);
679  finegraph.DrawMesh(finedim);
680  geomesh->ResetReference();
681  fMeshes[1]->LoadReferences();
682  ResetReference(fMeshes[1]);//retira refer�cias para criar coarsegraph consistente
683  if (!coarsemat) {
684  DebugStop();
685  }
686  matids.clear();
687  matids.insert(coarsemat->Id());
688  TPZDXGraphMesh coarsegraph(fMeshes[1],coarsedim,matids,scalar,vector);
689  SetReference(fMeshes[1]);//recupera as refer�cias
690  coarsegraph.SetFileName("CoarseSmoothing.dx");
691  coarsegraph.SetResolution(0);
692  coarsegraph.DrawMesh(coarsedim);
693  REAL sol_tol = 1.e15;//valor m�imo da ||solu�o||
694  REAL time,skm1 = 1.0;
695  cout << "TwoGridAlgorithm entre sk-1 : ";
696  INd >> skm1;
697  REAL skm1inv = 1.0/skm1;
698  int draw = 0,residuo;
699  cout << "TwoGridAlgorithm nmero m�imo de itera�es : ";
700  INd >> mgmaxiter;
701  cout << "TwoGridAlgorithm res�uo [1:Lk-1(u0k-1)] ou res�uo [2:fk-1] ? : ";
702  INd >> residuo;
703  fInit = clock();
704  cout << "PZAnalysis::SmoothingSolutionTest beginning of the iterative process, time = 0\n";
705 
706  while( errsol > gridtol && mgiter < mgmaxiter){
707 
708  cout << "\nTwoGridAlgorithm: iterac� nmero = " << mgiter << "\n\n";
709  geomesh->ResetReference();//por no final
710  fMeshes[2]->LoadReferences();//por no final
711  finesolkeep = finesol;//= 0 ou guarda a solu�o a seguir da itera�o anterior
712  SmoothingSolution(sol_tol,preiter,finemat,finean,rhs);// PASSO 1
713  finesol = finean.Solution();
714  {
715  time = (REAL)mgiter;//pode ser a soma dos passos de tempo
716  if( REAL(mgiter) / REAL(premarcha) == draw || premarcha == 1 || (mgiter+1) == mgmaxiter){
717  finegraph.DrawSolution(draw,time);
718  }
719  erro = Norm(finesol - finesolkeep);
720  cout << "TwoGridAlgorithm: ||finesol(i) - finesol(i-1)|| = " << erro << endl;
721  }
722  transfer.TransferResidual(rhs,projfineres);// PASSO 2
723  //ser�somado �residuo da malha grossa proveniente
724  //da solu�o projetada projfinesol
725  projfineres *= skm1;
726  fMeshes[1]->ProjectSolution(projfinesol);// PASSO 3
727  fMeshes[1]->LoadSolution(projfinesol);
728  geomesh->ResetReference();//istas duas linhas s� feitas
729  fMeshes[1]->LoadReferences();//em ProjectSolution acima
730  if(positer){
731  //a solu�o projetada avan� na malha grossa
732  SmoothingSolution(sol_tol,positer,coarsemat,coarsean);// PASSO 5
733  projfinesol = coarsean.Solution();
734  }
735  //duas formas de calcular o pr�imo passo
736  if(residuo == 1){// forma 1
737  coarsean.Solution().Zero();
738  fSolvers[1]->SetMatrix(0);
739  fSolvers[1]->SetMatrix(coarsean.StructMatrix()->CreateAssemble(coarsean.Rhs(),NULL));
740  CalcResidual(projfinesol,coarsean,"LDLt",rhs);//rhs = Stiffcoar * projfinesol
741  //no assemble ser�adicionado +fRhs por isso: rhs = rhs - fRhs
742  rhs = rhs + projfineres;
743  coarsean.Rhs() = rhs;//res�uo
744  coarsean.Solve();
745  } else if(residuo == 2){// forma 2
746  coarsean.Solution().Zero();
747  fSolvers[1]->SetMatrix(0);
748  //argumento 1 espera? adicionar o res�uo anterior ao atual calculado
749  fSolvers[1]->SetMatrix(coarsean.StructMatrix()->CreateAssemble(coarsean.Rhs(),NULL));
750  TPZFMatrix<STATE> coarres = coarsean.Rhs() + projfineres;
751  coarsean.Rhs() = coarres;//res�uo
752  coarsean.Solve();
753  }
754  coarsesolkeep = coarsesol;// = 0 ou solu�o grossa da itera�o anterior
755  coarsesol = coarsean.Solution();//solu�o para o residuo na malha grossa
756  transfer.TransferSolution(coarsesol-projfinesol,finesol0);
757  finesol0 *= skm1inv;
758  finesol0 = finesol + finesol0;
759  fMeshes[2]->LoadSolution(finesol0);// PASSO 6
760  {
761  if( REAL(mgiter) / REAL(posmarcha) == draw || posmarcha == 1 || (mgiter+1) == mgmaxiter){
762  coarsegraph.DrawSolution(draw,time);
763  draw++;// <- deve ser: posmarcha = premarcha
764  }
765  erro = Norm(coarsesol - coarsesolkeep);
766  cout << "||coarsesol(i) - coarsesol(i-1)|| = " << erro << endl;
767  }
768  mgiter++;
769  }
770  CoutTime(fInit,"TPZNonLinMultGridAnalysis::SmoothingSolution general time of iterative process");
771 }
772 
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.
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
void AdjustBoundaryElements()
Will refine the elements associated with a boundary condition till there are no elements constrained ...
Definition: pzcmesh.cpp:1423
virtual void SetFileName(const std::string &filename)
Sets the name of the output file.
Definition: pzdxmesh.cpp:418
void SetName(const std::string &nm)
Set the mesh name.
Definition: pzcmesh.cpp:232
Definition: pzmatrix.h:52
clock_t fBegin
Times by iteration and accumulated time.
TPZNonLinMultGridAnalysis(TPZCompMesh *cmesh)
Creates an object multigrid analysis giving a computational mesh.
virtual void Solve()
Invert the stiffness matrix.
Definition: pzanalysis.cpp:352
virtual MElementType Type()
Return the type of the element.
Definition: pzcompel.cpp:195
void SetStructuralMatrix(TPZAutoPointer< TPZStructMatrix > strmatrix)
Set structural matrix as auto pointer for analysis.
Definition: pzanalysis.cpp:82
void Print(const std::string &name, std::ostream &out)
Print connect and solution information.
Definition: pzanalysis.cpp:447
virtual TPZSolver< TVar > * Clone() const override
Clones the current object returning a pointer of type TPZSolver.
Definition: pzstepsolver.h:46
void SetTimeStep(REAL timeStep)
Sets the time step used for time integration.
Definition: pzconslaw.h:302
static TPZAgglomerateMesh * CreateAgglomerateMesh(TPZCompMesh *finemesh, TPZVec< int64_t > &accumlist, int64_t numaggl)
TPZFMatrix< STATE > fSolution
Solution vector.
Definition: pzanalysis.h:50
Contains TPZNonLinMultGridAnalysis class which implements multigrid analysis to non linear problems...
Implements the interface of the graphmesh to the OpenDX graphics package. Post processing.
Definition: pzdxmesh.h:17
clarg::argInt nsub("-nsub", "number of substructs", 4)
TPZStack< TPZFMatrix< STATE > * > fSolutions
Contains the meshes solutions.
Contains the TPZVTKGraphMesh class which implements the graphical mesh to VTK environment.
Contains declaration of TPZCompEl class which defines the interface of a computational element...
Templated vector implementation.
Defines step solvers class. Solver.
Definition: pzmganalysis.h:17
void(* fFunction)(TPZMaterial *mat, TPZCompMesh *cmesh)
void SetSolver(TPZMatrixSolver< STATE > &solver)
Set solver matrix.
void TwoGridAlgorithm(std::ostream &out, int nummat)
TPZCompMesh * fCompMesh
Computational mesh.
Definition: pzanalysis.h:44
Defines PZError.
REAL LesserEdgeOfMesh()
Definition: pzcmesh.cpp:1849
To export a graphical mesh to VTK environment. Post processing.
Definition: pzvtkmesh.h:19
TPZCompMesh * Mesh() const
Returns the pointer to the computational mesh.
Definition: pzanalysis.h:180
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.
Declarates the TPZBlock<REAL>class which implements block matrices.
Defines enum MElementType and contains the implementation of MElementType_NNodes(...) functions.
void SetDeltaTime(TPZCompMesh *CompMesh, TPZMaterial *mat)
int64_t NElements() const
Access method to query the number of elements of the vector.
Implements a chunk vector with free store administration. Utility.
Definition: TPZStream.h:39
Contains the TPZStructMatrixOR class which responsible for a interface among Matrix and Finite Elemen...
virtual void Divide(TPZVec< TPZGeoEl *> &pv)
Divides the element and puts the resulting elements in the vector.
Definition: pzgeoel.h:742
TPZMatrixSolver< STATE > & Solver()
Get the solver matrix.
Definition: pzanalysis.h:367
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.
void LoadReferences()
Map this grid in the geometric grid.
Definition: pzcmesh.cpp:482
TPZCompMesh * PopMesh()
Pop the last mesh of the meshes vector.
Implements SkyLine Structural Matrices. Structural Matrix.
TPZFMatrix< STATE > & Solution()
Returns the solution matrix.
Definition: pzanalysis.h:177
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
TPZStack< TPZMatrixSolver< STATE > * > fPrecondition
Contains the preconditioner of the solution method.
void SetResolution(int res)
Sets resolution.
Definition: pzgraphmesh.h:86
REAL TimeStep()
Returns the value of the time step.
Definition: pzconslaw.h:307
Computational mesh with additional data for CFD problems. Computational Mesh.
Definition: pzflowcmesh.h:27
TPZAutoPointer< TPZStructMatrix > StructMatrix()
Returns a reference to the structural matrix.
Definition: pzanalysis.h:182
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
Definition: pzcompel.cpp:959
TPZCompEl * CreateCompEl(TPZGeoEl *gel, int64_t &index)
Create a computational element based on the geometric element.
Definition: pzcmesh.h:462
int Zero() override
Makes Zero all the elements.
Definition: pzfmatrix.h:651
REAL MaxVelocityOfMesh()
According to each material settings, it returns the greatest velocity in the mesh.
Definition: pzflowcmesh.cpp:22
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
static const double tol
Definition: pzgeoprism.cpp:23
Implements the sequence of actions to perform a finite element analysis. Analysis.
Definition: pzanalysis.h:32
void Push(const T object)
Pushes a copy of the object on the stack.
Definition: pzstack.h:80
void CoutTime(clock_t &start, const char *title)
virtual void DrawSolution(TPZBlock< REAL > &Sol)
Draw solution as dx file.
Definition: pzdxmesh.cpp:384
virtual void LoadSolution()
Load the solution into the computable grid.
Definition: pzanalysis.cpp:441
virtual void Print(std::ostream &out=std::cout) const
Print the information of the grid to an ostream.
Definition: pzgmesh.cpp:130
Contains declaration of.
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
void CalcResidual(TPZMatrix< STATE > &sol, TPZAnalysis &an, const std::string &decompose, TPZFMatrix< STATE > &res)
TPZStack< TPZMatrixSolver< STATE > * > fSolvers
Contains the solution method applied to the mesh.
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
Contains the TPZSkylineStructMatrix class which implements SkyLine Structural Matrices.
void TransferResidual(const TPZFMatrix< TVar > &fine, TPZFMatrix< TVar > &coarse)
Will transfer the residual, taking into acount there may be more than one TVar variable.
Definition: pztransfer.cpp:347
int Dimension() const
Returns the dimension of the simulation.
Definition: pzcmesh.h:148
void OneGridAlgorithm(std::ostream &out, int nummat)
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 ResetReference(TPZCompMesh *aggcmesh)
TPZStack< TPZCompMesh *> fMeshes
Contains the computational meshes of one cycle: V, W, F, etc.
TPZCompMesh * IMesh(int64_t index)
string res
Definition: test.py:151
Contains declaration of the TPZAutoPointer class which has Increment and Decrement actions are mutexe...
Contains declaration of TPZCompelDisc class which implements a computational element for discontinuou...
void AppendMesh(TPZCompMesh *mesh)
Append a mesh to the meshes vector.
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 void DrawMesh(int numcases)
Draw mesh as dx file.
Definition: pzdxmesh.cpp:93
void SetDimModel(int dim)
Set de dimension of the domain of the problem.
Definition: pzcmesh.h:139
virtual void Run(std::ostream &out=std::cout)
Calls the appropriate sequence of methods to build a solution or a time stepping sequence.
Definition: pzanalysis.cpp:920
std::map< int,TPZMaterial *> & MaterialVec()
Returns a reference to the material pointers vector.
Definition: pzcmesh.h:203
static TPZCompMesh * AgglomerateMesh(TPZCompMesh *finemesh, int levelnumbertogroup)
It generates a new mesh based on the agglomeration of elements of the fine mesh.
void TransferSolution(const TPZFMatrix< TVar > &coarsesol, TPZFMatrix< TVar > &finesol)
Will transfer the solution, taking into acount there may be more than one TVar variable.
Definition: pztransfer.cpp:305
virtual void SetFileName(const std::string &filename)
Sets the filename to output of graph.
virtual void DrawSolution(int step, REAL time)
Draw solution depending on the resolution.
Definition: pzvtkmesh.cpp:38
Implements the interface for conservation laws, keeping track of the timestep as well.
Definition: pzconslaw.h:71
void SmoothingSolution2(REAL tol, int numiter, TPZMaterial *mat, TPZAnalysis &an, int marcha, const std::string &dxout)
virtual void DrawMesh(int numcases)
Draw the graphical mesh.
Definition: pzvtkmesh.cpp:32
T Pop()
Retrieve an object from the stack.
Definition: pzstack.h:87
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
Definition: pzcompel.cpp:1137
Free store vector implementation in chunks.
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
This class implements a stack object. Utility.
Definition: pzcheckmesh.h:14
void SetForcingFunction(TPZAutoPointer< TPZFunction< STATE > > fp)
Sets a procedure as source function for the material.
Definition: TPZMaterial.h:368
Contains declaration of TPZFlowCompMesh class which is a computational mesh with additional data for ...
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Definition: pzcmesh.h:183
void SmoothingSolution(REAL tol, int numiter, TPZMaterial *mat, TPZAnalysis &an, int marcha=0, const std::string &dxout="plotfile.dx")
Contains TPZSolver class which defines a abstract class of solvers which will be used by matrix class...
TPZAutoPointer< TPZMatrix< TVar > > Matrix() const
Returns a pointer to TPZMatrix<>
Definition: pzsolve.h:138
virtual void Clone(std::map< int, TPZMaterial * > &matvec)
Creates a copy of the material object and put it in the vector which is passed on.
void SetReference(TPZCompMesh *aggcmesh)
void SetReference(TPZCompEl *elp)
Make the current element reference to the computational element.
Definition: pzgeoel.h:746
int Id() const
Definition: TPZMaterial.h:170
Contains TPZStepSolver class which defines step solvers class.
virtual void SetDegree(int degree)
Assigns the degree of the element.
virtual void Print(std::ostream &out) const
Definition: pzmatrix.h:253
virtual int Degree() const
Returns the degree of interpolation of the element.
Contains declaration of TPZAgglomerateMesh which implements a mesh that contains agglomerated element...
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
Contains the TPZConservationLaw class which implements the interface for conservation laws...
TPZFMatrix< STATE > & Rhs()
Returns the load vector.
Definition: pzanalysis.h:174
void SetDirect(const DecomposeType decomp)
Contains the TPZDXGraphMesh class which implements the interface of the graphmesh to the OpenDX graph...
This class implements a discontinuous element (for use with discontinuous Galerkin). Computational Element.
Definition: TPZCompElDisc.h:35
clarg::argString m("-m", "input matrix file name (text format)", "matrix.txt")
Implements rectangular matrix which extends a solution vector of the coarse mesh to a solution vector...
Definition: pzcmesh.h:33
static TPZCompMesh * UniformlyRefineMesh(TPZCompMesh *coarcmesh, int levelnumbertorefine, int setdegree)
It creates a new established computational mesh in the refinement uniform of a fixed number of levels...
void ResetReference()
Resets all load references in elements and nodes.
Definition: pzgmesh.cpp:197
TPZCompMesh * MotherMesh()
Returns father mesh.
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
int GetDefaultOrder()
Definition: pzcmesh.h:398
const TVar & GetVal(const int64_t row, const int64_t col) const override
Get values without bounds checking This method is faster than "Get" if DEBUG is defined.
Definition: pzfmatrix.h:566
static void ListOfGroupings(TPZCompMesh *finemesh, TPZVec< int64_t > &accumlist, int nivel, int64_t &numaggl, int dim)
void SetName(const std::string &nm)
Definition: pzgmesh.cpp:125
#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 Print(std::ostream &out=std::cout) const
Prints mesh data.
Definition: pzcmesh.cpp:236
This class implements a reference counter mechanism to administer a dynamically allocated object...