NeoPZ
skyline.cpp
Go to the documentation of this file.
1 
8 #ifdef HAVE_CONFIG_H
9 #include <pz_config.h>
10 #endif
11 
12 #include <iostream>
13 #include <cstdlib>
14 
15 #include "pzbfilestream.h" // TPZBFileStream, TPZFileStream
16 #include "pzmd5stream.h"
17 
18 #include "tpzdohrsubstruct.h"
19 #include "tpzdohrmatrix.h"
20 #include "tpzdohrprecond.h"
21 #include "pzdohrstructmatrix.h"
22 #include "pzstepsolver.h"
23 #include "pzcompel.h"
24 #include "pzgeoelbc.h"
25 
26 #include "pzelast3d.h"
27 #include "pzbndcond.h"
28 
29 #include "tpzdohrassembly.h"
30 
31 #include "pzlog.h"
32 #include "tpzgensubstruct.h"
33 #include "tpzpairstructmatrix.h"
34 #include "pzviscoelastic.h"
35 #include "TPZTimer.h"
36 #include "TPZVTKGeoMesh.h"
37 #include "pzgeotetrahedra.h"
38 #include "pzskylstrmatrix.h"
39 
40 #include "pzskylmat.h"
41 
42 #include "tpzarc3d.h"
43 #include "tpzdohrmatrix.h"
44 
45 #include "pzvtkmesh.h"
46 
47 #include "pzlog.h"
48 
49 #include <fstream>
50 #include <string>
51 
52 #ifdef LOG4CXX
53 static LoggerPtr loggerconverge(Logger::getLogger("pz.converge"));
54 static LoggerPtr logger(Logger::getLogger("main"));
55 #endif
56 
57 #include "pzskylmat.h"
58 
59 //#include "timing_analysis.h"
60 #include "arglib.h"
61 #include "run_stats_table.h"
62 
63 #ifdef HAS_GETRUSAGE
64 #include <sys/resource.h> // getrusage
65 #endif
66 
67 #ifdef USING_TBB
68 #include "tbb/task_scheduler_init.h"
69 using namespace tbb;
70 // If you have issues with: dyld: Library not loaded: libtbb.dylib
71 // try setting the LD path. Ex:
72 // export DYLD_FALLBACK_LIBRARY_PATH=/Users/borin/Desktop/neopz/tbb40_297oss/lib/
73 #endif
74 
75 using namespace std;
76 
78 TPZGeoMesh *MalhaCubo(string FileName);
79 void SetPointBC(TPZGeoMesh *gr, TPZVec<REAL> &x, int bc);
80 
81 void CopyTo(TPZSkylMatrix <REAL> * skylmat, TPZSkylMatrix<TPZFlopCounter> &fp_counter);
82 void PrintInfo (string funct, TPZCounter info);
83 
84 void help(const char* prg)
85 {
86  cout << "Compute the Decompose_Cholesky, Decompose_LDLt, MultAdd methods for a matrix generated of a mesh" << endl;
87  cout << endl;
88  cout << "Usage: " << prg << "-if file [-v verbose_level] "
89  << "[-clk_rdt rdt_file1] [-ldlt_rdt rdt_file2] [-mult_rdt rdt_file3] [-h]" << endl << endl;
90  clarg::arguments_descriptions(cout, " ", "\n");
91 }
92 
93 
94 clarg::argBool h("-h", "help message", false);
95 clarg::argBool print_flops("-pf", "print floating point operations", false);
96 
97 clarg::argInt verb_level("-v", "verbosity level", 0);
98 int verbose = 0;
99 /* Verbose macro. */
100 #define VERBOSE(level,...) if (level <= verbose) cout << __VA_ARGS__
101 
102 clarg::argInt porder("-porder", "polinomial order", 1);
103 clarg::argString input("-if", "input file", "cube1.txt");
104 
106 //clarg::argString ifn("-ifn", "input matrix file name (use -bi to read from binary files)", "matrix.txt");
107 //clarg::argBool br("-br", "binary reference. Reference decomposed matrix file format == binary.", false);
108 //clarg::argBool bi("-bi", "binary input. Input file format == binary.", false);
109 //clarg::argBool bd("-bd", "binary dump. Dump file format == binary.", false);
110 
112 //clarg::argString gen_dm_sig("-gen_dm_md5", "generates MD5 signature for decomposed matrix into file.", "decomposed_matrix.md5");
113 //clarg::argString chk_dm_sig("-chk_dm_md5", "compute MD5 signature for decomposed matrix and check against MD5 at file.", "decomposed_matrix.md5");
114 //clarg::argString chk_dm_error("-chk_dm_error", "check the decomposed matrix error against a reference matrix. (use -br to read from binary files)", "ref_decomposed_matrix.txt");
115 //clarg::argDouble error_tol("-error_tol", "error tolerance.", 1.e-12);
116 
118 //clarg::argString dump_dm("-dump_dm", "dump decomposed matrix. (use -bd for binary format)", "dump_matrix.txt");
119 
120 
121 /* Run statistics. */
122 RunStatsTable clk_rst("-clk_rdt", "Decompose_Cholesky() statistics raw data table");
123 RunStatsTable ldlt_rst("-ldlt_rdt", "Decompose_LDLt() statistics raw data table");
124 RunStatsTable sfwd_rst("-sfwd_rdt", "Subst_Forward(...) statistics raw data table");
125 RunStatsTable sbck_rst("-sbck_rdt", "Subst_Backward(...) statistics raw data table");
126 RunStatsTable mult_rst("-mult_rdt", "MultAdd(...) statistics raw data table");
127 RunStatsTable sor_rst("-sor_rdt", "SolveSOR(...) statistics raw data table");
128 
129 
130 class FileStreamWrapper
131 {
132 public:
133  FileStreamWrapper(bool b) : binary(b) {}
135 
136  void OpenWrite(const std::string& fn)
137  {
138  if (binary)
139  bfs.OpenWrite(fn);
140  else
141  fs.OpenWrite(fn);
142  }
143 
144  void OpenRead(const std::string& fn)
145  {
146  if (binary)
147  bfs.OpenRead(fn);
148  else
149  fs.OpenRead(fn);
150  }
151 
152  operator TPZStream&()
153  {
154  if (binary)
155  return bfs;
156  else
157  return fs;
158  }
159 
160 protected:
161 
162  bool binary;
163  TPZFileStream fs;
164  TPZBFileStream bfs;
165 };
166 
167 
168 #include <sched.h> //sched_getcpu
169 
170 //template class TPZSkylMatrix<TPZFlopCounter>;
171 //template class TPZMatrix<TPZFlopCounter>;
172 //template class TPZAutoPointer<TPZMatrix<TPZFlopCounter> >;
173 
174 #ifdef USING_PAPI
175 #include <papi.h>
176 #endif
177 
178 int main(int argc, char *argv[])
179 {
180  int dim = 3;
181 
182  /* Parse the arguments */
183  if (clarg::parse_arguments(argc, argv)) {
184  cerr << "Error when parsing the arguments!" << endl;
185  return 1;
186  }
187 
188  verbose = verb_level.get_value();
189 
190  if (h.get_value() == true) {
191  help(argv[0]);
192  return 1;
193  }
194 
195  if (verbose >= 1) {
196  std::cout << "- Arguments -----------------------" << std::endl;
197  clarg::values(std::cout, false);
198  std::cout << "-----------------------------------" << std::endl;
199  }
200 
201  /* Generating matrix. */
202 
203 
204  TPZGeoMesh *gmesh = 0;
205 
207 
208  gmesh = MalhaCubo(input.get_value());
209  cmesh = new TPZCompMesh(gmesh);
210  cmesh->SetDimModel(dim);
211  InsertElasticityCubo(cmesh);
212  cmesh->SetDefaultOrder(porder.get_value());
213  cmesh->AutoBuild();
214  int64_t neq = cmesh->NEquations();
215  cout << "numero de equacoes = " << neq << endl;
216 
217  // Gerando a matriz
218  TPZAnalysis an(cmesh);
219  TPZSkylineStructMatrix skyl(cmesh);
220  an.SetStructuralMatrix(skyl);
221  TPZStepSolver<REAL> step;
222  step.SetDirect(ECholesky);
223  an.SetSolver(step);
224  an.Assemble();
226  skylmat1 = an.Solver().Matrix();
227  TPZSkylMatrix<REAL> *orig = dynamic_cast<TPZSkylMatrix<REAL> *> (skylmat1.operator->());
228  TPZAutoPointer<TPZMatrix<REAL> > skylmat2 = skylmat1->Clone();
229  TPZAutoPointer<TPZMatrix<REAL> > skylmat3 = skylmat1->Clone();
230  TPZAutoPointer<TPZMatrix<REAL> > skylmat4 = skylmat1->Clone();
231  TPZFMatrix<REAL> f(neq,1,M_PI);
232  TPZFMatrix<TPZFlopCounter > f2(neq,1,M_PI);
237 
238  CopyTo(orig,fp1);
239  CopyTo(orig,fp2);
240  CopyTo(orig,fp3);
241  CopyTo(orig,fp4);
242 
243  if (clk_rst.was_set()) {
244  clk_rst.start();
245  skylmat1->Decompose_Cholesky();
246  clk_rst.stop();
247  if (print_flops.was_set()) {
249  fp1.Decompose_Cholesky();
250  c = TPZFlopCounter::gCount - c;
251  PrintInfo("Decompose_Cholesky()", c);
252  }
253  }
254 
255  if (ldlt_rst.was_set()) {
256  ldlt_rst.start();
257  skylmat2->Decompose_LDLt();
258  ldlt_rst.stop();
259  if (print_flops.was_set()) {
261  fp2.Decompose_LDLt();
262  c = TPZFlopCounter::gCount - c;
263  PrintInfo("Decompose_LDLt()", c);
264  }
265  }
266 
267  if (sfwd_rst.was_set()) {
268  if (!clk_rst.was_set()) skylmat1->Decompose_Cholesky();
269  sfwd_rst.start();
270 #ifdef USING_PAPI
271  float rtime1, ptime1, mflops1;
272  int64_t flpops1;
273  PAPI_flops ( &rtime1, &ptime1, &flpops1, &mflops1 );
274 #endif
275  skylmat1->Subst_Forward(&f);
276 #ifdef USING_PAPI
277  float rtime2, ptime2, mflops2;
278  int64_t flpops2;
279  PAPI_flops ( &rtime2, &ptime2, &flpops2, &mflops2 );
280 #endif
281  sfwd_rst.stop();
282 #ifdef USING_PAPI
283  cout << "skylmat1->Subst_Forward(&f)" << endl;
284  cout << " rtime: " << rtime2-rtime1 << endl;
285  cout << " ptime: " << ptime2-ptime1 << endl;
286  cout << " flpops: " << flpops2-flpops1 << endl;
287  cout << " mflops: " << mflops2-mflops1 << endl;
288 #endif
289  if (print_flops.was_set()) {
291  fp1.Subst_Forward(&f2);
292  c = TPZFlopCounter::gCount - c;
293  PrintInfo("Subst_Forward(...)", c);
294  }
295  }
296 
297  if (sbck_rst.was_set()){
298  if (!clk_rst.was_set()) skylmat1->Decompose_Cholesky();
299  sbck_rst.start();
300  skylmat1->Subst_Backward(&f);
301  sbck_rst.stop();
302  if (print_flops.was_set()) {
304  fp1.Subst_Backward(&f2);
305  c = TPZFlopCounter::gCount - c;
306  PrintInfo("Subst_Backward(...)", c);
307  }
308  }
309 
310  if (sor_rst.was_set()) {
311  TPZFMatrix<REAL> res(neq,1);
312  TPZFMatrix<REAL> residual(neq,1);
313  TPZFMatrix<REAL> scratch(neq,neq);
314  int64_t niter = 10;
315  REAL overrelax = 1.1;
316  REAL tol = 10e-7;
317  sor_rst.start();
318  //skylmat4->SolveSOR(niter, *f, res, &residual, scratch, overrelax, tol);
319  sor_rst.stop();
320  if (print_flops.was_set()) {
321  TPZFMatrix<TPZFlopCounter> f3(neq, 1);
322  TPZFMatrix<TPZFlopCounter> res2(neq,1);
323  TPZFMatrix<TPZFlopCounter> residual2(neq,1);
324  TPZFMatrix<TPZFlopCounter> scratch2(neq,neq);
326  fp3.SolveSOR(niter, f3, res2, &residual2, scratch2, overrelax, tol);
327  c = TPZFlopCounter::gCount - c;
328  PrintInfo("SolveSOR(...)", c);
329  }
330  }
331 
332  if (mult_rst.was_set()) {
333  TPZFMatrix<REAL> result(neq,neq);
334  mult_rst.start();
335  skylmat3->MultAdd(result, result, result, 1., 0);
336  mult_rst.stop();
337  if (print_flops.was_set()) {
338  TPZFMatrix<TPZFlopCounter> result2(neq,neq);
340  fp4.MultAdd(result2, result2, result2, 1., 0);
341  c = TPZFlopCounter::gCount - c;
342  PrintInfo("MultAdd(...)", c);
343  }
344  }
345 
346  return 0;
347 
348 }
349 
351 {
352  mesh->SetDimModel(3);
353  int nummat = 1, neumann = 1, mixed = 2;
354  // int dirichlet = 0;
355  int dir1 = -1, dir2 = -2, dir3 = -3, neumann1 = -4., neumann2 = -5; //, dirp2 = -6;
356  TPZManVector<STATE> force(3,0.);
357  //force[1] = 0.;
358 
359  STATE ElaE = 1000., poissonE = 0.2; //, poissonV = 0.1, ElaV = 100.;
360 
361  STATE lambdaV = 0, muV = 0, alpha = 0, deltaT = 0;
362  lambdaV = 11.3636;
363  muV = 45.4545;
364  alpha = 1.;
365  deltaT = 0.01;
366 
367  //TPZViscoelastic *viscoelast = new TPZViscoelastic(nummat);
368  //viscoelast->SetMaterialDataHooke(ElaE, poissonE, ElaV, poissonV, alpha, deltaT, force);
369  //TPZViscoelastic *viscoelast = new TPZViscoelastic(nummat, ElaE, poissonE, lambdaV, muV, alphaT, force);
370  TPZElasticity3D *viscoelast = new TPZElasticity3D(nummat, ElaE, poissonE, force);
371 
372  TPZFNMatrix<6> qsi(6,1,0.);
373  //viscoelast->SetDefaultMem(qsi); //elast
374  //int index = viscoelast->PushMemItem(); //elast
375  TPZMaterial * viscoelastauto(viscoelast);
376  mesh->InsertMaterialObject(viscoelastauto);
377 
378  // Neumann em x = 1;
379  TPZFMatrix<STATE> val1(3,3,0.),val2(3,1,0.);
380  val2(0,0) = 1.;
381  TPZBndCond *bc4 = viscoelast->CreateBC(viscoelastauto, neumann1, neumann, val1, val2);
382  TPZMaterial * bcauto4(bc4);
383  mesh->InsertMaterialObject(bcauto4);
384 
385  // Neumann em x = -1;
386  val2(0,0) = -1.;
387  TPZBndCond *bc5 = viscoelast->CreateBC(viscoelastauto, neumann2, neumann, val1, val2);
388  TPZMaterial * bcauto5(bc5);
389  mesh->InsertMaterialObject(bcauto5);
390 
391  val2.Zero();
392  // Dirichlet em -1 -1 -1 xyz;
393  val1(0,0) = 1e4;
394  val1(1,1) = 1e4;
395  val1(2,2) = 1e4;
396  TPZBndCond *bc1 = viscoelast->CreateBC(viscoelastauto, dir1, mixed, val1, val2);
397  TPZMaterial * bcauto1(bc1);
398  mesh->InsertMaterialObject(bcauto1);
399 
400  // Dirichlet em 1 -1 -1 yz;
401  val1(0,0) = 0.;
402  val1(1,1) = 1e4;
403  val1(2,2) = 1e4;
404  TPZBndCond *bc2 = viscoelast->CreateBC(viscoelastauto, dir2, mixed, val1, val2);
405  TPZMaterial * bcauto2(bc2);
406  mesh->InsertMaterialObject(bcauto2);
407 
408  // Dirichlet em 1 1 -1 z;
409  val1(0,0) = 0.;
410  val1(1,1) = 0.;
411  val1(2,2) = 1e4;
412  TPZBndCond *bc3 = viscoelast->CreateBC(viscoelastauto, dir3, mixed, val1, val2);
413  TPZMaterial * bcauto3(bc3);
414  mesh->InsertMaterialObject(bcauto3);
415 
416 }
417 
418 TPZGeoMesh *MalhaCubo(string FileName)
419 {
420  int numnodes=-1;
421  int numelements=-1;
422 
423  {
424  bool countnodes = false;
425  bool countelements = false;
426 
427  ifstream read (FileName.c_str());
428 
429  while(read)
430  {
431  char buf[1024];
432  read.getline(buf, 1024);
433  std::string str(buf);
434  if(str == "Coordinates") countnodes = true;
435  if(str == "end coordinates") countnodes = false;
436  if(countnodes) numnodes++;
437 
438  if(str == "Elements") countelements = true;
439  if(str == "end elements") countelements = false;
440  if(countelements) numelements++;
441  }
442  }
443 
444  TPZGeoMesh * gMesh = new TPZGeoMesh;
445 
446  gMesh -> NodeVec().Resize(numnodes);
447 
448  TPZManVector <int64_t> TopolTetra(4);
449 
450  const int Qnodes = numnodes;
451  TPZVec <TPZGeoNode> Node(Qnodes);
452 
453  //setting nodes coords
454  int64_t nodeId = 0, elementId = 0, matElId = 1;
455 
456  ifstream read;
457  read.open(FileName.c_str());
458 
459  double nodecoordX , nodecoordY , nodecoordZ ;
460 
461  char buf[1024];
462  read.getline(buf, 1024);
463  read.getline(buf, 1024);
464  std::string str(buf);
465  int in;
466  for(in=0; in<numnodes; in++)
467  {
468  read >> nodeId;
469  read >> nodecoordX;
470  read >> nodecoordY;
471  read >> nodecoordZ;
472  Node[nodeId-1].SetNodeId(nodeId);
473  Node[nodeId-1].SetCoord(0,nodecoordX);
474  Node[nodeId-1].SetCoord(1,nodecoordY);
475  Node[nodeId-1].SetCoord(2,nodecoordZ);
476  gMesh->NodeVec()[nodeId-1] = Node[nodeId-1];
477  }
478 
479  {
480  read.close();
481  read.open(FileName.c_str());
482 
483  int l , m = numnodes+5;
484  for(l=0; l<m; l++)
485  {
486  read.getline(buf, 1024);
487  }
488 
489 
490  int el;
491  int neumann1 = -4, neumann2 = -5;
492  //std::set<int> ncoordz; //jeitoCaju
493  for(el=0; el<numelements; el++)
494  {
495  read >> elementId;
496  read >> TopolTetra[0]; //node 1
497  read >> TopolTetra[1]; //node 2
498  read >> TopolTetra[2]; //node 3
499  read >> TopolTetra[3]; //node 4
500 
501  // O GID comeca com 1 na contagem dos nodes, e nao zero como no PZ, assim o node 1 na verdade é o node 0
502  TopolTetra[0]--;
503  TopolTetra[1]--;
504  TopolTetra[2]--;
505  TopolTetra[3]--;
506 
507  int64_t index = el;
508 
509  new TPZGeoElRefPattern< pzgeom::TPZGeoTetrahedra> (index, TopolTetra, matElId, *gMesh);
510  }
511 
512  gMesh->BuildConnectivity();
513 
514  // Colocando as condicoes de contorno
515  for(el=0; el<numelements; el++)
516  {
517  TPZManVector <TPZGeoNode,4> Nodefinder(4);
518  TPZManVector <REAL,3> nodecoord(3);
519  TPZGeoEl *tetra = gMesh->ElementVec()[el];
520 
521  // na face x = 1
522  TPZVec<int64_t> ncoordzVec(0); int64_t sizeOfVec = 0;
523  for (int i = 0; i < 4; i++)
524  {
525  int pos = tetra->NodeIndex(i);
526  Nodefinder[i] = gMesh->NodeVec()[pos];
527  Nodefinder[i].GetCoordinates(nodecoord);
528  if (nodecoord[0] == 1.)
529  {
530  sizeOfVec++;
531  ncoordzVec.Resize(sizeOfVec);
532  ncoordzVec[sizeOfVec-1] = pos;
533  }
534  }
535  if(ncoordzVec.NElements() == 3)
536  {
537  int lado = tetra->WhichSide(ncoordzVec);
538  TPZGeoElSide tetraSide(tetra, lado);
539  TPZGeoElBC(tetraSide,neumann1);
540  }
541 
542  // Na face x = -1
543  ncoordzVec.Resize(0);
544  sizeOfVec = 0;
545  for (int i = 0; i < 4; i++)
546  {
547  int pos = tetra->NodeIndex(i);
548  Nodefinder[i] = gMesh->NodeVec()[pos];
549 
550  Nodefinder[i].GetCoordinates(nodecoord);
551  if (nodecoord[0] == -1.)
552  {
553  sizeOfVec++;
554  ncoordzVec.Resize(sizeOfVec);
555  ncoordzVec[sizeOfVec-1] = pos;
556  }
557  }
558  if(ncoordzVec.NElements() == 3)
559  {
560  int lado = tetra->WhichSide(ncoordzVec);
561  TPZGeoElSide tetraSide(tetra, lado);
562  TPZGeoElBC(tetraSide,neumann2);
563  }
564 
565  }
566 
567  TPZVec <REAL> xyz(3,-1.), yz(3,-1.), z(3,1.);
568  yz[0] = 1.;
569  z[2] = -1;
570  int bcidxyz = -1, bcidyz = -2, bcidz = -3;
571  SetPointBC(gMesh, xyz, bcidxyz);
572  SetPointBC(gMesh, yz, bcidyz);
573  SetPointBC(gMesh, z, bcidz);
574 
575  }
576 
577  int iref, nref=1;
578  TPZVec <TPZGeoEl*> sons;
579  for (iref=0; iref<nref; iref++)
580  {
581  int nelements = gMesh->NElements();
582  for (int iel=0; iel<nelements; iel++)
583  {
584  TPZGeoEl * gel = gMesh->ElementVec()[iel];
585  if (!gel) DebugStop();
586  if(!gel->HasSubElement()) gel->Divide(sons);
587  }
588  }
589 
590  ofstream arg("malhaPZ1BC.txt");
591  gMesh->Print(arg);
592 
593  std::ofstream out("Cube.vtk");
594  TPZVTKGeoMesh::PrintGMeshVTK(gMesh, out, true);
595 
596  return gMesh;
597 }
598 
601 {
602  // look for an element/corner node whose distance is close to start
603  TPZGeoNode *gn1 = gr->FindNode(x);
604  int64_t iel;
605  int64_t nelem = gr->ElementVec().NElements();
606  TPZGeoEl *gel;
607  for (iel = 0; iel<nelem; iel++) {
608  gel = gr->ElementVec()[iel];
609  if(!gel) continue;
610  int nc = gel->NCornerNodes();
611  int c;
612  for (c=0; c<nc; c++) {
613  TPZGeoNode *gn = gel->NodePtr(c);
614  if (gn == gn1) {
615  break;
616  }
617  }
618  if (c<nc) {
619  TPZGeoElBC(gel, c, bc);
620  return;
621  }
622  }
623 }
624 
626 {
627  fp_counter.Redim(skylmat1->Rows(),skylmat1->Cols());
628  TPZVec <int64_t> skylvec(skylmat1->Rows());
629  for (int64_t i = 0; i < skylmat1->Rows(); i++) {
630  skylvec[i] = i - skylmat1->Size(i) + 1 ;
631  }
632 
633  fp_counter.SetSkyline(skylvec);
634  for (int i = 0; i < skylmat1->Rows(); i++) {
635  for (int j = 0 ; j < skylmat1->Cols(); j++) {
636  fp_counter.PutVal(i, j, skylmat1->GetVal(i,j));
637  }
638  }
639 }
640 
641 void PrintInfo (string funct, TPZCounter info)
642 {
643  cout << "Printing flop count info of " << funct << endl;
644  info.Print();
645  cout << "****************************" << endl;
646  return;
647 }
static TPZCounter gCount
Containts the counter vector by operation performed.
Definition: pzreal.h:270
Contains a class to record running statistics on CSV tables.
void InsertElasticityCubo(TPZAutoPointer< TPZCompMesh > mesh)
Definition: skyline.cpp:350
void PrintInfo(string funct, TPZCounter info)
Definition: skyline.cpp:641
TPZGeoNode * NodePtr(int i) const
Returns a pointer to the ith node of the element.
Definition: pzgeoel.cpp:2566
TPZGeoMesh * MalhaCubo(string FileName)
Definition: skyline.cpp:418
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
Contains declaration of the TPZMD5Stream class which implements the interface to write and check md5 ...
void SetStructuralMatrix(TPZAutoPointer< TPZStructMatrix > strmatrix)
Set structural matrix as auto pointer for analysis.
Definition: pzanalysis.cpp:82
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
clarg::argBool h("-h", "help message", false)
clarg::argBool bc("-bc", "binary checkpoints", false)
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: pzskylmat.cpp:2130
Timing class. Absolutely copied from GNU time. Take a look at
Contains the TPZDohrSubstruct class which implements sub structure matrices using Dohrman algorithm...
void values(ostream &os, bool defined_only)
Definition: arglib.cpp:183
void OpenRead(const std::string &fn)
Definition: skyline.cpp:144
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...
Defines step solvers class. Solver.
Definition: pzmganalysis.h:17
void SetSolver(TPZMatrixSolver< STATE > &solver)
Set solver matrix.
virtual int NCornerNodes() const =0
Returns the number of corner nodes of the element.
This class implements a 3D isotropic elasticity material.
Definition: pzelast3d.h:21
Contains the TPZDohrMatrix class which implements a matrix divided into substructures. Also contains the TPZDohrThreadMultData and TPZDohrThreadMultList structs.
virtual void Assemble()
Assemble the stiffness matrix and load vector.
Definition: pzanalysis.cpp:304
int Decompose_Cholesky() override
Decomposes the current matrix using Cholesky method. The current matrix has to be symmetric...
Definition: pzskylmat.cpp:2668
int64_t NElements() const
Number of elements of the mesh.
Definition: pzgmesh.h:129
virtual TPZMatrix< TVar > * Clone() const =0
Utility class which represents an element with its side. The Geometric approximation classes Geometry...
Definition: pzgeoelside.h:83
Contains declaration of TPZGeoElBC class, it is a structure to help the construction of geometric ele...
clarg::argString input("-if", "input file", "cube1.txt")
int64_t NElements() const
Access method to query the number of elements of the vector.
void OpenWrite(const std::string &fn)
Definition: skyline.cpp:136
int main(int argc, char *argv[])
Definition: skyline.cpp:178
virtual void Divide(TPZVec< TPZGeoEl *> &pv)
Divides the element and puts the resulting elements in the vector.
Definition: pzgeoel.h:742
virtual int64_t NodeIndex(int i) const =0
Returns the index of the ith node the index is the location of the node in the nodevector of the mesh...
Contains the TPZDohrAssembly class which implements assembling using Dohrmann algorithm.
TPZMatrixSolver< STATE > & Solver()
Get the solver matrix.
Definition: pzanalysis.h:367
void CopyTo(TPZSkylMatrix< REAL > *skylmat, TPZSkylMatrix< TPZFlopCounter > &fp_counter)
Definition: skyline.cpp:625
static TPZGraphNode gn
Definition: pzgraphmesh.cpp:76
int WhichSide(TPZVec< int64_t > &SideNodeIds)
Returns the side number which is connected to the SideNodes returns -1 if no side is found...
Definition: pzgeoel.cpp:165
Implements a skyline storage format. A Skyline matrix is symmetric so square. Matrix.
Definition: pzskylmat.h:394
Contains the TPZDohrStructMatrix class which implements structural matrix divided in sub structures...
const int bc3
Definition: main.cpp:88
fn
Definition: test.py:253
TPZGeoNode * FindNode(TPZVec< REAL > &co)
Returns the nearest node to the coordinate. This method is VERY INEFFICIENT.
Definition: pzgmesh.cpp:419
Contains the TPZElasticity3D class which implements a 3D isotropic elasticity material.
const int bc4
Definition: main.cpp:89
clarg::argBool print_flops("-pf", "print floating point operations", false)
Implements SkyLine Structural Matrices. Structural Matrix.
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
RunStatsTable sbck_rst("-sbck_rdt", "Subst_Backward(...) statistics raw data table")
int Zero() override
Makes Zero all the elements.
Definition: pzfmatrix.h:651
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 the TPZGenSubStruct class which is an interface to "feed" the datastructure of the Dohrmann ...
int Subst_Forward(TPZFMatrix< TVar > *b) const override
Computes B = Y, where A*Y = B, A is lower triangular.
Definition: pzskylmat.cpp:3034
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 SetSkyline(const TPZVec< int64_t > &skyline)
modify the skyline of the matrix, throwing away its values skyline indicates the minimum row number w...
Definition: pzskylmat.cpp:1792
f
Definition: test.py:287
RunStatsTable mult_rst("-mult_rdt", "MultAdd(...) statistics raw data table")
Implements reading from and writing to an ascii file. Persistency.
Definition: TPZFileStream.h:15
virtual void Print(std::ostream &out=std::cout) const
Print the information of the grid to an ostream.
Definition: pzgmesh.cpp:130
Implements a generic geometric element which is refined according to a generic refinement pattern...
Definition: pzgmesh.h:35
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
Contains the TPZGeoTetrahedra class which implements the geometry of a tetrahedral element...
void Print(std::ostream &out=std::cout) const
Definition: pzreal.cpp:32
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
int parse_arguments(int argc, char *argv[])
Definition: arglib.cpp:195
def read(filename)
Definition: stats.py:13
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
Contains the TPZSkylineStructMatrix class which implements SkyLine Structural Matrices.
void SetPointBC(TPZGeoMesh *gr, TPZVec< REAL > &x, int bc)
Generate a boundary geometric element at the indicated node.
Definition: skyline.cpp:600
TPZAdmChunkVector< TPZGeoNode > & NodeVec()
Definition: pzgmesh.h:140
Contains the TPZDohrPrecond class which implements a matrix which computes the preconditioner develop...
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
int Decompose_LDLt() override
Decomposes the current matrix using LDLt.
Definition: pzskylmat.cpp:2952
void help(const char *prg)
Definition: skyline.cpp:84
string res
Definition: test.py:151
Contains the TPZPairStructMatrix class.
Contains TPZSkyline class which implements a skyline storage format.
int64_t Size(const int64_t column) const
Definition: pzskylmat.h:558
RunStatsTable sor_rst("-sor_rdt", "SolveSOR(...) statistics raw data table")
void arguments_descriptions(ostream &os, string prefix, string suffix)
Definition: arglib.cpp:189
RunStatsTable sfwd_rst("-sfwd_rdt", "Subst_Forward(...) statistics raw data table")
static void PrintGMeshVTK(TPZGeoMesh *gmesh, std::ofstream &file, bool matColor=true)
Default constructor for graphical mesh with VTK format.
int Subst_Backward(TPZFMatrix< TVar > *b) const override
Computes B = Y, where A*Y = B, A is upper triangular.
Definition: pzskylmat.cpp:3086
void SetDimModel(int dim)
Set de dimension of the domain of the problem.
Definition: pzcmesh.h:139
virtual void MultAdd(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha, const TVar beta, const int opt=0) const override
It computes z = beta * y + alpha * opt(this)*x but z and x can not overlap in memory.
Definition: pzskylmat.cpp:1944
int Redim(const int64_t newDim, const int64_t) override
Redimensions the matrix reinitializing it with zero.
Definition: pzskylmat.cpp:2516
int verbose
Definition: skyline.cpp:98
virtual int HasSubElement() const =0
Return 1 if the element has subelements.
Structure to help the construction of geometric elements along side of a given geometric element...
Definition: pzgeoelbc.h:21
virtual void SolveSOR(int64_t &numiterations, const TPZFMatrix< TVar > &F, TPZFMatrix< TVar > &result, TPZFMatrix< TVar > *residual, TPZFMatrix< TVar > &scratch, const REAL overrelax, REAL &tol, const int FromCurrent=0, const int direction=1) override
Solves the linear system using Successive Over Relaxation method (Gauss Seidel). ...
Definition: pzskylmat.cpp:1988
void BuildConnectivity()
Build the connectivity of the grid.
Definition: pzgmesh.cpp:967
virtual TPZBndCond * CreateBC(TPZMaterial *reference, int id, int typ, TPZFMatrix< STATE > &val1, TPZFMatrix< STATE > &val2)
Creates an object TPZBndCond derived of TPZMaterial.
RunStatsTable ldlt_rst("-ldlt_rdt", "Decompose_LDLt() statistics raw data table")
int InsertMaterialObject(TPZMaterial *mat)
Insert a material object in the datastructure.
Definition: pzcmesh.cpp:287
int PutVal(const int64_t row, const int64_t col, const TVar &element) override
Put values without bounds checking This method is faster than "Put" if DEBUG is defined.
Definition: pzskylmat.cpp:1920
Implements a counter by operations. Common.
Definition: pzreal.h:111
Contains the TPZArc3D class which implements three dimensional arc.
Implements a geometric node in the pz environment. Geometry.
Definition: pzgnode.h:31
FileStreamWrapper(bool b)
Definition: skyline.cpp:133
This class implements a geometric mesh for the pz environment. Geometry.
Definition: pzgmesh.h:48
bool was_set() const
Definition: arglib.h:138
const int bc1
Definition: main.cpp:86
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
const T & get_value() const
Definition: arglib.h:177
TPZAutoPointer< TPZMatrix< TVar > > Matrix() const
Returns a pointer to TPZMatrix<>
Definition: pzsolve.h:138
Contains TPZStepSolver class which defines step solvers class.
const int bc2
Definition: main.cpp:87
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
bool was_set() const
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
void SetDirect(const DecomposeType decomp)
clarg::argInt porder("-porder", "polinomial order", 1)
clarg::argString m("-m", "input matrix file name (text format)", "matrix.txt")
Contains the TPZVTKGeoMesh class which implements the graphical mesh to VTK environment to geometric ...
RunStatsTable clk_rst("-clk_rdt", "Decompose_Cholesky() statistics raw data table")
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716
clarg::argInt verb_level("-v", "verbosity level", 0)
TPZAdmChunkVector< TPZGeoEl * > & ElementVec()
Methods for handling pzlists.
Definition: pzgmesh.h:138