NeoPZ
pzstrmatrixgc.cpp
Go to the documentation of this file.
1 
6 #include "pzstrmatrixgc.h"
7 
8 #include "pzvec.h"
9 #include "pzfmatrix.h"
10 #include "pzmanvector.h"
11 #include "pzadmchunk.h"
12 #include "pzcmesh.h"
13 #include "pzgmesh.h"
14 #include "pzelmat.h"
15 #include "pzcompel.h"
16 #include "pzintel.h"
17 #include "pzsubcmesh.h"
18 #include "pzanalysis.h"
19 #include "pzsfulmat.h"
20 
21 #include "pzgnode.h"
22 #include "TPZTimer.h"
23 #include "TPZThreadTools.h"
24 
25 
26 #include "pzcheckconsistency.h"
27 #include "TPZMaterial.h"
28 
29 using namespace std;
30 
31 #include "pzlog.h"
32 
33 #include "pz_pthread.h"
34 #include "run_stats_table.h"
35 
36 #ifdef LOG4CXX
37 static LoggerPtr logger(Logger::getLogger("pz.strmatrix.TPZStructMatrixGC"));
38 static LoggerPtr loggerel(Logger::getLogger("pz.strmatrix.element"));
39 static LoggerPtr loggerel2(Logger::getLogger("pz.strmatrix.elementinterface"));
40 static LoggerPtr loggerelmat(Logger::getLogger("pz.strmatrix.elementmat"));
41 static LoggerPtr loggerCheck(Logger::getLogger("pz.strmatrix.checkconsistency"));
42 #endif
43 
44 #ifdef CHECKCONSISTENCY
45 static TPZCheckConsistency stiffconsist("ElementStiff");
46 #endif
47 
48 RunStatsTable stat_ass_graph("-ass_graph", "Run statistics table for the graph creation and coloring TPZStructMatrixGC.");
49 
50 
53  TPZManVector<int64_t> ElementOrder;
54  TPZStructMatrixGC::OrderElement(this->Mesh(), ElementOrder);
57 }
58 
61  TPZManVector<int64_t> ElementOrder;
62  TPZStructMatrixGC::OrderElement(this->Mesh(), ElementOrder);
65 }
66 
70 }
71 
73  cout << "TPZStructMatrixGC::Create should never be called\n";
74  return 0;
75 }
76 
78  cout << "TPZStructMatrixGC::Clone should never be called\n";
79  return 0;
80 }
81 
82 static RunStatsTable ass_stiff("-ass_stiff", "Assemble Stiffness");
83 static RunStatsTable ass_rhs("-ass_rhs", "Assemble Stiffness");
84 
85 
87  ass_stiff.start();
88  if (fEquationFilter.IsActive()) {
89  int64_t neqcondense = fEquationFilter.NActiveEquations();
90 #ifdef PZDEBUG
91  if (stiffness.Rows() != neqcondense) {
92  DebugStop();
93  }
94 #endif
95  TPZFMatrix<STATE> rhsloc(neqcondense,rhs.Cols(),0.);
96  if(this->fNumThreads){
97  this->MultiThread_Assemble(stiffness,rhsloc,guiInterface);
98  }
99  else{
100  this->Serial_Assemble(stiffness,rhsloc,guiInterface);
101  }
102 
103  fEquationFilter.Scatter(rhsloc, rhs);
104  }
105  else
106  {
107  if(this->fNumThreads){
108  this->MultiThread_Assemble(stiffness,rhs,guiInterface);
109  }
110  else{
111  this->Serial_Assemble(stiffness,rhs,guiInterface);
112  }
113  }
114  ass_stiff.stop();
115 }
116 
118  ass_rhs.start();
120  {
121  int64_t neqcondense = fEquationFilter.NActiveEquations();
122  int64_t neqexpand = fEquationFilter.NEqExpand();
123  if(rhs.Rows() != neqexpand || Norm(rhs) != 0.)
124  {
125  DebugStop();
126  }
127  TPZFMatrix<STATE> rhsloc(neqcondense,1,0.);
128  if(this->fNumThreads)
129  {
130  this->MultiThread_Assemble(rhsloc,guiInterface);
131  }
132  else
133  {
134  this->Serial_Assemble(rhsloc,guiInterface);
135  }
136  fEquationFilter.Scatter(rhsloc,rhs);
137  }
138  else
139  {
140  if(this->fNumThreads){
141  this->MultiThread_Assemble(rhs,guiInterface);
142  }
143  else{
144  this->Serial_Assemble(rhs,guiInterface);
145  }
146  }
147  ass_rhs.stop();
148 }
149 
150 
151 
153 
154  if(!fMesh){
155  LOGPZ_ERROR(logger,"Serial_Assemble called without mesh")
156  DebugStop();
157  }
158 #ifdef LOG4CXX
159  if(dynamic_cast<TPZSubCompMesh * >(fMesh))
160  {
161  std::stringstream sout;
162  sout << "AllEig = {};";
163  LOGPZ_DEBUG(loggerelmat,sout.str())
164 
165  }
166 #endif
167 #ifdef PZDEBUG
168  if (rhs.Rows() != fEquationFilter.NActiveEquations()) {
169  DebugStop();
170  }
171 #endif
172 
173  int64_t iel;
174  int64_t nelem = fMesh->NElements();
176 #ifdef LOG4CXX
177  bool globalresult = true;
178  bool writereadresult = true;
179 #endif
180  TPZTimer calcstiff("Computing the stiffness matrices");
181  TPZTimer assemble("Assembling the stiffness matrices");
183 
184  int64_t count = 0;
185  for(iel=0; iel < nelem; iel++) {
186  TPZCompEl *el = elementvec[iel];
187  if(!el) continue;
188  int matidsize = fMaterialIds.size();
189  if(matidsize){
190  TPZMaterial * mat = el->Material();
191  TPZSubCompMesh *submesh = dynamic_cast<TPZSubCompMesh *> (el);
192  if (!mat)
193  {
194  if (!submesh) {
195  continue;
196  }
197  else if(submesh->NeedsComputing(fMaterialIds) == false) continue;
198  }
199  else
200  {
201  int matid = mat->Id();
202  if (this->ShouldCompute(matid) == false) continue;
203  }
204  }
205 
206  count++;
207  if(!(count%1000))
208  {
209  std::cout << '*';
210  std::cout.flush();
211  }
212  if(!(count%20000))
213  {
214  std::cout << "\n";
215  }
216  calcstiff.start();
217 
218  el->CalcStiff(ek,ef);
219 
220  if(guiInterface) if(guiInterface->AmIKilled()){
221  return;
222  }
223 
224 #ifdef LOG4CXX
225  if(dynamic_cast<TPZSubCompMesh * >(fMesh))
226  {
227  std::stringstream objname;
228  objname << "Element" << iel;
229  std::string name = objname.str();
230  objname << " = ";
231  std::stringstream sout;
232  ek.fMat.Print(objname.str().c_str(),sout,EMathematicaInput);
233  sout << "AppendTo[AllEig,Eigenvalues[" << name << "]];";
234 
235  LOGPZ_DEBUG(loggerelmat,sout.str())
236  /* if(iel == 133)
237  {
238  std::stringstream sout2;
239  el->Reference()->Print(sout2);
240  el->Print(sout2);
241  LOGPZ_DEBUG(logger,sout2.str())
242  }
243  */
244  }
245 
246 #endif
247 
248 #ifdef CHECKCONSISTENCY
249  //extern TPZCheckConsistency stiffconsist("ElementStiff");
250  stiffconsist.SetOverWrite(true);
251  bool result;
252  result = stiffconsist.CheckObject(ek.fMat);
253  if(!result)
254  {
255  globalresult = false;
256  std::stringstream sout;
257  sout << "element " << iel << " computed differently";
258  LOGPZ_ERROR(loggerCheck,sout.str())
259  }
260 
261 #endif
262 
263  calcstiff.stop();
264  assemble.start();
265 
266  if(!el->HasDependency()) {
267  ek.ComputeDestinationIndices();
268  fEquationFilter.Filter(ek.fSourceIndex, ek.fDestinationIndex);
269  // TPZSFMatrix<STATE> test(stiffness);
270  // TPZFMatrix<STATE> test2(stiffness.Rows(),stiffness.Cols(),0.);
271  // stiffness.Print("before assembly",std::cout,EMathematicaInput);
272  stiffness.AddKel(ek.fMat,ek.fSourceIndex,ek.fDestinationIndex);
273  rhs.AddFel(ef.fMat,ek.fSourceIndex,ek.fDestinationIndex);
274  // stiffness.Print("stiffness after assembly STK = ",std::cout,EMathematicaInput);
275  // rhs.Print("rhs after assembly Rhs = ",std::cout,EMathematicaInput);
276  // test2.AddKel(ek.fMat,ek.fSourceIndex,ek.fDestinationIndex);
277  // test -= stiffness;
278  // test.Print("matriz de rigidez diference",std::cout);
279  // test2.Print("matriz de rigidez interface",std::cout);
280 
281 #ifdef LOG4CXX
282  if(loggerel->isDebugEnabled())
283  {
284  std::stringstream sout;
285  TPZGeoEl *gel = el->Reference();
286  if(gel)
287  {
288  TPZManVector<REAL> center(gel->Dimension()),xcenter(3,0.);
289  gel->CenterPoint(gel->NSides()-1, center);
290  gel->X(center, xcenter);
291  sout << "Stiffness for computational element index " << el->Index() << std::endl;
292  sout << "Stiffness for geometric element " << gel->Index() << " center " << xcenter << std::endl;
293  }
294  else {
295  sout << "Stiffness for computational element without associated geometric element\n";
296  }
297  ek.Print(sout);
298  ef.Print(sout);
299  LOGPZ_DEBUG(loggerel,sout.str())
300  }
301 #endif
302  } else {
303  // the element has dependent nodes
304  ek.ApplyConstraints();
305  ef.ApplyConstraints();
306  ek.ComputeDestinationIndices();
307  fEquationFilter.Filter(ek.fSourceIndex, ek.fDestinationIndex);
308  stiffness.AddKel(ek.fConstrMat,ek.fSourceIndex,ek.fDestinationIndex);
309  rhs.AddFel(ef.fConstrMat,ek.fSourceIndex,ek.fDestinationIndex);
310 #ifdef LOG4CXX
311  if(loggerel->isDebugEnabled() && ! dynamic_cast<TPZSubCompMesh *>(fMesh))
312  {
313  std::stringstream sout;
314  TPZGeoEl *gel = el->Reference();
315  TPZManVector<REAL> center(gel->Dimension()),xcenter(3,0.);
316  gel->CenterPoint(gel->NSides()-1, center);
317  gel->X(center, xcenter);
318  sout << "Stiffness for geometric element " << gel->Index() << " center " << xcenter << std::endl;
319  ek.Print(sout);
320  ef.Print(sout);
321  LOGPZ_DEBUG(loggerel,sout.str())
322  }
323 #endif
324  }
325 
326  assemble.stop();
327  }//fim for iel
328  if(count > 20) std::cout << std::endl;
329 
330 #ifdef LOG4CXX
331  if(loggerCheck->isDebugEnabled())
332  {
333  std::stringstream sout;
334  sout << "The comparaison results are : consistency check " << globalresult << " write read check " << writereadresult;
335  //stiffness.Print("Matriz de Rigidez: ",sout);
336  stiffness.Print("Matriz de Rigidez: ",sout,EMathematicaInput);
337  rhs.Print("Right Handside", sout,EMathematicaInput);
338  LOGPZ_DEBUG(loggerCheck,sout.str())
339  }
340 
341 #endif
342 
343 }
344 
346 
347  int64_t iel;
348  int64_t nelem = fMesh->NElements();
349 
350  TPZTimer calcresidual("Computing the residual vector");
351  TPZTimer assemble("Assembling the residual vector");
352 
354 
355  for(iel=0; iel < nelem; iel++) {
356  TPZCompEl *el = elementvec[iel];
357  if(!el) continue;
358 
359  TPZMaterial * mat = el->Material();
360  if (!mat) continue;
361  int matid = mat->Id();
362  if (this->ShouldCompute(matid) == false) continue;
363 
365 
366  calcresidual.start();
367 
368  el->CalcResidual(ef);
369 
370  calcresidual.stop();
371 
372  assemble.start();
373 
374  if(!el->HasDependency()) {
377  rhs.AddFel(ef.fMat, ef.fSourceIndex, ef.fDestinationIndex);
378  } else {
379  // the element has dependent nodes
380  ef.ApplyConstraints();
384  }
385 
386  assemble.stop();
387 
388  }//fim for iel
389 #ifdef LOG4CXX
390  {
391  if(logger->isDebugEnabled())
392  {
393  std::stringstream sout;
394  sout << calcresidual.processName() << " " << calcresidual << std::endl;
395  sout << assemble.processName() << " " << assemble;
396  LOGPZ_DEBUG(logger,sout.str().c_str());
397  }
398  }
399 #endif
400  //std::cout << std::endl;
401 }
402 
404 {
405  TPZMatrix<STATE> *stiff = Create();
406 
407  //int64_t neq = stiff->Rows();
408  int64_t cols = MAX(1, rhs.Cols());
409  rhs.Redim(fEquationFilter.NEqExpand(),cols);
410  Assemble(*stiff,rhs,guiInterface);
411 
412 #ifdef LOG4CXX2
413  if(loggerel->isDebugEnabled())
414  {
415  std::stringstream sout;
416  stiff->Print("Stiffness matrix",sout);
417  rhs.Print("Right hand side", sout);
418  LOGPZ_DEBUG(loggerel,sout.str())
419  }
420 #endif
421  return stiff;
422 
423 }
424 
426 {
427  ThreadData threaddata(this,mat,rhs,fMaterialIds,guiInterface);
428 
429  threaddata.fnextBlocked=&fnextBlocked;
431 
432  const int numthreads = this->fNumThreads;
433  TPZVec<pthread_t> allthreads(numthreads);
434  int itr;
435  if(guiInterface){
436  if(guiInterface->AmIKilled()){
437  return;
438  }
439  }
440  for(itr=0; itr<numthreads; itr++)
441  {
442  PZ_PTHREAD_CREATE(&allthreads[itr], NULL,ThreadData::ThreadWork,
443  &threaddata, __FUNCTION__);
444  }
445 
446  for(itr=0; itr<numthreads; itr++)
447  {
448  PZ_PTHREAD_JOIN(allthreads[itr], NULL, __FUNCTION__);
449  }
450 
451 #ifdef LOG4CXX
452  if(loggerCheck->isDebugEnabled())
453  {
454  std::stringstream sout;
455  //stiffness.Print("Matriz de Rigidez: ",sout);
456  mat.Print("Matriz de Rigidez: ",sout,EMathematicaInput);
457  rhs.Print("Right Handside", sout,EMathematicaInput);
458  LOGPZ_DEBUG(loggerCheck,sout.str())
459  }
460 #endif
461 }
462 
463 
465 {
466  ThreadData threaddata(this,rhs,fMaterialIds,guiInterface);
467 
468  threaddata.fnextBlocked=&fnextBlocked;
470 
471  const int numthreads = this->fNumThreads;
472  TPZVec<pthread_t> allthreads(numthreads);
473  int itr;
474  if(guiInterface){
475  if(guiInterface->AmIKilled()){
476  return;
477  }
478  }
479 
480  for(itr=0; itr<numthreads; itr++)
481  {
482  PZ_PTHREAD_CREATE(&allthreads[itr], NULL,ThreadData::ThreadWorkResidual,
483  &threaddata, __FUNCTION__);
484  }
485 
486  for(itr=0; itr<numthreads; itr++)
487  {
488  PZ_PTHREAD_JOIN(allthreads[itr], NULL, __FUNCTION__);
489  }
490 }
491 
492 
493 
495  TPZFMatrix<STATE> &rhs,
496  std::set<int> &MaterialIds,
497  TPZAutoPointer<TPZGuiInterface> guiInterface)
498 : fStruct(strmat), fGuiInterface(guiInterface), fGlobMatrix(&mat), fGlobRhs(&rhs), fNextElement(0)
499 {
500 
501  PZ_PTHREAD_MUTEX_INIT(&fAccessElement,NULL,"TPZStructMatrixGC::ThreadData::ThreadData()");
502  pthread_cond_init(&fCondition, NULL);
503  /* sem_t *sem_open( ... );
504  int sem_close(sem_t *sem);
505  int sem_unlink(const char *name);
506  */
507  /*
508  #ifdef MACOSX
509  std::stringstream sout;
510  static int counter = 0;
511  sout << "AssemblySem" << counter++;
512  fAssembly = sem_open(sout.str().c_str(), O_CREAT,777,1);
513  if(fAssembly == SEM_FAILED)
514  {
515  std::cout << __PRETTY_FUNCTION__ << " could not open the semaphore\n";
516  DebugStop();
517  }
518  #else
519  int sem_result = sem_init(&fAssembly,0,0);
520  if(sem_result != 0)
521  {
522  std::cout << __PRETTY_FUNCTION__ << " could not open the semaphore\n";
523  }
524  #endif
525  */
526 }
527 
529  TPZFMatrix<STATE> &rhs,
530  std::set<int> &MaterialIds,
531  TPZAutoPointer<TPZGuiInterface> guiInterface)
532 : fStruct(strmat),fGuiInterface(guiInterface), fGlobMatrix(0), fGlobRhs(&rhs), fNextElement(0)
533 {
534 
535  PZ_PTHREAD_MUTEX_INIT(&fAccessElement,NULL,"TPZStructMatrixGC::ThreadData::ThreadData()");
536  pthread_cond_init(&fCondition, NULL);
537  /* sem_t *sem_open( ... );
538  int sem_close(sem_t *sem);
539  int sem_unlink(const char *name);
540  */
541  /*
542  #ifdef MACOSX
543  std::stringstream sout;
544  static int counter = 0;
545  sout << "AssemblySem" << counter++;
546  fAssembly = sem_open(sout.str().c_str(), O_CREAT,777,1);
547  if(fAssembly == SEM_FAILED)
548  {
549  std::cout << __PRETTY_FUNCTION__ << " could not open the semaphore\n";
550  DebugStop();
551  }
552  #else
553  int sem_result = sem_init(&fAssembly,0,0);
554  if(sem_result != 0)
555  {
556  std::cout << __PRETTY_FUNCTION__ << " could not open the semaphore\n";
557  }
558  #endif
559  */
560 }
561 
563 {
564  PZ_PTHREAD_MUTEX_DESTROY(&fAccessElement,"TPZStructMatrixGC::ThreadData::~ThreadData()");
565  pthread_cond_destroy(&fCondition);
566  /*
567  #ifdef MACOSX
568  sem_close(fAssembly);
569  #else
570  sem_destroy(&fAssembly);
571  #endif
572  */
573 }
574 
576 {
577  ThreadData *data = (ThreadData *) datavoid;
578  TPZCompMesh *cmesh = data->fStruct->Mesh();
579  TPZAutoPointer<TPZGuiInterface> guiInterface = data->fGuiInterface;
580  int nel = cmesh->NElements();
581  bool hasWork = true;
582  int iel = 0;
585  while(hasWork)
586  {
588  // nextelement is a protected value
589  int64_t localiel = data->fNextElement;
590  int64_t blockedel = -1;
591  if(data->felBlocked.size()) blockedel = data->felBlocked.begin()->first;
592 #ifdef LOG4CXX
593  if(logger->isDebugEnabled())
594  {
595  std::stringstream sout;
596  sout << "Checking out " << localiel << " next blocked element " << blockedel;
597  LOGPZ_DEBUG(logger, sout.str())
598  }
599 #endif
600  if(localiel < nel)
601  {
602  // The elblocked data structure indicates the elements blocked by the elements being processed (why is this needed?)
603  if (!data->felBlocked.size() || data->felBlocked.begin()->first > localiel)
604  {
605 
606  if(localiel==-1) DebugStop();
607  // this is the next element that will be computed
608  iel = (*data->felSequenceColor)[localiel];
609 
610  // identify the element which will be blocked by iel
611  int elBl = (*data->fnextBlocked)[localiel];
612 #ifdef LOG4CXX
613  if (logger->isDebugEnabled())
614  {
615  std::stringstream sout;
616  sout << "Element can be computed iel = " << localiel << " element blocked " << elBl;
617  LOGPZ_DEBUG(logger, sout.str())
618  }
619 
620 #endif
621  // update the datastructure with the highest element that can be processed while iel hasn't been computed yet
622  if (elBl >= 0){
623  data->felBlocked[elBl]++;
624  hasWork = true;
625  }
626  // the next thread will monitor a higher numbered element
627  data->fNextElement++;
628  }
629  else if (data->felBlocked.size() || data->felBlocked.begin()->first <= localiel){
630 #ifdef LOG4CXX
631  if (logger->isDebugEnabled()) {
632  std::stringstream sout;
633  sout << "Going to sleep cannot do " << localiel << " because of " << data->felBlocked.begin()->first << " has to be computed first";
634  LOGPZ_DEBUG(logger, sout.str())
635  }
636 #endif
637  // localiel cannot be processed yet
638  data->fSleeping=true;
639  while(data->fSleeping){
640  pthread_cond_wait(&data->fCondition, &data->fAccessElement);
641  }
642  iel = -1;
643  hasWork = true;
644  }
645  else{
646  DebugStop();
647  }
648  }
649  else{
650  hasWork = false;
651  iel = -1;
652  }
653 
655 
656 #ifdef LOG4CXX
657  std::stringstream sout;
658  sout << "Element " << localiel << " elapsed time ";
659  TPZTimer timeforel(sout.str());
660  timeforel.start();
661 #endif
662 
663  if (iel >= 0){
664  TPZCompEl *el = cmesh->ElementVec()[iel];
665  el->CalcStiff(ek,ef);
666  if(guiInterface) if(guiInterface->AmIKilled()){
667  break;
668  }
669  if(!el->HasDependency()) {
670 
673 
674 #ifdef LOG4CXX
675  if(loggerel->isDebugEnabled())
676  {
677  std::stringstream sout;
678  ek.fMat.Print("Element stiffness matrix",sout);
679  ef.fMat.Print("Element right hand side", sout);
680  LOGPZ_DEBUG(loggerel,sout.str())
681  }
682 #endif
683  } else {
684  // the element has dependent nodes
685  ek.ApplyConstraints();
686  ef.ApplyConstraints();
689 
690 #ifdef LOG4CXX
691  if(loggerel2->isDebugEnabled() && el->Reference() && el->Reference()->MaterialId() == 1 && el->IsInterface())
692  {
693  std::stringstream sout;
694  el->Reference()->Print(sout);
695  el->Print(sout);
696  ek.Print(sout);
697  ef.Print(sout);
698  LOGPZ_DEBUG(loggerel2,sout.str())
699  }
700 #endif
701  }
702 
703 
704  if(data->fGlobMatrix){
705  // Assemble the matrix
706  if(!ek.HasDependency())
707  {
710  }
711  else
712  {
715  }
716 
717  }
718 
719 #ifdef LOG4CXX
720  timeforel.stop();
721  if (logger->isDebugEnabled())
722  {
723  std::stringstream sout;
724  sout << timeforel.processName() << timeforel;
725  LOGPZ_DEBUG(logger, sout.str())
726  }
727 #endif
728 
730 
731 #ifdef LOG4CXX
732  if (logger->isDebugEnabled()) {
733  std::stringstream sout;
734  sout << "Computed and Assembled " << localiel;
735  LOGPZ_DEBUG(logger, sout.str())
736  }
737 #endif
738  // clean up the data structure
739  int elBl = (*data->fnextBlocked)[localiel];
740  if (elBl >= 0 && data->felBlocked.find(elBl) != data->felBlocked.end())
741  {
742  data->felBlocked[elBl]--;
743  int dataelbl = data->felBlocked[elBl];
744  if (dataelbl == 0){
745 #ifdef LOG4CXX
746  if(logger->isDebugEnabled())
747  {
748  std::stringstream sout;
749  sout << "Element " << elBl << " released";
750  LOGPZ_DEBUG(logger, sout.str())
751  }
752 #endif
753  data->felBlocked.erase(elBl);
754  if(data->fSleeping) {
755  data->fSleeping=false;
756 
757 #ifdef LOG4CXX
758  if(logger->isDebugEnabled()){
759  LOGPZ_DEBUG(logger, "Waking up everybody")
760  }
761 #endif
762  // wake up everybody
763  pthread_cond_broadcast(&data->fCondition);
764  }
765  }
766  else if (dataelbl < 0)
767  {
768  DebugStop();
769  }
770  else
771  {
772 #ifdef LOG4CXX
773  if (logger->isDebugEnabled()) {
774  std::stringstream sout;
775  sout << "Not freeing the blocked element " << elBl;
776  LOGPZ_DEBUG(logger, sout.str())
777  }
778 #endif
779  }
780  }
781  else if(elBl >= 0){
782  DebugStop();
783  }
784 
786  }
787  }
788  return 0;
789 }
790 
792 {
793  ThreadData *data = (ThreadData *) datavoid;
794  TPZCompMesh *cmesh = data->fStruct->Mesh();
795  TPZAutoPointer<TPZGuiInterface> guiInterface = data->fGuiInterface;
796  int nel = cmesh->NElements();
797  bool hasWork = true;
798  int iel = 0;
800  while(hasWork)
801  {
803  int localiel = data->fNextElement;
804  if(data->fNextElement < nel){
805  if (!data->felBlocked.size() || data->felBlocked.begin()->first > localiel){
806  iel = (*data->felSequenceColor)[localiel];
807 
808  if(localiel==-1) DebugStop();
809 
810  int elBl = (*data->fnextBlocked)[localiel];
811  if (elBl >= 0){
812  data->felBlocked[elBl]++;
813  hasWork = true;
814  }
815 
816  data->fNextElement++;
817  }
818  else if (data->felBlocked.size() || data->felBlocked.begin()->first <= localiel){
819  data->fSleeping=true;
820  while(data->fSleeping){
821  pthread_cond_wait(&data->fCondition, &data->fAccessElement);
822  }
823  iel = -1;
824  hasWork = true;
825  }
826  else{
827  DebugStop();
828  }
829  }
830  else{
831  hasWork = false;
832  iel = -1;
833  }
834 
836  if (iel >= 0){
837  TPZCompEl *el = cmesh->ElementVec()[iel];
838 
839  el->CalcResidual(ef);
840 
841  if(guiInterface) if(guiInterface->AmIKilled()){
842  break;
843  }
844  if(!el->HasDependency()) {
847 
848 #ifdef LOG4CXX
849  if(loggerel->isDebugEnabled())
850  {
851  std::stringstream sout;
852  ef.fMat.Print("Element right hand side", sout);
853  LOGPZ_DEBUG(loggerel,sout.str())
854  }
855 #endif
856  } else {
857  // the element has dependent nodes
858  ef.ApplyConstraints();
861 #ifdef LOG4CXX
862  if(loggerel2->isDebugEnabled() && el->Reference() && el->Reference()->MaterialId() == 1 && el->IsInterface())
863  {
864  std::stringstream sout;
865  el->Reference()->Print(sout);
866  el->Print(sout);
867  LOGPZ_DEBUG(loggerel2,sout.str())
868  }
869 #endif
870  }
871 
872  if(data->fGlobRhs){
873  // Assemble the matrix
874  if(!ef.HasDependency())
875  {
877  }
878  else
879  {
881  }
882  }
884  int elBl = (*data->fnextBlocked)[localiel];
885  if (elBl >= 0 && data->felBlocked.find(elBl) != data->felBlocked.end()){
886  data->felBlocked[elBl]--;
887  if (data->felBlocked[elBl] == 0){
888  data->felBlocked.erase(elBl);
889  if(data->fSleeping) {
890  data->fSleeping=false;
891  }
892  pthread_cond_broadcast(&data->fCondition);
893  }
894  }
895  else if(elBl >= 0){
896  DebugStop();
897  }
899  }
900  }
901 
902  return 0;
903 }
904 
905 static bool CanAssemble(TPZStack<int64_t> &connectlist, TPZVec<int64_t> &elContribute) {
906  for (int64_t i = 0; i < connectlist.NElements(); i++) {
907  if (elContribute[connectlist[i]] >= 0) {
908  return false;
909  }
910  }
911  return true;
912 }
913 
914 static void AssembleColor(int64_t el, TPZStack<int64_t> &connectlist, TPZVec<int64_t> &elContribute) {
915  for (int64_t i = 0; i < connectlist.NElements(); i++) {
916  elContribute[connectlist[i]] = el;
917  }
918 }
919 
920 static int64_t WhoBlockedMe(TPZStack<int64_t> &connectlist, TPZVec<int64_t> &elContribute, TPZVec<int64_t> &elSeqinv) {
921  int64_t el = -1;
922  for (int64_t i = 0; i < connectlist.NElements(); i++) {
923  int64_t elBlocked = elContribute[connectlist[i]];
924  if (elBlocked == -1) continue;
925  int64_t elBlockedIndex = elSeqinv[elBlocked];
926  if (el == -1) el = elBlockedIndex;
927  if (elBlockedIndex < el) el = elBlockedIndex;
928  }
929  return el;
930 }
931 
932 static void RemoveEl(int64_t el, TPZCompMesh *cmesh, TPZVec<int64_t> &elContribute, int64_t elSequence) {
933  TPZCompEl *cel = cmesh->ElementVec()[el];
934  if (!cel) DebugStop();
935  TPZStack<int64_t> connectlist;
936  cel->BuildConnectList(connectlist);
937  for (int64_t i = 0; i < connectlist.NElements(); i++) {
938  int64_t conindex = connectlist[i];
939  if (elContribute[conindex] != elSequence) {
940  DebugStop();
941  }
942  elContribute[conindex] = -1;
943  }
944 }
945 
946 static int MinPassIndex(TPZStack<int64_t> &connectlist, TPZVec<int64_t> &elContribute, TPZVec<int64_t> &passIndex) {
947  int minPassIndex = -1;
948  for (int64_t i = 0; i < connectlist.NElements(); i++) {
949  int64_t elcont = elContribute[connectlist[i]];
950  int64_t passindex = -1;
951  if (elcont != -1) {
952  passindex = passIndex[elcont];
953  if (minPassIndex == -1) minPassIndex = passindex;
954  }
955  if (minPassIndex < passindex) minPassIndex = passindex;
956  }
957  return minPassIndex;
958 }
959 
961  TPZVec<int64_t> &elBlocked) {
962 
963  const int64_t n_connects = cmesh->NConnects();
964  const int64_t nel = cmesh->NElements();
965 
966  TPZManVector<int64_t> elContribute(n_connects, -1); // given a connect index, tells the index of the element which will assemble it
967  TPZManVector<int64_t> elSequenceColorInv(nel, -1); // given an element index, tells its color
968  TPZManVector<int64_t> passIndex(nel, -1); // the number of the pass in which the element was colored
969  elSequenceColor.Resize(nel);
970  elSequenceColor.Fill(-1);
971  elBlocked.Resize(nel);
972  elBlocked.Fill(-1);
973  int64_t nelProcessed = 0; // Total number of colored elements so far
974  int64_t currentPassIndex = 0; // Index of this pass (a certain number of passes through the list of elements is needed for full coloring)
975  while (nelProcessed < elSequence.NElements()) {
976  for (auto elindex : elSequence) {
977  if (elSequenceColorInv[elindex] == -1) {
978  TPZCompEl *cel = cmesh->Element(elindex);
979 
980  if (!cel) continue;
981  TPZStack<int64_t> connectlist;
982  cel->BuildConnectList(connectlist);
983  // std::cout << "elcontribute " << elContribute << std::endl;
984  // std::cout << "connectlist " << connectlist << std::endl;
985  int minPass = MinPassIndex(connectlist, elContribute, passIndex);
986  // None of the connects in this element has been associated with a colored element
987  if (minPass == -1) {
988  passIndex[elindex] = currentPassIndex;
989  AssembleColor(elindex, connectlist, elContribute);
990  elSequenceColor[nelProcessed] = elindex;
991  elSequenceColorInv[elindex] = nelProcessed;
992  nelProcessed++;
993  } else if (minPass == currentPassIndex) {
994  } else if (minPass < currentPassIndex) {
995  while (!CanAssemble(connectlist, elContribute)) {
996  const int64_t el = WhoBlockedMe(connectlist, elContribute, elSequenceColorInv);
997  if (elBlocked[el] == -1) elBlocked[el] = nelProcessed;
998  int64_t locindex = elSequenceColor[el];
999  RemoveEl(locindex, cmesh, elContribute, locindex);
1000  // std::cout << "elcontribute " << elContribute << std::endl;
1001  }
1002  passIndex[elindex] = currentPassIndex;
1003  AssembleColor(elindex, connectlist, elContribute);
1004  elSequenceColor[nelProcessed] = elindex;
1005  elSequenceColorInv[elindex] = nelProcessed;
1006  nelProcessed++;
1007  } else {
1008  DebugStop();
1009  }
1010  }
1011  }
1012  currentPassIndex++;
1013  }
1014 
1015  //std::cout << "sequence: " << elSequence << std::endl;
1016  //std::cout << "color: " << elSequenceColorInv << std::endl;
1017 
1018 
1019  // exit(101);
1020  /*
1021  std::ofstream toto("c:\\Temp\\output\\ColorMeshDebug.txt");
1022  toto << "elSequence\n" << elSequence << std::endl;
1023  toto << "elSequenceColor\n" << elSequenceColor << std::endl;
1024  toto << "elSequenceColorInv\n" << elSequenceColorInv << std::endl;
1025  toto << "elBlocked\n" << elBlocked << std::endl;
1026  toto << "elContribute\n" << elContribute << std::endl;
1027  toto << "passIndex\n" << passIndex << std::endl;
1028  toto.close();
1029  */
1030 }
1031 
1033  int64_t numelconnected = 0;
1034  int64_t nconnect = cmesh->NConnects();
1035  //firstelconnect contains the first element index in the elconnect vector
1036  TPZVec<int64_t> firstelconnect(nconnect + 1);
1037  firstelconnect[0] = 0;
1038  for (int64_t ic = 0; ic < nconnect; ic++) {
1039  numelconnected += cmesh->ConnectVec()[ic].NElConnected();
1040  firstelconnect[ic + 1] = firstelconnect[ic] + cmesh->ConnectVec()[ic].NElConnected();
1041  }
1042  //cout << "numelconnected " << numelconnected << endl;
1043  //cout << "firstelconnect ";
1044  // for(ic=0; ic<nconnect; ic++) cout << firstelconnect[ic] << ' ';
1045  TPZVec<int64_t> elconnect(numelconnected, -1);
1046  TPZCompEl *cel;
1047  for (int64_t el = 0; el < cmesh->NElements(); el++) {
1048  cel = cmesh->Element(el);
1049  if (!cel) continue;
1050  TPZStack<int64_t> connectlist;
1051  cel->BuildConnectList(connectlist);
1052  int64_t nc = connectlist.NElements();
1053  for (int64_t ic = 0; ic < nc; ic++) {
1054  int64_t cindex = connectlist[ic];
1055  elconnect[firstelconnect[cindex]] = el;
1056  firstelconnect[cindex]++;
1057  }
1058  }
1059  // for(ic=0; ic<numelconnected; ic++) cout << elconnect[ic] << endl;
1060  firstelconnect[0] = 0;
1061  for (int64_t ic = 0; ic < nconnect; ic++) {
1062  firstelconnect[ic + 1] = firstelconnect[ic] + cmesh->ConnectVec()[ic].NElConnected();
1063  }
1064  //cout << "elconnect\n";
1065  // int no;
1066  // for(no=0; no< fMesh->ConnectVec().NElements(); no++) {
1067  //cout << "no numero " << no << ' ' << " seq num " << fMesh->ConnectVec()[no].SequenceNumber() << ' ';
1068  // for(ic=firstelconnect[no]; ic<firstelconnect[no+1];ic++) cout << elconnect[ic] << ' ';
1069  //cout << endl;
1070  // }
1071 
1072  ElementOrder.Resize(cmesh->ElementVec().NElements(), -1);
1073  ElementOrder.Fill(-1);
1074  TPZVec<int64_t> nodeorder(cmesh->ConnectVec().NElements(), -1);
1075  firstelconnect[0] = 0;
1076  for (int64_t ic = 0; ic < nconnect; ic++) {
1077  int64_t seqnum = cmesh->ConnectVec()[ic].SequenceNumber();
1078  if (seqnum >= 0) nodeorder[seqnum] = ic;
1079  }
1080  // cout << "nodeorder ";
1081  /* for(ic=0; ic<fMesh->ConnectVec().NElements(); ic++) cout << nodeorder[ic] << ' ';
1082  cout << endl;
1083  cout.flush();*/
1084  int64_t elsequence = 0;
1085  TPZVec<int64_t> elorderinv(cmesh->ElementVec().NElements(), -1);
1086  for (int64_t seq = 0; seq < nconnect; seq++) {
1087  int64_t ic = nodeorder[seq];
1088  if (ic == -1) continue;
1089  int64_t firstind = firstelconnect[ic];
1090  int64_t lastind = firstelconnect[ic + 1];
1091  for (int64_t ind = firstind; ind < lastind; ind++) {
1092  int64_t el = elconnect[ind];
1093  if (el == -1) {
1094  continue;
1095  }
1096  if (elorderinv[el] == -1) elorderinv[el] = elsequence++;
1097  }
1098  }
1099  // cout << "elorderinv ";
1100  // for(seq=0;seq<fMesh->ElementVec().NElements();seq++) cout << elorderinv[seq] << ' ';
1101  // cout << endl;
1102  elsequence = 0;
1103  for (int64_t seq = 0; seq < cmesh->ElementVec().NElements(); seq++) {
1104  if (elorderinv[seq] == -1) continue;
1105  ElementOrder[elorderinv[seq]] = seq;
1106  }
1107 
1108  int64_t seq;
1109  for (seq = 0; seq < cmesh->ElementVec().NElements(); seq++) {
1110  if (ElementOrder[seq] == -1) break;
1111  }
1112  ElementOrder.Resize(seq);
1113 }
1114 
1116  return Hash("TPZStructMatrixGC") ^ TPZStructMatrixBase::ClassId() << 1;
1117 }
1118 
1119 void TPZStructMatrixGC::Read(TPZStream& buf, void* context) {
1120  TPZStructMatrixBase::Read(buf, context);
1121  buf.Read(fnextBlocked);
1122  buf.Read(felSequenceColor);
1123 }
1124 
1125 void TPZStructMatrixGC::Write(TPZStream& buf, int withclassid) const {
1126  TPZStructMatrixBase::Write(buf, withclassid);
1127  buf.Write(fnextBlocked);
1128  buf.Write(felSequenceColor);
1129 }
1130 
1131 template class TPZRestoreClass<TPZStructMatrixGC>;
int64_t NElements() const
Number of computational elements allocated.
Definition: pzcmesh.h:169
Contains a class to record running statistics on CSV tables.
int fNumThreads
Number of threads in Assemble process.
virtual void Serial_Assemble(TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble the global system of equations into the matrix which has already been created.
virtual void Assemble(TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface) override
Assemble the global system of equations into the matrix which has already been created.
virtual TPZStructMatrixGC * Clone() override
The timer class. Utility.
Definition: TPZTimer.h:46
TPZStructMatrixGC * fStruct
Current structmatrix object.
virtual TPZMatrix< STATE > * Create() override
Contains TPZAnalysis class which implements the sequence of actions to perform a finite element analy...
std::map< int, int > felBlocked
int ClassId() const override
Define the class id associated with the class.
void Scatter(const TPZFMatrix< TVar > &vsmall, TPZFMatrix< TVar > &vexpand) const
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.
static void * ThreadWorkResidual(void *datavoid)
int MaterialId() const
Returns the material index of the element.
Definition: pzgeoel.h:250
Timing class. Absolutely copied from GNU time. Take a look at
virtual void BuildConnectList(std::set< int64_t > &indepconnectlist, std::set< int64_t > &depconnectlist)
Builds the list of all connectivities related to the element including the connects pointed to by dep...
Definition: pzcompel.cpp:435
static void ElementColoring(TPZCompMesh *cmesh, TPZVec< int64_t > &elSequence, TPZVec< int64_t > &elSequenceColor, TPZVec< int64_t > &elBlocked)
Create blocks of elements to parallel processing.
Contains declaration of TPZGeoNode class which defines a geometrical node.
virtual TPZCompMesh * Mesh() const
Access method for the mesh pointer.
void Read(TPZStream &buf, void *context) override
read objects from the stream
void Filter(TPZVec< int64_t > &orig, TPZVec< int64_t > &dest) const
void AddFel(TPZFMatrix< TVar > &rhs, TPZVec< int64_t > &destination)
Performs a right hand side assemblage.
Definition: pzfmatrix.cpp:209
TPZFNMatrix< 1000, STATE > fMat
Pointer to a blocked matrix object.
Definition: pzelmat.h:41
Contains declaration of TPZCompEl class which defines the interface of a computational element...
Templated vector implementation.
static void * ThreadWork(void *threaddata)
The function which will compute the matrices.
static int64_t WhoBlockedMe(TPZStack< int64_t > &connectlist, TPZVec< int64_t > &elContribute, TPZVec< int64_t > &elSeqinv)
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef)
Computes the element stifness matrix and right hand side.
Definition: pzcompel.h:794
void LeaveCriticalSection(pz_critical_section_t &cs)
int64_t fNextElement
Current element.
TPZEquationFilter fEquationFilter
Object which will determine which equations will be assembled.
Declarates the TPZBlock<REAL>class which implements block matrices.
RunStatsTable stat_ass_graph("-ass_graph", "Run statistics table for the graph creation and coloring TPZStructMatrixGC.")
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
int64_t NElements() const
Access method to query the number of elements of the vector.
static void RemoveEl(int64_t el, TPZCompMesh *cmesh, TPZVec< int64_t > &elContribute, int64_t elSequence)
Implements a chunk vector with free store administration. Utility.
Definition: TPZStream.h:39
#define MAX(a, b)
Gets maxime value between a and b.
Definition: pzreal.h:81
Contains the TPZStructMatrixGC class which responsible for a interface among Matrix and Finite Elemen...
virtual int NSides() const =0
Returns the number of connectivities of the element.
int ClassId() const override
Define the class id associated with the class.
void EnterCriticalSection(pz_critical_section_t &cs)
TPZManVector< int64_t > fDestinationIndex
Definition: pzelmat.h:53
void ComputeDestinationIndices()
Definition: pzelmat.cpp:126
virtual int IsInterface()
Definition: pzcompel.h:159
virtual void MultiThread_Assemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble the global right hand side.
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
virtual void CenterPoint(int side, TPZVec< REAL > &masscent) const =0
It returns the coordinates from the center of the side of the element in the element coordinate space...
TPZCompMesh * fMesh
Pointer to the computational mesh from which the matrix will be generated.
#define PZ_PTHREAD_JOIN(thread, val, fn)
Definition: pz_pthread.h:34
virtual const std::set< int > & MaterialIds()
Returns the material ids.
virtual TPZMaterial * Material() const
Identify the material object associated with the element.
Definition: pzcompel.cpp:959
void Print(std::ostream &out)
Definition: pzelmat.cpp:47
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
TPZCompEl * Element(int64_t iel)
Definition: pzcmesh.h:185
Contains declaration of TPZMesh class which defines a geometrical mesh and contains a corresponding l...
int64_t NActiveEquations() const
Retorna o numero de equacoes ativas do sistema.
TPZVec< int64_t > felSequenceColor
std::string & processName()
Gets the process name (for reporting purposes).
Definition: TPZTimer.h:168
void start()
Turns the timer on.
Definition: TPZTimer.cpp:28
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
static int MinPassIndex(TPZStack< int64_t > &connectlist, TPZVec< int64_t > &elContribute, TPZVec< int64_t > &passIndex)
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
TPZVec< int64_t > * felSequenceColor
int64_t Index() const
Returns the index of the element within the element vector of the mesh.
Definition: pzgeoel.h:730
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
Contains TPZMatrixclass which implements full matrix (using column major representation).
Implements a group of computational elements as a mesh and an element. Computational Mesh...
Definition: pzsubcmesh.h:36
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
Structure to manipulate thread to solve system equations.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
Free store vector implementation.
static void OrderElement(TPZCompMesh *cmesh, TPZVec< int64_t > &ElementOrder)
Find the order to assemble the elements.
TPZMatrix< STATE > * fGlobMatrix
Global matrix.
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
static void AssembleColor(int64_t el, TPZStack< int64_t > &connectlist, TPZVec< int64_t > &elContribute)
ThreadData(TPZStructMatrixGC *strmat, TPZMatrix< STATE > &mat, TPZFMatrix< STATE > &rhs, std::set< int > &MaterialIds, TPZAutoPointer< TPZGuiInterface > guiInterface)
Initialize the mutex semaphores and others.
virtual void AddKel(TPZFMatrix< TVar > &elmat, TPZVec< int64_t > &destinationindex)
Add a contribution of a stiffness matrix.
Definition: pzmatrix.cpp:506
virtual TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
Definition: pzstrmatrixgc.h:50
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
TPZAutoPointer< TPZGuiInterface > fGuiInterface
Gui interface object.
#define PZ_PTHREAD_MUTEX_DESTROY(mutex, fn)
Definition: pz_pthread.h:73
int64_t NEqExpand() const
Retorna o numero de equacoes do sistema original.
int64_t NConnects() const
Number of connects allocated including free nodes.
Definition: pzcmesh.h:163
TPZAdmChunkVector< TPZConnect > & ConnectVec()
Return a reference to the connect pointers vector.
Definition: pzcmesh.h:198
int64_t Index() const
Returns element index of the mesh fELementVec list.
Definition: pzcompel.h:821
virtual bool ShouldCompute(int matid) const
Establish whether the element should be computed.
Implements an interface to check the consistency of two implementations. Utility. ...
TPZVec< int64_t > * fnextBlocked
Vector for mesh coloring.
TPZManVector< int64_t > fSourceIndex
Definition: pzelmat.h:53
std::set< int > fMaterialIds
Set of material ids to be considered. It is a private attribute.
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Definition: pzlog.h:93
static RunStatsTable ass_rhs("-ass_rhs", "Assemble Stiffness")
TPZVec< int64_t > fnextBlocked
Vectors for mesh coloring.
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
Refines geometrical mesh (all the elements) num times.
Definition: pzstrmatrixgc.h:34
bool NeedsComputing(const std::set< int > &matids) override
Verifies if any element needs to be computed corresponding to the material ids.
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
This class associates an element matrix with the coeficients of its contribution in the global stiffn...
Definition: pzelmat.h:30
TPZFNMatrix< 1000, STATE > fConstrMat
Pointer to the constrained matrix object.
Definition: pzelmat.h:48
void ApplyConstraints()
Apply the constraints applied to the nodes by transforming the tangent matrix and right hand side...
Definition: pzelmat.cpp:186
Contains declaration of TPZSubCompMesh class which implements a group of computational elements as a ...
~ThreadData()
Destructor: Destroy the mutex semaphores and others.
virtual int Dimension() const =0
Returns the dimension of the element.
virtual void CalcResidual(TPZElementMatrix &ef)
Computes the element right hand side.
Definition: pzcompel.cpp:610
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...
static bool CanAssemble(TPZStack< int64_t > &connectlist, TPZVec< int64_t > &elContribute)
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Definition: pzcmesh.h:183
virtual void Print(std::ostream &out=std::cout) const
Prints element data.
Definition: pzcompel.cpp:322
#define PZ_PTHREAD_CREATE(thread, attr, routine, args, fn)
Definition: pz_pthread.h:31
Contains declaration of TPZInterpolatedElement class which implements computational element of the in...
int Id() const
Definition: TPZMaterial.h:170
void Fill(const T &copy, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
Definition: pzvec.h:460
pthread_mutex_t fAccessElement
Mutexes (to choose which element is next)
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
virtual void FilterEquations(TPZVec< int64_t > &origindex, TPZVec< int64_t > &destindex) const
Filter out the equations which are out of the range.
virtual void Print(std::ostream &out) const
Definition: pzmatrix.h:253
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
void stop()
Turns the timer off, and computes the elapsed time.
Definition: TPZTimer.cpp:36
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
#define PZ_PTHREAD_MUTEX_INIT(mutex, attr, fn)
Definition: pz_pthread.h:70
virtual void Print(std::ostream &out=std::cout)
Print all relevant data of the element to cout.
Definition: pzgeoel.cpp:238
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
virtual int HasDependency()
Returns 1 if the element has at least one dependent node. Returns 0 otherwise.
Definition: pzcompel.cpp:565
bool HasDependency()
Returns true if the element has at least one dependent node. Returns false otherwise.
Definition: pzelmat.cpp:482
static RunStatsTable ass_stiff("-ass_stiff", "Assemble Stiffness")
void Read(TPZStream &buf, void *context) override
read objects from the stream
Implements an interface to register a class id and a restore function. Persistence.
Definition: TPZSavable.h:150
Contains TPZSFMatrix class which implements a symmetric full matrix.
virtual void Read(bool &val)
Definition: TPZStream.cpp:91
TPZFMatrix< STATE > * fGlobRhs
Global rhs vector.