NeoPZ
pzmganalysis.cpp
Go to the documentation of this file.
1 
6 #include <stdlib.h>
7 #include "pzmganalysis.h"
8 #include "pzcmesh.h"
9 #include "pzintel.h"
10 #include "pzgeoel.h"
11 #include "pztransfer.h"
12 #include "pzadmchunk.h"
13 #include "pzbdstrmatrix.h"
14 #include "pzblockdiag.h"
15 #include "pzskylmat.h"
16 #include "pzskylstrmatrix.h"
17 
18 #include "TPZFrontSym.h"
19 #include "TPZFrontNonSym.h"
20 #include "TPZFrontStructMatrix.h"
21 #include "pzmgsolver.h"
22 #include "pzseqsolver.h"
23 #include "pzstepsolver.h"
24 
25 #include "pzquad.h"
26 #include "TPZMaterial.h"
27 #include "pztransfer.h"
28 
29 using namespace std;
30 
32  fMeshes.Push(cmesh);
33  fExact = 0;
34 }
35 
37  while (fMeshes.NElements()) delete fMeshes.Pop();
38  while(fSolutions.NElements()) delete fSolutions.Pop();
39  while(fSolvers.NElements()) delete fSolvers.Pop();
40  while(fPrecondition.NElements()) delete fPrecondition.Pop();
41 }
42 
46  cout << "TPZMGAnalysis::AppendMesh can only be called after solving the coarse mesh\n";
47  return;
48  }
49  fMeshes.Push(mesh);
50  TPZCompMesh *coarse = fCompMesh;
51 
52  fCompMesh = mesh;
54  TPZSkylineStructMatrix skstr(mesh);
55  SetStructuralMatrix(skstr);
56  int nmeshes = fSolvers.NElements();
59  mesh->BuildTransferMatrix(*coarse,*tr);
60  TPZFMatrix<STATE> sol(mesh->NEquations(),1);
61  tr->TransferSolution(fSolution,sol);
62  fSolution = sol;
63  mesh->LoadSolution(fSolution);
64  TPZBlockDiagonalStructMatrix bdstr(mesh);
66  bdstr.AssembleBlockDiagonal(*bd);
68  TPZStepSolver<STATE> s1(bdauto);
69  s1.SetDirect(ELU);
70  int nvar = mesh->MaterialVec().begin()->second->NStateVariables();
71 
73  prec = fPrecondition[nmeshes-1];
74  if(!prec) prec = fSolvers[nmeshes-1];
76  TPZAutoPointer<TPZMatrix<STATE> > skauto = skstr.CreateAssemble(fRhs, guiInterface);
77  TPZMGSolver<STATE> s2(trauto,*prec,nvar,skauto);
79  s3.ShareMatrix(s2);
80  s3.AppendSolver(s1);
81  s3.AppendSolver(s2);
82  s3.AppendSolver(s1);
83 
85  s4.ShareMatrix(s3);
87  s4.SetCG(200,s3,1.e-6,1);
88  SetSolver(s4);
90 }
91 
93  if(fMeshes.NElements() == 1) {
94  cout << "TPZMGAnalysis cannot delete the root mesh, sorry\n";
95  return 0;
96  }
97  if(fSolutions.NElements() == fMeshes.NElements()) delete fSolutions.Pop();
98 
99  delete fSolvers.Pop();
100  delete fPrecondition.Pop();
101 
105  return fMeshes.Pop();
106 }
107 
109  void (*f)(const TPZVec<REAL> &loc, TPZVec<STATE> &val, TPZFMatrix<STATE> &deriv),TPZVec<REAL> &truervec){
110  coarse->Reference()->ResetReference();
111  coarse->LoadReferences();
112  int dim = fine->MaterialVec().begin()->second->Dimension();
113  ervec.Resize(coarse->NElements());
114  if(f) {
115  truervec.Resize(coarse->NElements());
116  truervec.Fill(0.,0);
117  }
118  ervec.Fill(0.,0);
119  TPZCompEl *cel;
120  TPZAdmChunkVector<TPZCompEl *> &elementvec = fine->ElementVec();
121  int numel = elementvec.NElements();
122  int el;
123  for(el=0; el<numel; el++) {
124  cel = elementvec[el];
125  if (!cel) continue;
126  TPZInterpolatedElement *cint = dynamic_cast<TPZInterpolatedElement *> (cel);
127  if(!cint) continue;
128  int ncon = cint->NConnects();
129  TPZGeoElSide gelside(cint->Reference(),ncon-1);
130  if(gelside.Dimension() != dim) continue;
131  TPZGeoElSide gellarge(gelside);
132  while(!gellarge.Reference().Exists() && gellarge.Father2().Exists()) gellarge = gellarge.Father2();
133  if(!gellarge.Reference().Exists()) {
134  cout << "TPZMGAnalsysis::BuildTransferMatrix element " << el << " found no corresponding element\n";
135  continue;
136  }
137  TPZCompElSide cellargeside = gellarge.Reference();
138  TPZCompEl *cellarge = cellargeside.Element();
139  TPZInterpolatedElement *cintlarge = (TPZInterpolatedElement *) cellarge;
140  TPZTransform<> transform(gelside.Dimension(),gellarge.Dimension());
141  gelside.SideTransform3(gellarge,transform);
142  int index = cellarge->Index();
143  REAL truerror = 0.;
144  ervec[index] += ElementError(cint,cintlarge,transform,f,truerror);
145  if(f) truervec[index] += truerror;
146  }
147 }
148 
149 
151  void (*f)(const TPZVec<REAL> &loc, TPZVec<STATE> &val, TPZFMatrix<STATE> &deriv),REAL &truerror){
152  // accumulates the transfer coefficients between the current element and the
153  // coarse element into the transfer matrix, using the transformation t
154  int locnod = fine->NConnects();
155  int cornod = coarse->NConnects();
156  int locmatsize = fine->NShapeF();
157  int cormatsize = coarse->NShapeF();
158  REAL error = 0.;
159  truerror = 0.;
160 
161  STATE loclocmatstore[500] = {0.},loccormatstore[500] = {0.};
162  TPZFMatrix<STATE> loclocmat(locmatsize,locmatsize,loclocmatstore,500);
163  TPZFMatrix<STATE> loccormat(locmatsize,cormatsize,loccormatstore,500);
164 
166  int dimension = fine->Dimension();
167  int numdof = fine->Material()->NStateVariables();
168  TPZBlock<STATE> &locblock = fine->Mesh()->Block();
169  TPZFMatrix<STATE> &locsolmesh = fine->Mesh()->Solution();
170 
171  TPZBlock<STATE> &corblock = coarse->Mesh()->Block();
172  TPZFMatrix<STATE> &corsolmesh = coarse->Mesh()->Solution();
173 
174  TPZVec<STATE> locsol(numdof);
175  TPZFMatrix<STATE> locdsol(dimension,numdof);
176 
177  TPZVec<STATE> corsol(numdof);
178  TPZFMatrix<STATE> cordsol(dimension,numdof);
179 
180  TPZManVector<int> prevorder(dimension),
181  order(dimension);
182  intrule->GetOrder(prevorder);
183 
184  TPZManVector<int> interpolation(dimension);
185  fine->GetInterpolationOrder(interpolation);
186 
187  // compute the interpolation order of the shapefunctions squared
188  int dim;
189  int maxorder = interpolation[0];
190  for(dim=0; dim<interpolation.NElements(); dim++) {
191  maxorder = interpolation[dim] < maxorder ? maxorder : interpolation[dim];
192  }
193  for(dim=0; dim<dimension; dim++) {
194  order[dim] = 20;
195  }
196  intrule->SetOrder(order);
197 
198 
199  REAL locphistore[50]={0.},locdphistore[150]={0.};
200  TPZFMatrix<REAL> locphi(locmatsize,1,locphistore,50);
201  TPZFMatrix<REAL> locdphi(dimension,locmatsize,locdphistore,150),locdphix(dimension,locmatsize);
202  // derivative of the shape function
203  // in the master domain
204 
205  REAL corphistore[50]={0.},cordphistore[150]={0.};
206  TPZFMatrix<REAL> corphi(cormatsize,1,corphistore,50);
207  TPZFMatrix<REAL> cordphi(dimension,cormatsize,cordphistore,150), cordphix(dimension,cormatsize);
208  // derivative of the shape function
209  // in the master domain
210 
211  REAL jacobianstore[9],
212  axesstore[9];
213  TPZManVector<REAL> int_point(dimension),
214  coarse_int_point(dimension);
215  TPZFMatrix<REAL> jacfine(dimension,dimension,jacobianstore,9),jacinvfine(dimension,dimension);
216  TPZFMatrix<REAL> axesfine(3,3,axesstore,9);
217  TPZManVector<REAL> xfine(3);
218  TPZFMatrix<REAL> jaccoarse(dimension,dimension),jacinvcoarse(dimension,dimension);
219  TPZFMatrix<REAL> axescoarse(3,3), axesinner(dimension,dimension);
220  TPZManVector<REAL> xcoarse(3);
221 
222  REAL jacdetcoarse;
223  int numintpoints = intrule->NPoints();
224  REAL weight;
225  int i,j,k;
226 
227  TPZVec<STATE> truesol(numdof);
228  TPZFMatrix<STATE> truedsol(dimension,numdof);
229  for(int int_ind = 0; int_ind < numintpoints; ++int_ind) {
230 
231  intrule->Point(int_ind,int_point,weight);
232  REAL jacdetfine;
233  fine->Reference()->Jacobian( int_point, jacfine , axesfine, jacdetfine, jacinvfine);
234  fine->Reference()->X(int_point, xfine);
235  if(f) f(xfine,truesol,truedsol);
236  fine->Shape(int_point,locphi,locdphi);
237  tr.Apply(int_point,coarse_int_point);
238  coarse->Shape(coarse_int_point,corphi,cordphi);
239  coarse->Reference()->Jacobian( coarse_int_point,jaccoarse,axescoarse, jacdetcoarse, jacinvcoarse);
240  coarse->Reference()->X(coarse_int_point,xcoarse);
241  REAL dist = (xfine[0]-xcoarse[0])*(xfine[0]-xcoarse[0])+(xfine[1]-xcoarse[1])*(xfine[1]-xcoarse[1])+(xfine[2]-xcoarse[2])*(xfine[2]-xcoarse[2]);
242  if(dist > 1.e-6) cout << "TPZMGAnalysis::ElementError transformation between fine and coarse is wrong\n";
243  for(i=0; i<dimension; i++) {
244  for(j=0; j<dimension; j++) {
245  axesinner(i,j) = 0.;
246  for(k=0; k<3; k++) axesinner(i,j) += axesfine(i,k)*axescoarse(j,k);
247  }
248  }
249  if(fabs(axesinner(0,0)-1.) > 1.e-6 || fabs(axesinner(1,1)-1.) > 1.e-6 || fabs(axesinner(0,1)) > 1.e-6 || fabs(axesinner(1,0)) > 1.e-6) {
250  cout << "TPZMGAnalysis axesinner is not identify?\n";
251  }
252  weight *= fabs(jacdetfine);
253 
254  locdphix.Zero();
255 
256  int ieq,d;
257  switch(dim) {
258  case 0:
259  break;
260  case 1:
261  for(d=0; d<dimension; d++) {
262  for(ieq=0; ieq<locmatsize; ieq++) locdphix(d,ieq) = locdphi(d,ieq)*(1./jacdetfine);
263  for(ieq=0; ieq<cormatsize; ieq++) cordphix(d,ieq) = cordphi(d,ieq)*(axesinner(0,0)/jacdetcoarse);
264  }
265  break;
266  case 2:
267  for(ieq = 0; ieq < locmatsize; ieq++) {
268  locdphix(0,ieq) = jacinvfine(0,0)*locdphi(0,ieq) + jacinvfine(1,0)*locdphi(1,ieq);
269  locdphix(1,ieq) = jacinvfine(0,1)*locdphi(0,ieq) + jacinvfine(1,1)*locdphi(1,ieq);
270  REAL tmp[2];
271  tmp[0] = locdphix(0,ieq)*axesfine(0,0)+locdphix(1,ieq)*axesfine(1,0);
272  tmp[1] = locdphix(0,ieq)*axesfine(0,1)+locdphix(1,ieq)*axesfine(1,1);
273  locdphix(0,ieq) = tmp[0];
274  locdphix(1,ieq) = tmp[1];
275  }
276  for(ieq = 0; ieq < cormatsize; ieq++) {
277  cordphix(0,ieq) = jacinvcoarse(0,0)*cordphi(0,ieq) + jacinvcoarse(1,0)*cordphi(1,ieq);
278  cordphix(1,ieq) = jacinvcoarse(0,1)*cordphi(0,ieq) + jacinvcoarse(1,1)*cordphi(1,ieq);
279  REAL tmp[2];
280  tmp[0] = cordphix(0,ieq)*axescoarse(0,0)+cordphix(1,ieq)*axescoarse(1,0);
281  tmp[1] = cordphix(0,ieq)*axescoarse(0,1)+cordphix(1,ieq)*axescoarse(1,1);
282  cordphix(0,ieq) = tmp[0];
283  cordphix(1,ieq) = tmp[1];
284  }
285  break;
286  case 3:
287  for(ieq = 0; ieq < locmatsize; ieq++) {
288  locdphix(0,ieq) = jacinvfine(0,0)*locdphi(0,ieq) + jacinvfine(0,1)*locdphi(1,ieq) + jacinvfine(0,2)*locdphi(2,ieq);
289  locdphix(1,ieq) = jacinvfine(1,0)*locdphi(0,ieq) + jacinvfine(1,1)*locdphi(1,ieq) + jacinvfine(1,2)*locdphi(2,ieq);
290  locdphix(2,ieq) = jacinvfine(2,0)*locdphi(0,ieq) + jacinvfine(2,1)*locdphi(1,ieq) + jacinvfine(2,2)*locdphi(2,ieq);
291  }
292  for(ieq = 0; ieq < cormatsize; ieq++) {
293  cordphix(0,ieq) = jacinvcoarse(0,0)*cordphi(0,ieq) + jacinvcoarse(0,1)*cordphi(1,ieq) + jacinvcoarse(0,2)*cordphi(2,ieq);
294  cordphix(1,ieq) = jacinvcoarse(1,0)*cordphi(0,ieq) + jacinvcoarse(1,1)*cordphi(1,ieq) + jacinvcoarse(1,2)*cordphi(2,ieq);
295  cordphix(2,ieq) = jacinvcoarse(2,0)*cordphi(0,ieq) + jacinvcoarse(2,1)*cordphi(1,ieq) + jacinvcoarse(2,2)*cordphi(2,ieq);
296  REAL tmp[3];
297  tmp[0] = cordphix(0,ieq)*axesinner(0,0)+cordphix(1,ieq)*axesinner(0,1)+cordphix(2,ieq)*axesinner(0,2);
298  tmp[1] = cordphix(0,ieq)*axesinner(1,0)+cordphix(1,ieq)*axesinner(1,1)+cordphix(2,ieq)*axesinner(1,2);
299  tmp[2] = cordphix(0,ieq)*axesinner(2,0)+cordphix(1,ieq)*axesinner(2,1)+cordphix(2,ieq)*axesinner(2,2);
300  cordphix(0,ieq) = tmp[0];
301  cordphix(1,ieq) = tmp[1];
302  cordphix(2,ieq) = tmp[2];
303  }
304  break;
305  default:
306  PZError << "pzintel.c please implement the " << dim << "d Jacobian and inverse\n";
307  PZError.flush();
308  }
309  int iv=0;
310  locsol.Fill(0.);
311  locdsol.Zero();
312  iv=0;
313  int in;
314  for(in=0; in<locnod; in++) {
315  TPZConnect *df = &fine->Connect(in);
316  int dfseq = df->SequenceNumber();
317  int dfvar = locblock.Size(dfseq);
318  int pos = locblock.Position(dfseq);
319 
320  for(int jn=0; jn<dfvar; jn++) {
321  locsol[iv%numdof] += (STATE)locphi(iv/numdof,0)*locsolmesh(pos+jn,0);
322  for(d=0; d<dim; d++)
323  locdsol(d,iv%numdof) += (STATE)locdphix(d,iv/numdof)*locsolmesh(pos+jn,0);
324  iv++;
325  }
326  }
327  corsol.Fill(0.);
328  cordsol.Zero();
329  iv=0;
330  for(in=0; in<cornod; in++) {
331  TPZConnect *df = &coarse->Connect(in);
332  int dfseq = df->SequenceNumber();
333  int dfvar = corblock.Size(dfseq);
334  int pos = corblock.Position(dfseq);
335  for(int jn=0; jn<dfvar; jn++) {
336  corsol[iv%numdof] += (STATE)corphi(iv/numdof,0)*corsolmesh(pos+jn,0);
337  for(d=0; d<dim; d++)
338  cordsol(d,iv%numdof) += (STATE)cordphix(d,iv/numdof)*corsolmesh(pos+jn,0);
339  iv++;
340  }
341  }
342  int jn;
343  for(jn=0; jn<numdof; jn++) {
344  // error += (locsol[jn]-corsol[jn])*(locsol[jn]-corsol[jn])*weight;
345  // if(f) truerror += (corsol[jn]-truesol[jn])*(corsol[jn]-truesol[jn])*weight;
346  for(d=0; d<dim; d++) {
347  error += fabs((locdsol(d,jn)-cordsol(d,jn))*(locdsol(d,jn)-cordsol(d,jn))*(STATE)weight);
348  if(f) truerror += fabs((cordsol(d,jn)-truedsol(d,jn))*(cordsol(d,jn)-truedsol(d,jn))*(STATE)weight);
349  }
350  }
351  }
352  intrule->SetOrder(prevorder);
353  return error;
354 }
355 
357  if(fMeshes.NElements() == 1) {
359  if(fSolvers.NElements() == 0) {
361  }
362  if(fPrecondition.NElements() == 0) {
363  fPrecondition.Push(0);
364  }
365  if(fSolutions.NElements() == 0) {
367  } else {
368  int nsol = fSolutions.NElements();
369  *(fSolutions[nsol-1]) = fSolution;
370  }
371  return;
372  }
373  int numeq = fCompMesh->NEquations();
374  if(fRhs.Rows() != numeq ) return;
375  int nsolvers = fSolvers.NElements();
376 
377  TPZFMatrix<STATE> residual(fRhs);
378  TPZFMatrix<STATE> delu(numeq,1,0.);
379  TPZMatrixSolver<STATE> *solve = dynamic_cast<TPZMatrixSolver<STATE> *> (fSolvers[nsolvers-1]);
380  if(fSolution.Rows() != numeq) {
381  fSolution.Redim(numeq,1);
382  } else {
383  solve->Matrix()->Residual(fSolution,fRhs,residual);
384  }
385 
386  REAL normrhs = Norm(fRhs);
387  REAL normres = Norm(residual);
388  if(normrhs*1.e-6 >= normres) {
389  cout << "TPZMGAnalysis::Solve no need for iterations normrhs = " << normrhs << " normres = " << normres << endl;
392  } else {
393  int nsol = fSolutions.NElements();
394  *(fSolutions[nsol-1]) = fSolution;
395  }
396  return ;
397  }
398 
399  TPZStepSolver<STATE> *stepsolve = dynamic_cast<TPZStepSolver<STATE> *> (solve);
400  if(stepsolve) stepsolve->SetTolerance(1.e-6*normrhs/normres);
401  cout << "TPZMGAnalysis::Run res : " << Norm(residual) << " neq " << numeq << endl;
402  solve->Solve(residual, delu);
403  fSolution += delu;
404 
408  } else {
409  int nsol = fSolutions.NElements();
410  *(fSolutions[nsol-1]) = fSolution;
411  }
412 }
413 
415 
416  TPZGeoMesh *gmesh = mesh->Reference();
417  if(!gmesh) {
418  cout << "TPZMGAnalysis::UniformlyRefineMesh encountered no geometric mesh\n";
419  return 0;
420  }
421  gmesh->ResetReference();
422  TPZCompMesh *cmesh = new TPZCompMesh(gmesh);
423  mesh->CopyMaterials(*cmesh);
424  TPZAdmChunkVector<TPZCompEl *> &elementvec = mesh->ElementVec();
425  int el,nelem = elementvec.NElements();
426  for(el=0; el<nelem; el++) {
427  TPZCompEl *cel = elementvec[el];
428  if(!cel) continue;
429  TPZInterpolatedElement *cint = dynamic_cast<TPZInterpolatedElement *> (cel);
430  if(!cint) {
431  cout << "TPZMGAnalysis::UniformlyRefineMesh encountered a non interpolated element\n";
432  continue;
433  }
434  int ncon = cint->NConnects();
435  int porder = cint->PreferredSideOrder(ncon-1);
436 
437  TPZGeoEl *gel = cint->Reference();
438  if(!gel) {
439  cout << "TPZMGAnalysis::UniformlyRefineMesh encountered an element without geometric reference\n";
440  continue;
441  }
442  TPZVec<TPZGeoEl *> sub;
443  gel->Divide(sub);
444  int nsub = sub.NElements();
445  int isub;
446  int64_t celindex;
447  for(isub=0; isub<nsub; isub++) {
448  TPZInterpolatedElement *csint;
449  csint = (TPZInterpolatedElement *) cmesh->CreateCompEl(sub[isub],celindex);
450  if(withP) csint->PRefine(porder+1);
451  else csint->PRefine(porder);
452  }
453  }
454  return cmesh;
455 }
456 
458  int nmesh = fMeshes.NElements();
459  int nsol = fSolutions.NElements();
460  if(nsol != nmesh || nsol < 2) {
461  cout << "TPZMGAnalysis cannot compute the errors\n";
462  return;
463  }
464  fMeshes[nsol-2]->LoadSolution(*fSolutions[nsol-2]);
465  fMeshes[nsol-1]->LoadSolution(*fSolutions[nsol-1]);
466  TPZVec<REAL> truerror;
467  MeshError(fMeshes[nsol-1],fMeshes[nsol-2],error,0,truerror);
468 }
int64_t NElements() const
Number of computational elements allocated.
Definition: pzcmesh.h:169
TPZMatrixSolver< STATE > * fSolver
Type of solver to be applied.
Definition: pzanalysis.h:52
virtual void GetOrder(TPZVec< int > &ord) const =0
Gets the order of the integration rule for each dimension of the master element.
TPZGeoMesh * Reference() const
Returns a pointer to the geometrical mesh associated.
Definition: pzcmesh.h:209
Contains the TPZFrontSym class which implements decomposition process of the frontal matrix (case sym...
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
Definition: tfadfunc.h:140
Contains the TPZMGSolver class which represents a solution process in three steps.
Contains the TPZInt1d, TPZIntTriang, TPZIntQuad, TPZIntCube3D, TPZIntTetra3D, TPZIntPyram3D and TPZIn...
const int64_t numel
Number of elements to test.
Definition: pzsubcmesh.cpp:47
int Position(const int block_diagonal) const
Returns the position of first element block dependent on matrix diagonal.
Definition: pzblock.h:177
virtual int NPoints() const =0
Returns number of points for the cubature rule related.
Implements computational element and a side. Computational Element.
Definition: pzcompel.h:632
virtual void Residual(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &rhs, TPZFMatrix< TVar > &res)
Computes res = rhs - this * x.
Definition: pzmatrix.h:827
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
Definition: pzconnect.h:30
virtual void Solve()
Invert the stiffness matrix.
Definition: pzanalysis.cpp:352
void ShareMatrix(TPZMatrixSolver< TVar > &other)
Shares the current matrix with another object of same type.
Definition: pzsolve.cpp:57
void SetStructuralMatrix(TPZAutoPointer< TPZStructMatrix > strmatrix)
Set structural matrix as auto pointer for analysis.
Definition: pzanalysis.cpp:82
Implements Block Diagonal Structural Matrices. Structural Matrix.
Definition: pzbdstrmatrix.h:21
virtual int Dimension() const override=0
Returns the dimension of the element.
virtual TPZSolver< TVar > * Clone() const override
Clones the current object returning a pointer of type TPZSolver.
Definition: pzstepsolver.h:46
void OptimizeBandwidth()
Sets the computer connection block number from the graphical connections block number otimization...
Definition: pzanalysis.cpp:195
TPZFMatrix< STATE > fSolution
Solution vector.
Definition: pzanalysis.h:50
Contains the TPZFrontStructMatrix class which responsible for a interface among Finite Element Packag...
clarg::argInt nsub("-nsub", "number of substructs", 4)
int64_t NEquations()
This computes the number of equations associated with non-restrained nodes.
Definition: pzcmesh.cpp:721
clarg::argInt dimension("-d", "Matrices dimension M x M", 1000)
TPZGeoElSide Father2() const
returns the father/side pair which contains the set of points associated with this/side ...
Defines step solvers class. Solver.
Definition: pzmganalysis.h:17
void SetSolver(TPZMatrixSolver< STATE > &solver)
Set solver matrix.
TPZCompMesh * fCompMesh
Computational mesh.
Definition: pzanalysis.h:44
virtual TPZMatrix< STATE > * Create() override
Creates a sparse blockdiagonal matrix, overlapping should be assumed.
static TPZCompMesh * UniformlyRefineMesh(TPZCompMesh *mesh, bool withP=false)
Proceeds the uniformly h-p refinement of mesh.
Contains the TPZFrontNonSym class which implements storage and decomposition process of the frontal m...
virtual void Solve(const TPZFMatrix< TVar > &F, TPZFMatrix< TVar > &result, TPZFMatrix< TVar > *residual=0)=0
Solves the system of linear equations.
virtual int NStateVariables() const =0
Returns the number of state variables associated with the material.
Declarates the TPZBlock<REAL>class which implements block matrices.
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Definition: pzgeoelside.h:83
void AppendSolver(TPZMatrixSolver< TVar > &solve)
Definition: pzseqsolver.cpp:30
virtual TPZSolver< TVar > * Clone() const override
Clones the current object returning a pointer of type TPZSolver.
Definition: pzseqsolver.cpp:25
int64_t NElements() const
Access method to query the number of elements of the vector.
REAL val(STATE &number)
Returns value of the variable.
Definition: pzartdiff.h:23
Implements a chunk vector with free store administration. Utility.
Definition: TPZStream.h:39
AutoPointerMutexArrayInit tmp
virtual const TPZIntPoints & GetIntegrationRule() const override=0
Returns a reference to an integration rule suitable for integrating the interior of the element...
virtual void Divide(TPZVec< TPZGeoEl *> &pv)
Divides the element and puts the resulting elements in the vector.
Definition: pzgeoel.h:742
Contains TPZBlockDiagonal class which defines block diagonal matrices.
TPZStack< TPZFMatrix< STATE > * > fSolutions
Contains the meshes solutions.
Definition: pzmganalysis.h:75
std::function< void(const TPZVec< REAL > &loc, TPZVec< STATE > &result, TPZFMatrix< STATE > &deriv)> fExact
Pointer to Exact solution function, it is necessary to calculating errors.
Definition: pzanalysis.h:99
Contains the TPZTransfer class which implements a rectangular sparse block matrix.
void LoadReferences()
Map this grid in the geometric grid.
Definition: pzcmesh.cpp:482
TPZStack< TPZMatrixSolver< STATE > * > fPrecondition
Contains the preconditioner of the solution method if the solution method is a krylov method...
Definition: pzmganalysis.h:82
int NShapeF() const override
Returns the total number of shapefunctions.
Definition: pzintel.cpp:63
TPZCompMesh * PopMesh()
Pop the last mesh of the meshes vector.
Implements SkyLine Structural Matrices. Structural Matrix.
static void MeshError(TPZCompMesh *fine, TPZCompMesh *coarse, TPZVec< REAL > &ervec, void(*f)(const TPZVec< REAL > &loc, TPZVec< STATE > &val, TPZFMatrix< STATE > &deriv), TPZVec< REAL > &truervec)
Evaluates the error between aproximation of coarse and fine meshes.
Contains the TPZBlockDiagonalStructMatrix class which implements Block Diagonal Structural Matrices...
void error(char *string)
Definition: testShape.cc:7
TPZMGAnalysis(TPZCompMesh *)
Creates an object multigrid analysis giving a computational mesh.
void BuildTransferMatrix(TPZCompMesh &coarsemesh, TPZTransfer< STATE > &transfer)
Builds the transfer matrix from the current grid to the coarse grid.
Definition: pzcmesh.cpp:883
virtual void Shape(TPZVec< REAL > &qsi, TPZFMatrix< REAL > &phi, TPZFMatrix< REAL > &dphidxi)=0
Computes the shape function set at the point x.
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
virtual ~TPZMGAnalysis()
Destructor.
virtual void GetInterpolationOrder(TPZVec< int > &ord)=0
Identifies the interpolation order of all connects of the element different from the corner connects...
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
void LoadSolution(const TPZFMatrix< STATE > &sol)
Given the solution of the global system of equations, computes and stores the solution for the restri...
Definition: pzcmesh.cpp:441
int64_t SequenceNumber() const
Returns the Sequence number of the connect object.
Definition: pzconnect.h:158
void SetCG(const int64_t numiterations, const TPZMatrixSolver< TVar > &pre, const REAL tol, const int64_t FromCurrent)
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
f
Definition: test.py:287
void AppendMesh(TPZCompMesh *mesh)
Append a mesh to the meshes vector.
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
void ComputeError(TPZVec< REAL > &error)
Loads the last two solutions and call the error between these two aproximations.
virtual void SetOrder(TPZVec< int > &ord, int type=0)=0
Sets the order of the cubature rule.
TPZCompMesh * Mesh() const
Return a pointer to the grid of the element.
Definition: pzcompel.cpp:288
Contains the TPZSkylineStructMatrix class which implements SkyLine Structural Matrices.
Definition: pzmatrix.h:52
void Jacobian(TPZVec< REAL > &qsi, TPZFMatrix< REAL > &jac, TPZFMatrix< REAL > &axes, REAL &detjac, TPZFMatrix< REAL > &jacinv) const
Compute a decomposition of the gradient of the mapping function, as a rotation matrix (Jacobian) and ...
Definition: pzgeoel.cpp:1144
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
Contains TPZSequenceSolver class which defines sequence solvers.
void SetTolerance(REAL tol)
Definition: pzstepsolver.h:51
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
Definition: pzcmesh.h:213
Represents a solution process in three steps: transfer of the residual, execute a solver on the coars...
Definition: pzmgsolver.h:21
int Exists() const
Verifies if the object is non null (initialized)
Definition: pzcompel.h:697
Contains TPZSkyline class which implements a skyline storage format.
int64_t Index() const
Returns element index of the mesh fELementVec list.
Definition: pzcompel.h:821
virtual int NConnects() const override=0
Returns the number of connect objects of the element.
virtual int PreferredSideOrder(int iside)=0
Returns the preferred order of the polynomial along side iside.
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
std::map< int,TPZMaterial *> & MaterialVec()
Returns a reference to the material pointers vector.
Definition: pzcmesh.h:203
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 TPZSolver * Clone() const =0
Clones the current object returning a pointer of type TPZSolver.
T Pop()
Retrieve an object from the stack.
Definition: pzstack.h:87
TPZCompEl * Element() const
Gives a pointer to the reference computational element.
Definition: pzcompel.h:675
REAL dist(TPZVec< T1 > &vec1, TPZVec< T1 > &vec2)
Definition: pzvec_extras.h:124
This class implements a very simple interface from PZ kernel to GUI. Module: Common.
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
Definition: pzcompel.cpp:1137
virtual void X(TPZVec< REAL > &qsi, TPZVec< REAL > &result) const =0
Return the coordinate in real space of the point coordinate in the master element space...
TPZCompElSide Reference() const
Returns a pointer to the elementside referenced by the geometric elementside.
TPZStack< TPZCompMesh *> fMeshes
Contains the computational meshes of one cycle.
Definition: pzmganalysis.h:72
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
Defines sequence solvers. Solver.
Definition: pzseqsolver.h:23
int Dimension() const
the dimension associated with the element/side
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
int Size(const int block_diagonal) const
Returns block dimension.
Definition: pzblock.h:171
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Definition: pzcmesh.h:183
clarg::argBool bd("-bd", "binary dump. Dump file format == binary.", false)
TPZAutoPointer< TPZMatrix< TVar > > Matrix() const
Returns a pointer to TPZMatrix<>
Definition: pzsolve.h:138
void PRefine(int order) override
Changes the interpolation order of a side. Updates all constraints and block sizes ...
Definition: pzintel.cpp:1592
Contains declaration of TPZInterpolatedElement class which implements computational element of the in...
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
Contains TPZStepSolver class which defines step solvers class.
int Exists() const
Definition: pzgeoelside.h:175
void CopyMaterials(TPZCompMesh &mesh) const
Copies the materials of this mesh to the given mesh.
Definition: pzcmesh.cpp:1797
TPZStack< TPZMatrixSolver< STATE > * > fSolvers
Contains the solution method applied to the mesh.
Definition: pzmganalysis.h:78
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
virtual void Solve()
Uses fSolver object to apply a solution algorithm.
Implements an affine transformation between points in parameter space. Topology Utility.
Definition: pzmganalysis.h:14
virtual TPZIntPoints * Clone() const =0
Make a clone of the related cubature rule.
void SetDirect(const DecomposeType decomp)
clarg::argInt porder("-porder", "polinomial order", 1)
Implements rectangular matrix which extends a solution vector of the coarse mesh to a solution vector...
Definition: pzcmesh.h:33
TPZFMatrix< STATE > fRhs
Load vector.
Definition: pzanalysis.h:48
static REAL ElementError(TPZInterpolatedElement *fine, TPZInterpolatedElement *coarse, TPZTransform<> &tr, void(*f)(const TPZVec< REAL > &loc, TPZVec< STATE > &val, TPZFMatrix< STATE > &deriv), REAL &truerror)
Calculates an element error based on two aproximations.
void ResetReference()
Resets all load references in elements and nodes.
Definition: pzgmesh.cpp:197
void AssembleBlockDiagonal(TPZBlockDiagonal< STATE > &block)
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
virtual TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
Definition: pzstrmatrix.h:100
TPZFMatrix< STATE > & Solution()
Access the solution vector.
Definition: pzcmesh.h:219
Contains TPZMGAnalysis class which implements multigrid analysis.
void Apply(TPZVec< T > &vectorin, TPZVec< T > &vectorout)
Transforms the vector.
Definition: pztrnsform.cpp:121
Implements computational element based on an interpolation space. Computational Element.
Definition: pzintel.h:27
virtual void Point(int i, TPZVec< REAL > &pos, REAL &w) const =0
Returns i-th point at master element and related weight.
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
This class implements a reference counter mechanism to administer a dynamically allocated object...