NeoPZ
TPZSBFemElementGroup.cpp
Go to the documentation of this file.
1 //
2 // TPZSBFemElementGroup.cpp
3 // PZ
4 //
5 // Created by Philippe Devloo on 4/4/16.
6 //
7 //
8 
9 #include "TPZSBFemElementGroup.h"
10 #include "TPZSBFemVolume.h"
11 #include "pzcmesh.h"
12 
13 #ifdef USING_MKL
14 #include <mkl.h>
15 #elif MACOSX
16 #include <Accelerate/Accelerate.h>
17 #endif
18 
19 #ifdef COMPUTE_CRC
20 #ifdef USING_BOOST
21 #include "boost/crc.hpp"
22 extern TPZVec<boost::crc_32_type::value_type> matglobcrc, eigveccrc, stiffcrc, matEcrc, matEInvcrc;
23 #endif
24 #endif
25 
26 #ifdef LOG4CXX
27 static LoggerPtr logger(Logger::getLogger("pz.mesh.sbfemelementgroup"));
28 static LoggerPtr loggerMT(Logger::getLogger("pz.mesh.sbfemelementgroupMT"));
29 #endif
30 
31 
38 {
39  std::map<int64_t,int64_t> locindex;
40  int64_t ncon = fConnectIndexes.size();
41  for (int64_t ic=0; ic<ncon ; ic++) {
42  locindex[fConnectIndexes[ic]] = ic;
43  }
45  int64_t nel = fElGroup.size();
50  for (int64_t el = 0; el<nel; el++) {
51  TPZCompEl *cel = fElGroup[el];
52  TPZSBFemVolume *sbfem = dynamic_cast<TPZSBFemVolume *>(cel);
53 #ifdef PZDEBUG
54  if (!sbfem) {
55  DebugStop();
56  }
57 #endif
62  sbfem->ComputeKMatrices(E0Loc, E1Loc, E2Loc,M0Loc);
63 
64 // boost::crc_32_type crc;
65 // crc.process_bytes(&E0Loc.fMat(0,0),E0Loc.fMat.Rows()*E0Loc.fMat.Rows()*sizeof(STATE));
66 // EMatcrc[cel->Index()]= crc.checksum();
67 #ifdef LOG4CXX
68  if (logger->isDebugEnabled()) {
69  TPZGeoEl *gel = cel->Reference();
70 
71  int matid = 0;
72  if(gel) matid = gel->MaterialId();
73  std::stringstream sout;
74  if (gel) {
75  sout << "Material id " << matid <<std::endl;
76  }
77  else
78  {
79  sout << "No associated geometry\n";
80  }
81  sout << "Connect indexes ";
82  for (int i=0; i<cel->NConnects(); i++) {
83  sout << cel->ConnectIndex(i) << " ";
84  }
85  sout << std::endl;
86  sout << "Local indexes ";
87  for (int i=0; i<cel->NConnects(); i++) {
88  sout << locindex[cel->ConnectIndex(i)] << " ";
89  }
90  sout << std::endl;
91  E0Loc.fMat.Print("Matriz elementar E0",sout);
92  E1Loc.fMat.Print("Matriz elementar E1",sout);
93  E2Loc.fMat.Print("Matriz elementar E2",sout);
94  M0Loc.fMat.Print("Matriz elementar M0",sout);
95  LOGPZ_DEBUG(logger, sout.str())
96  }
97 #endif
98 #ifdef COMPUTE_CRC
99  {
100  boost::crc_32_type crc;
101  int64_t n = E0Loc.fMat.Rows();
102  crc.process_bytes(&E0Loc.fMat(0,0), n*n*sizeof(STATE));
103  crc.process_bytes(&E1Loc.fMat(0,0), n*n*sizeof(STATE));
104  crc.process_bytes(&E2Loc.fMat(0,0), n*n*sizeof(STATE));
105  matEcrc[Index()] = crc.checksum();
106 
107  }
108 #endif
109  int nelcon = E0Loc.NConnects();
110  for (int ic=0; ic<nelcon; ic++) {
111  int iblsize = E0Loc.fBlock.Size(ic);
112  int icindex = E0Loc.fConnect[ic];
113  int ibldest = locindex[icindex];
114  for (int jc = 0; jc<nelcon; jc++) {
115  int jblsize = E0Loc.fBlock.Size(jc);
116  int jcindex = E0Loc.fConnect[jc];
117  int jbldest = locindex[jcindex];
118  for (int idf = 0; idf<iblsize; idf++) {
119  for (int jdf=0; jdf<jblsize; jdf++) {
120  E0.fBlock(ibldest,jbldest,idf,jdf) += E0Loc.fBlock(ic,jc,idf,jdf);
121  E1.fBlock(ibldest,jbldest,idf,jdf) += E1Loc.fBlock(ic,jc,idf,jdf);
122  E2.fBlock(ibldest,jbldest,idf,jdf) += E2Loc.fBlock(ic,jc,idf,jdf);
123  M0.fBlock(ibldest,jbldest,idf,jdf) += M0Loc.fBlock(ic,jc,idf,jdf);
124  }
125  }
126  }
127  }
128  }
129 }
130 
137 {
138  InitializeElementMatrix(ek, ef);
139 
140  if (fComputationMode == EOnlyMass) {
141  ek.fMat = fMassMatrix;
142  ek.fMat *= fMassDensity;
143  ef.fMat.Zero();
144  return;
145  }
146  TPZElementMatrix E0,E1,E2, M0;
147  ComputeMatrices(E0, E1, E2, M0);
148 
149 // crc.process_bytes(&E0.fMat(0,0),E0.fMat.Rows()*E0.fMat.Rows()*sizeof(STATE));
150 // EMatcrc[Index()]= crc.checksum();
151 
152 #ifdef LOG4CXX
153  if (logger->isDebugEnabled()) {
154  std::stringstream sout;
155  E0.fMat.Print("E0 = ",sout, EMathematicaInput);
156  E1.fMat.Print("E1 = ",sout, EMathematicaInput);
157  E2.fMat.Print("E2 = ",sout, EMathematicaInput);
158  M0.fMat.Print("M0 = ",sout, EMathematicaInput);
159  LOGPZ_DEBUG(logger, sout.str())
160  }
161 #endif
162 
163  int n = E0.fMat.Rows();
164 
165  int dim = Mesh()->Dimension();
166 
167  TPZFMatrix<STATE> E0Inv(E0.fMat);
168  if(0)
169  {
170  try
171  {
172  TPZFMatrix<STATE> E0copy(E0.fMat);
173  TPZVec<int> pivot;
174  E0copy.Decompose_LU(pivot);
175  E0Inv.Identity();
176  E0copy.Substitution(&E0Inv, pivot);
177  }
178  catch(...)
179  {
180  exit(-1);
181  }
182  }
183  else
184  {
185 // E0.fMat.Print("E0 = ",std::cout,EMathematicaInput);
186 
187  TPZVec<int> pivot(E0Inv.Rows(),0);
188  int nwork = 4*n*n + 2*n;
189  TPZVec<STATE> work(2*nwork,0.);
190  int info=0;
191 #ifdef STATEdouble
192  dgetrf_(&n, &n, &E0Inv(0,0), &n, &pivot[0], &info);
193 #endif
194 #ifdef STATEfloat
195  sgetrf_(&n, &n, &E0Inv(0,0), &n, &pivot[0], &info);
196 #endif
197  if (info != 0) {
198  DebugStop();
199  }
200 #ifdef STATEdouble
201  dgetri_(&n, &E0Inv(0,0), &n, &pivot[0], &work[0], &nwork, &info);
202 #endif
203 #ifdef STATEfloat
204  sgetri_(&n, &E0Inv(0,0), &n, &pivot[0], &work[0], &nwork, &info);
205 #endif
206  if (info != 0) {
207  DebugStop();
208  }
209  }
210 // E0Inv.Print("E0InvCheck = ",std::cout,EMathematicaInput);
211 
212 
213 
214  TPZFMatrix<STATE> globmat(2*n,2*n,0.);
215 
216 // cblas_dgemm(<#const enum CBLAS_ORDER __Order#>, <#const enum CBLAS_TRANSPOSE __TransA#>, <#const enum CBLAS_TRANSPOSE __TransB#>, <#const int __M#>, <#const int __N#>, <#const int __K#>, <#const double __alpha#>, <#const double *__A#>, <#const int __lda#>, <#const double *__B#>, <#const int __ldb#>, <#const double __beta#>, <#double *__C#>, <#const int __ldc#>)
217 #ifdef STATEdouble
218  cblas_dgemm(CblasColMajor, CblasNoTrans, CblasTrans, n, n, n, 1., &E0Inv(0,0), n, &E1.fMat(0,0), n, 0., &globmat(0,0), 2*n);
219 #elif defined STATEfloat
220  cblas_sgemm(CblasColMajor, CblasNoTrans, CblasTrans, n, n, n, 1., &E0Inv(0,0), n, &E1.fMat(0,0), n, 0., &globmat(0,0), 2*n);
221 #else
222  std::cout << "SBFem does not execute for this configuration\n";
223  DebugStop();
224 #endif
225 
226  for (int i=0; i<n; i++) {
227  for (int j=0; j<n; j++) {
228  globmat(i,j+n) = -E0Inv(i,j);
229  }
230  }
231 #ifdef STATEdouble
232  cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, n, n, n, 1., &E1.fMat(0,0), n, &globmat(0,0), 2*n, 0., &globmat(n,0), 2*n);
233 #elif defined STATEfloat
234  cblas_sgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, n, n, n, 1., &E1.fMat(0,0), n, &globmat(0,0), 2*n, 0., &globmat(n,0), 2*n);
235 #else
236  std::cout << "SBFem does not execute for this configuration\n";
237  DebugStop();
238 #endif
239  for (int i=0; i<n; i++) {
240  for (int j=0; j<n; j++) {
241  globmat(i+n,j) -= E2.fMat(i,j);
242  }
243  }
244 
245 #ifdef STATEdouble
246  cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, n, n, n, -1., &E1.fMat(0,0), n, &E0Inv(0,0), n, 0., &globmat(n,n), 2*n);
247 #elif defined STATEfloat
248  cblas_sgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, n, n, n, -1., &E1.fMat(0,0), n, &E0Inv(0,0), n, 0., &globmat(n,n), 2*n);
249 #else
250  std::cout << "SBFem does not execute for this configuration\n";
251  DebugStop();
252 #endif
253  // globmat.Print("GlobMatCheck = ",std::cout, EMathematicaInput);
254 
255  for (int i=0; i<n; i++) {
256  globmat(i,i) -= (dim-2)*0.5;
257  globmat(i+n,i+n) += (dim-2)*0.5;
258  }
259 
260 
261  TPZFMatrix<STATE> globmatkeep(globmat);
262  TPZFMatrix< std::complex<double> > eigenVectors;
263  TPZManVector<std::complex<double> > eigenvalues;
264 
265 
266 // usleep((1284-Index())*50000);
267  {
268  globmatkeep.SolveEigenProblem(eigenvalues, eigenVectors);
269 #ifdef COMPUTE_CRC
270  static pthread_mutex_t mutex =PTHREAD_MUTEX_INITIALIZER;
271  pthread_mutex_lock(&mutex);
272  extern int gnumthreads;
273  std::stringstream sout;
274  sout << "eigval" << gnumthreads << ".nb";
275  static int count = 0;
276  std::ofstream file;
277  if (count == 0) {
278  file.open(sout.str());
279  }
280  else
281  {
282  file.open(sout.str(),std::ios::app);
283  }
284  std::stringstream eigv;
285  eigv << "EigVec" << Index() << " = ";
286  if(count < 1)
287  {
288  eigenVectors.Print(eigv.str().c_str(),file,EMathematicaInput);
289  }
290  count++;
291  pthread_mutex_unlock(&mutex);
292 #endif
293  }
294 
295  if(0)
296  {
297  TPZManVector<STATE> eigvalreal(2*n,0.);
298  TPZFMatrix<STATE> eigvecreal(2*n,2*n,0.);
299  for (int i=0; i<2*n; i++) {
300  eigvalreal[i] = eigenvalues[i].real();
301  for (int j=0; j<2*n; j++) {
302  eigvecreal(i,j) = eigenVectors(i,j).real();
303  }
304  }
305 // eigenVectors.Print("eigvec =",std::cout,EMathematicaInput);
306  }
307 
308  TPZFNMatrix<200,std::complex<double> > QVectors(n,n,0.);
309  fPhi.Resize(n, n);
310  TPZManVector<std::complex<double> > eigvalsel(n,0);
311  TPZFMatrix<std::complex<double> > eigvecsel(2*n,n,0.),eigvalmat(1,n,0.);
312  int count = 0;
313  for (int i=0; i<2*n; i++) {
314  if (eigenvalues[i].real() < -1.e-6) {
315  double maxvaleigenvec = 0;
316  for (int j=0; j<n; j++) {
317  QVectors(j,count) = eigenVectors(j+n,i);
318  eigvecsel(j,count) = eigenVectors(j,i);
319  eigvecsel(j+n,count) = eigenVectors(j+n,i);
320  fPhi(j,count) = eigenVectors(j,i);
321  double realvalabs = fabs(fPhi(j,count).real());
322  if (realvalabs > maxvaleigenvec) {
323  maxvaleigenvec = realvalabs;
324  }
325  }
326  eigvalsel[count] = eigenvalues[i];
327  eigvalmat(0,count) = eigenvalues[i];
328  for (int j=0; j<n; j++) {
329  QVectors(j,count) /= maxvaleigenvec;
330  eigvecsel(j,count) /= maxvaleigenvec;
331  eigvecsel(j+n,count) /= maxvaleigenvec;
332  fPhi(j,count) /= maxvaleigenvec;
333 
334  }
335  count++;
336  }
337  }
338 
339 #ifdef PZDEBUG
340  std::cout << "eigval = {" << eigvalsel << "};\n";
341 #endif
342 
343  if (dim == 2)
344  {
345  int nstate = Connect(0).NState();
346  if (nstate != 2 && nstate != 1) {
347  DebugStop();
348  }
349  if(count != n-nstate) {
350  DebugStop();
351  }
352  int ncon = fConnectIndexes.size();
353  int eq=0;
354  std::set<int64_t> cornercon;
355  BuildCornerConnectList(cornercon);
356  for (int ic=0; ic<ncon; ic++) {
357  int64_t conindex = ConnectIndex(ic);
358  if (cornercon.find(conindex) != cornercon.end())
359  {
360  fPhi(eq,count) = 1;
361  eigvecsel(eq,count) = 1;
362  if (nstate == 2)
363  {
364  fPhi(eq+1,count+1) = 1;
365  eigvecsel(eq+1,count+1) = 1;
366  }
367  }
368  eq += Connect(ic).NShape()*Connect(ic).NState();
369  }
370  }
371  if(dim==3 && count != n)
372  {
373  DebugStop();
374  }
375  fEigenvalues = eigvalsel;
376 #ifdef LOG4CXX
377  if(logger->isDebugEnabled())
378  {
379  std::stringstream sout;
380  sout << "eigenvalues " << eigvalsel << std::endl;
381  fPhi.Print("Phivec =",sout,EMathematicaInput);
382  LOGPZ_DEBUG(logger, sout.str())
383  }
384 // double phinorm = Norm(fPhi);
385 // if (loggerMT->isDebugEnabled()) {
386 // std::stringstream sout;
387 // sout << "Element index " << Index() << " phinorm = " << phinorm;
388 // LOGPZ_DEBUG(loggerMT, sout.str())
389 // }
390 #endif
391 
392  TPZFMatrix<std::complex<double> > phicopy(fPhi);
393  fPhiInverse.Redim(n, n);
395 
396  try
397  {
398  TPZVec<int> pivot;
399  phicopy.Decompose_LU(pivot);
400  phicopy.Substitution(&fPhiInverse, pivot);
401  }
402  catch(...)
403  {
404  exit(-1);
405  }
406 #ifdef LOG4CXX
407  if (logger->isDebugEnabled())
408  {
409  std::stringstream sout;
410  // phicopy.Inverse(fPhiInverse, ELU);
411 // phicopy.Print("phidec = ",std::cout,EMathematicaInput);
412  fPhiInverse.Print("fPhiInverse = ",sout,EMathematicaInput);
413 // QVectors.Print("QVectors ", std::cout);
414  LOGPZ_DEBUG(logger, sout.str())
415  }
416 #endif
417  TPZFMatrix<std::complex<double> > ekloc;
418  QVectors.Multiply(fPhiInverse, ekloc);
419  if(0)
420  {
421  std::ofstream out("EigenProblem.nb");
422  globmatkeep.Print("matrix = ",out,EMathematicaInput);
423  eigvecsel.Print("eigvec =",out,EMathematicaInput);
424  eigvalmat.Print("lambda =",out,EMathematicaInput);
425  fPhi.Print("phi = ",out,EMathematicaInput);
426  fPhiInverse.Print("phiinv = ",out,EMathematicaInput);
427  QVectors.Print("qvec = ",out,EMathematicaInput);
428  }
429 
430  TPZFMatrix<double> ekimag(ekloc.Rows(),ekloc.Cols());
431  for (int i=0; i<ekloc.Rows(); i++) {
432  for (int j=0; j<ekloc.Cols(); j++) {
433  ek.fMat(i,j) = ekloc(i,j).real();
434  ekimag(i,j) = ekloc(i,j).imag();
435  }
436  }
437 
438  int64_t nel = fElGroup.size();
439  for (int64_t el = 0; el<nel; el++) {
440  TPZCompEl *cel = fElGroup[el];
441  TPZSBFemVolume *sbfem = dynamic_cast<TPZSBFemVolume *>(cel);
442 #ifdef PZDEBUG
443  if (!sbfem) {
444  DebugStop();
445  }
446 #endif
447  sbfem->SetPhiEigVal(fPhi, fEigenvalues);
448  }
449 #ifdef COMPUTE_CRC
450  pthread_mutex_lock(&mutex);
451  {
452  boost::crc_32_type crc;
453  int64_t n = E0.fMat.Rows();
454  crc.process_bytes(&E0.fMat(0,0), n*n*sizeof(STATE));
455  crc.process_bytes(&E1.fMat(0,0), n*n*sizeof(STATE));
456  crc.process_bytes(&E2.fMat(0,0), n*n*sizeof(STATE));
457  matEcrc[Index()] = crc.checksum();
458 
459  }
460  {
461  boost::crc_32_type crc;
462  int64_t n = E0Inv.Rows();
463  crc.process_bytes(&E0Inv(0,0), n*n*sizeof(STATE));
464  matEInvcrc[Index()] = crc.checksum();
465 
466  }
467  {
468  boost::crc_32_type crc;
469  crc.process_bytes(&globmat(0,0), 4*n*n*sizeof(STATE));
470  matglobcrc[Index()] = crc.checksum();
471  }
472  {
473  boost::crc_32_type crc;
474  crc.process_bytes(&eigenVectors(0,0), n*n*sizeof(std::complex<double>));
475  eigveccrc[Index()] = crc.checksum();
476  }
477  {
478  boost::crc_32_type crc;
479  int n = ekloc.Rows();
480  crc.process_bytes(&ekloc(0,0), n*n*sizeof(STATE));
481  stiffcrc[Index()] = crc.checksum();
482  }
483  pthread_mutex_unlock(&mutex);
484 #endif
485  ComputeMassMatrix(M0);
486 
487 #ifdef LOG4CXX
488  if(logger->isDebugEnabled())
489  {
490  std::stringstream sout;
491  ek.fMat.Print("Stiff = ",sout,EMathematicaInput);
492  fMassMatrix.Print("Mass = ",sout,EMathematicaInput);
493  LOGPZ_DEBUG(logger, sout.str())
494  }
495 #endif
496  if(fComputationMode == EMass)
497  {
498  int nr = ek.fMat.Rows();
499  for (int r=0; r<nr; r++) {
500  for (int c=0; c<nr; c++) {
501  ek.fMat(r,c) += fMassMatrix(r,c)/fDelt;
502  }
503  }
504  }
505 
506 // ek.fMat.Print("Stiffness",std::cout,EMathematicaInput);
507 #ifdef PZDEBUG
508 // std::cout << "Norm of imaginary part " << Norm(ekimag) << std::endl;
509 #endif
510 }
511 
513 {
515  int nc = NConnects();
516  int count = 0;
517  for (int ic=0; ic<nc; ic++) {
518  TPZConnect &c = Connect(ic);
519  int nshape = c.NShape();
520  int nstate = c.NState();
521  int blsize = nshape*nstate;
522  int64_t seqnum = c.SequenceNumber();
523  int64_t pos = fMesh->Block().Position(seqnum);
524  for (int seq=0; seq < blsize; seq++) {
525  for (int c=0; c<uh_local.Cols(); c++)
526  {
527  uh_local(count+seq,c) = fMesh->Solution()(pos+seq,c);
528  }
529  }
530  count += blsize;
531  }
532  fPhiInverse.Multiply(uh_local, fCoef);
533  int64_t nel = fElGroup.size();
534  for (int64_t el = 0; el<nel; el++) {
535  TPZCompEl *cel = fElGroup[el];
536  TPZSBFemVolume *sbfem = dynamic_cast<TPZSBFemVolume *>(cel);
537 #ifdef PZDEBUG
538  if (!sbfem) {
539  DebugStop();
540  }
541 #endif
542  sbfem->LoadCoef(fCoef);
543  }
544 
545 }
546 
549 {
550  // M0.fMat.Print("Mass = ",std::cout,EMathematicaInput);
552  REAL alpha = 1.;
553  REAL beta = 0.;
554  int transpose = 1;
555  int nrow = fEigenvalues.size();
556  TPZFMatrix<std::complex<double> > M0Loc(nrow,nrow),MassLoc(nrow,nrow);
557  for (int i=0; i<nrow; i++) {
558  for(int j=0; j<nrow; j++)
559  {
560  M0Loc(i, j) = M0.fMat(i,j);
561  }
562  }
563  fPhi.MultAdd(M0Loc, M0Loc, temp, alpha, beta, transpose);
564  // temp.Print("Temp = ",std::cout,EMathematicaInput);
565  temp.Multiply(fPhi,MassLoc);
566  for (int i=0; i<nrow; i++) {
567  for (int j=0; j<nrow; j++) {
568  MassLoc(i,j) /= (2.-fEigenvalues[i]-fEigenvalues[j]);
569  }
570  }
571  fPhiInverse.MultAdd(MassLoc, M0Loc, temp,alpha, beta, transpose);
572  temp.Multiply(fPhiInverse,MassLoc);
573 
574  TPZFMatrix<double> MassLocImag(nrow,nrow);
575  fMassMatrix.Redim(nrow, nrow);
576  for (int i=0; i<nrow; i++) {
577  for(int j=0; j<nrow; j++)
578  {
579  fMassMatrix(i, j) = MassLoc(i,j).real();
580  MassLocImag(i,j) = MassLoc(i,j).imag();
581  }
582  }
583 
584 // fMassMatrix.Print("Mass Matrix",std::cout,EMathematicaInput);
585 #ifdef PZDEBUG
586 // std::cout << "Norm of imaginary part " << Norm(MassLocImag) << std::endl;
587 #endif
588 }
589 
591 {
592  fCoef.Zero();
593  fCoef(eig,0) = 1.;
594  int64_t nel = fElGroup.size();
595  for (int64_t el = 0; el<nel; el++) {
596  TPZCompEl *cel = fElGroup[el];
597  TPZSBFemVolume *sbfem = dynamic_cast<TPZSBFemVolume *>(cel);
598 #ifdef PZDEBUG
599  if (!sbfem) {
600  DebugStop();
601  }
602 #endif
603  sbfem->LoadCoef(fCoef);
604  }
605 
606 }
607 
611 {
612  std::set<int64_t> connects;
613  int nc = fConnectIndexes.size();
614  for (int ic=0; ic<nc; ic++) {
615  connects.insert(fConnectIndexes[ic]);
616  }
617  TPZSBFemVolume *celvol = dynamic_cast<TPZSBFemVolume *>(cel);
618  TPZCompEl *celskeleton = Mesh()->Element(celvol->SkeletonIndex());
619  nc = celskeleton->NConnects();
620  for (int ic=0; ic<nc; ic++) {
621  connects.insert(celskeleton->ConnectIndex(ic));
622  }
623  nc = connects.size();
624  if (nc != fConnectIndexes.size()) {
625  fConnectIndexes.Resize(nc, 0);
626  std::set<int64_t>::iterator it = connects.begin();
627  for (int ic = 0; it != connects.end(); it++,ic++) {
628  fConnectIndexes[ic] = *it;
629  }
630  }
632 }
633 
634 
635 
636 //http://www.netlib.org/lapack/lug/node50.html
637 //https://software.intel.com/en-us/node/521079
TPZFMatrix< std::complex< double > > fPhi
Matrix of eigenvectors which compose the stiffness matrix.
virtual void LoadSolution()
Loads the solution within the internal data structure of the element.
pthread_mutex_t mutex
Semaphore which controls multiple threads.
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
TPZFMatrix< std::complex< double > > fCoef
Multiplying coefficients of each eigenvector.
int Position(const int block_diagonal) const
Returns the position of first element block dependent on matrix diagonal.
Definition: pzblock.h:177
Represents a set of shape functions associated with a computational element/side. Computational Eleme...
Definition: pzconnect.h:30
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
virtual int Decompose_LU(std::list< int64_t > &singular) override
LU Decomposition. Stores L and U matrices at the storage of the same matrix.
Definition: pzfmatrix.cpp:1246
virtual int64_t ConnectIndex(int i) const override
Returns the index of the ith connectivity of the element.
int MaterialId() const
Returns the material index of the element.
Definition: pzgeoel.h:250
TPZStack< TPZCompEl *, 5 > fElGroup
virtual int NConnects() const override
Returns the number of nodes of the element.
TPZStack< int64_t > fConnect
Vector of pointers to TPZConnect objects.
Definition: pzelmat.h:39
TPZManVector< int64_t, 27 > fConnectIndexes
TPZFNMatrix< 1000, STATE > fMat
Pointer to a blocked matrix object.
Definition: pzelmat.h:41
int64_t SkeletonIndex()
virtual void Identity()
Converts the matrix in an identity matrix.
Definition: pzmatrix.cpp:199
void SetPhiEigVal(TPZFMatrix< std::complex< double > > &phi, TPZManVector< std::complex< double > > &eigval)
initialize the data structures of the eigenvectors and eigenvalues associated with this volume elemen...
EComputationMode fComputationMode
TPZManVector< std::complex< double > > fEigenvalues
Vector of eigenvalues of the SBFem analyis.
REAL fDelt
timestep coeficient
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
TPZFMatrix< std::complex< double > > fPhiInverse
Inverse of the eigenvector matrix (transfers eigenvector coeficients to side shape coeficients) ...
TPZBlock< STATE > fBlock
Block structure associated with fMat.
Definition: pzelmat.h:43
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Definition: pzmanvector.h:426
void ComputeMatrices(TPZElementMatrix &E0, TPZElementMatrix &E1, TPZElementMatrix &E2, TPZElementMatrix &M0)
Computes the element stifness matrix and right hand side.
virtual void BuildCornerConnectList(std::set< int64_t > &connectindexes) const override
adds the connect indexes associated with base shape functions to the set
int Zero() override
Makes Zero all the elements.
Definition: pzfmatrix.h:651
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
TPZCompEl * Element(int64_t iel)
Definition: pzcmesh.h:185
int64_t SequenceNumber() const
Returns the Sequence number of the connect object.
Definition: pzconnect.h:158
int NConnects()
Returns the number of nodes of TElementMatrix.
Definition: pzelmat.h:87
void ComputeMassMatrix(TPZElementMatrix &M0)
Compute the mass matrix based on the value of M0 and the eigenvectors.
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
virtual void LoadCoef(TPZFMatrix< std::complex< double > > &coef)
Loads the solution within the internal data structure of the element.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
TPZCompMesh * Mesh() const
Return a pointer to the grid of the element.
Definition: pzcompel.cpp:288
void LoadEigenVector(int64_t eig)
Load the coeficients such that we visualize an eigenvector.
int Dimension() const
Returns the dimension of the simulation.
Definition: pzcmesh.h:148
virtual void AddElement(TPZCompEl *cel)
add an element to the element group
unsigned int NShape() const
Definition: pzconnect.h:151
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
const TPZBlock< STATE > & Block() const
Access the block structure of the solution vector.
Definition: pzcmesh.h:213
static int Substitution(const TVar *ptr, int64_t rows, TPZFMatrix< TVar > *B)
Definition: pzfmatrix.cpp:1323
int64_t Index() const
Returns element index of the mesh fELementVec list.
Definition: pzcompel.h:821
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
unsigned char NState() const
Number of state variables associated with the connect.
Definition: pzconnect.h:146
virtual int64_t ConnectIndex(int i) const =0
Returns the index of the ith connectivity of the element.
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
Definition: pzelmat.h:30
virtual int NConnects() const =0
Returns the number of nodes of the element.
static int idf[6]
REAL fMassDensity
multiplier to multiply the mass matrix
TPZGeoEl * Reference() const
Return a pointer to the corresponding geometric element if such exists, return 0 otherwise.
Definition: pzcompel.cpp:1137
void ComputeKMatrices(TPZElementMatrix &E0, TPZElementMatrix &E1, TPZElementMatrix &E2, TPZElementMatrix &M0)
Compute the E0, E1 and E2 matrices.
int Size(const int block_diagonal) const
Returns block dimension.
Definition: pzblock.h:171
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef)
Computes the element stifness matrix and right hand side.
virtual void Multiply(const TPZFMatrix< TVar > &A, TPZFMatrix< TVar > &res, int opt=0) const
It mutiplies itself by TPZMatrix<TVar>A putting the result in res.
Definition: pzmatrix.cpp:1916
void InitializeElementMatrix(TPZElementMatrix &ek, TPZElementMatrix &ef) const
Initialize the datastructure of ek and ef based on the connect information.
virtual void MultAdd(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha=1., const TVar beta=0., 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: pzfmatrix.cpp:757
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
virtual void Print(std::ostream &out) const
Definition: pzmatrix.h:253
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Definition: pzfmatrix.cpp:1016
TPZFMatrix< STATE > fMassMatrix
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
virtual void AddElement(TPZCompEl *cel)
add an element to the element group
TPZFMatrix< STATE > & Solution()
Access the solution vector.
Definition: pzcmesh.h:219
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716
TPZCompMesh * fMesh
Computational mesh to which the element belongs.
Definition: pzcompel.h:64