NeoPZ
pzstrmatrixflowtbb.cpp
Go to the documentation of this file.
1 
6 #include "pzstrmatrixflowtbb.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 #include "pzlog.h"
30 
31 #include "pz_pthread.h"
32 
33 #ifdef LOG4CXX
34 static LoggerPtr logger(Logger::getLogger("pz.strmatrix.TPZStructMatrixTBBFlow"));
35 static LoggerPtr loggerel(Logger::getLogger("pz.strmatrix.element"));
36 static LoggerPtr loggerel2(Logger::getLogger("pz.strmatrix.elementinterface"));
37 static LoggerPtr loggerelmat(Logger::getLogger("pz.strmatrix.elementmat"));
38 static LoggerPtr loggerCheck(Logger::getLogger("pz.strmatrix.checkconsistency"));
39 #endif
40 
41 #ifdef CHECKCONSISTENCY
42 static TPZCheckConsistency stiffconsist("ElementStiff");
43 #endif
44 
45 
46 #include "run_stats_table.h"
47 
48 static RunStatsTable stat_ass_graph_tbb("-ass_graph_tbb", "Run statistics table for the graph creation, coloring and tbb::flow::graph TPZStructMatrixTBBFlow.");
49 
50 
51 TPZStructMatrixTBBFlow::TPZStructMatrixTBBFlow(TPZCompMesh *mesh) : fMesh(mesh), fEquationFilter(mesh->NEquations()) {
52  fMesh = mesh;
53  this->SetNumThreads(0);
54 #ifdef USING_TBB
55  this->fFlowGraph = new TPZFlowGraph(this);
56 #endif
57 }
58 
60  fMesh = cmesh.operator->();
61  this->SetNumThreads(0);
62 #ifdef USING_TBB
63  this->fFlowGraph = new TPZFlowGraph(this);
64 #endif
65 }
66 
68 {
69  if (copy.fCompMesh) {
70  fCompMesh = copy.fCompMesh;
71  }
73  fNumThreads = copy.fNumThreads;
74 #ifdef USING_TBB
75  fFlowGraph = new TPZFlowGraph(*copy.fFlowGraph);
76 #endif
77 }
78 
79 
80 
82 {
83 #ifdef USING_TBB
84  if (fFlowGraph) {
85  delete fFlowGraph;
86  }
87 #endif
88 }
89 
91  std::cout << "TPZStructMatrixTBBFlow::Create should never be called\n";
92  return 0;
93 }
94 
96  std::cout << "TPZStructMatrixTBBFlow::Clone should never be called\n";
97  return 0;
98 }
99 
100 static RunStatsTable ass_stiff("-ass_stiff", "Assemble Stiffness");
101 static RunStatsTable ass_rhs("-ass_rhs", "Assemble Stiffness");
102 
104  ass_stiff.start();
105  if (fEquationFilter.IsActive()) {
106  int64_t neqcondense = fEquationFilter.NActiveEquations();
107 #ifdef PZDEBUG
108  if (stiffness.Rows() != neqcondense) {
109  DebugStop();
110  }
111 #endif
112  TPZFMatrix<STATE> rhsloc(neqcondense,rhs.Cols(),0.);
113  this->MultiThread_Assemble(stiffness,rhsloc,guiInterface);
114  fEquationFilter.Scatter(rhsloc, rhs);
115  }
116  else
117  {
118  this->MultiThread_Assemble(stiffness,rhs,guiInterface);
119 
120  }
121  ass_stiff.stop();
122 }
123 
125  ass_rhs.start();
127  {
128  int64_t neqcondense = fEquationFilter.NActiveEquations();
129  int64_t neqexpand = fEquationFilter.NEqExpand();
130  if(rhs.Rows() != neqexpand || Norm(rhs) != 0.)
131  {
132  DebugStop();
133  }
134  TPZFMatrix<STATE> rhsloc(neqcondense,1,0.);
135  this->MultiThread_Assemble(rhsloc,guiInterface);
136  fEquationFilter.Scatter(rhsloc,rhs);
137  }
138  else
139  {
140  this->MultiThread_Assemble(rhs,guiInterface);
141  }
142  ass_rhs.stop();
143 }
144 
146 {
147  TPZMatrix<STATE> *stiff = Create();
148 
149  int64_t cols = MAX(1, rhs.Cols());
150  rhs.Redim(fEquationFilter.NEqExpand(),cols);
151 
152  Assemble(*stiff,rhs,guiInterface);
153 
154 #ifdef LOG4CXX2
155  if(loggerel->isDebugEnabled())
156  {
157  std::stringstream sout;
158  stiff->Print("Stiffness matrix",sout);
159  rhs.Print("Right hand side", sout);
160  LOGPZ_DEBUG(loggerel,sout.str())
161  }
162 #endif
163  return stiff;
164 
165 }
166 
168 {
169 #ifdef USING_TBB
170  this->fFlowGraph->ExecuteGraph(&rhs, &mat);
171 #else
172  std::cout << "To use the tbb flow graph assemble please compile the NeoPZ with USING_TBB." << std::endl;
173 #endif
174 }
175 
176 
178 {
179 #ifdef USING_TBB
180  this->fFlowGraph->ExecuteGraph(&rhs);
181 #else
182  std::cout << "To use the tbb flow graph assemble please compile the NeoPZ with USING_TBB." << std::endl;
183 #endif
184 }
185 
187  return Hash("TPZStructMatrixTBBFlow") ^ TPZStructMatrixBase::ClassId() << 1;
188 }
189 
190 static bool CanAssemble(TPZStack<int64_t> &connectlist, TPZVec<int> &elContribute)
191 {
192  for (int i = 0 ; i < connectlist.NElements() ; i++)
193  {
194  if (elContribute[connectlist[i]] >= 0){
195  return false;
196  }
197  }
198  return true;
199 }
200 
201 static void AssembleColor(int el,TPZStack<int64_t> &connectlist, TPZVec<int> &elContribute)
202 {
203  for (int i = 0 ; i < connectlist.NElements() ; i++)
204  {
205  elContribute[connectlist[i]] = el;
206  }
207 }
208 
209 static int WhoBlockedMe(TPZStack<int64_t> &connectlist, TPZVec<int> &elContribute, TPZVec<int> &elSeqinv)
210 {
211  int el = -1;
212  for (int i = 0 ; i < connectlist.NElements() ; i++)
213  {
214  int elBlocked = elContribute[connectlist[i]];
215  if (elBlocked == -1) continue;
216  int elBlockedIndex = elSeqinv[elBlocked];
217  if (el == -1) el = elBlockedIndex;
218  if (elBlockedIndex < el) el = elBlockedIndex;
219  }
220  return el;
221 }
222 
223 static void RemoveEl(int el,TPZCompMesh *cmesh,TPZVec<int> &elContribute,int elSequence)
224 {
225  TPZCompEl *cel = cmesh->ElementVec()[el];
226  if(!cel) DebugStop();
227  TPZStack<int64_t> connectlist;
228  cel->BuildConnectList(connectlist);
229  for (int i = 0 ; i < connectlist.NElements() ; i++)
230  {
231  int conindex = connectlist[i];
232  if (elContribute[conindex] != elSequence){
233  DebugStop();
234  }
235  elContribute[conindex] = -1;
236  }
237 }
238 
239 static int MinPassIndex(TPZStack<int64_t> &connectlist,TPZVec<int> &elContribute, TPZVec<int> &passIndex)
240 {
241  int minPassIndex = -1;
242  for (int i = 0 ; i < connectlist.NElements() ; i++)
243  {
244  int elcont = elContribute[connectlist[i]];
245  int passindex = -1;
246  if (elcont != -1){
247  passindex = passIndex[elcont];
248  if (minPassIndex == -1) minPassIndex = passindex;
249  }
250  if (minPassIndex < passindex) minPassIndex = passindex;
251  }
252  return minPassIndex;
253 }
254 
255 void TPZStructMatrixTBBFlow::Read(TPZStream& buf, void* context) {
256  TPZStructMatrixBase::Read(buf,context);
257  fMesh = dynamic_cast<TPZCompMesh *>(TPZPersistenceManager::GetInstance(&buf));
258  fCompMesh = TPZAutoPointerDynamicCast<TPZCompMesh>(TPZPersistenceManager::GetAutoPointer(&buf));
259  fEquationFilter.Read(buf, context);
260  buf.Read(fMaterialIds);
261  buf.Read(&fNumThreads);
262 #ifdef USING_TBB
263  fFlowGraph = new TPZFlowGraph(this);
264 #endif
265 }
266 
267 void TPZStructMatrixTBBFlow::Write(TPZStream& buf, int withclassid) const {
268  TPZStructMatrixBase::Write(buf,withclassid);
270  TPZPersistenceManager::WritePointer(fCompMesh.operator ->(), &buf);
271  fEquationFilter.Write(buf, withclassid);
272 #ifdef USING_TBB
273  DebugStop();
274 // TPZPersistenceManager::WritePointer(fFlowGraph, &buf);
275 #endif
276  buf.Write(fMaterialIds);
277  buf.Write(&fNumThreads);
278 }
279 
280 
281 #ifdef USING_TBB
282 void TPZStructMatrixTBBFlow::TPZFlowGraph::ElementColoring()
283 {
284 
285  const int nnodes = cmesh->NConnects();
286  const int nel = cmesh->ElementVec().NElements();
287 
288  TPZManVector<int> elContribute(nnodes,-1), passIndex(nel,-1);
289  felSequenceColor.Resize(nel);
290  felSequenceColor.Fill(-1);
291  felSequenceColorInv.Resize(nel, -1);
292  felSequenceColorInv.Fill(-1);
293  fnextBlocked.Resize(nel);
294  fnextBlocked.Fill(-1);
295  int nelProcessed = 0;
296  int currentEl = 0;
297  int currentPassIndex = 0;
298  while (nelProcessed < fElementOrder.NElements()){
299 
300  int elindex = fElementOrder[currentEl];
301 
302  if(felSequenceColorInv[elindex] == -1)
303  {
304  TPZCompEl *cel = cmesh->ElementVec()[elindex];
305 
306 
307  if(!cel) continue;
308  TPZStack<int64_t> connectlist;
309  cel->BuildConnectList(connectlist);
310  // std::cout << "elcontribute " << elContribute << std::endl;
311  // std::cout << "connectlist " << connectlist << std::endl;
312  int minPass = MinPassIndex(connectlist,elContribute,passIndex);
313  if (minPass == -1){
314  passIndex[elindex] = currentPassIndex;
315  AssembleColor(elindex,connectlist,elContribute);
316  felSequenceColor[nelProcessed] = elindex;
317  felSequenceColorInv[elindex] = nelProcessed;
318  nelProcessed++;
319  }
320  else if (minPass == currentPassIndex){
321  }
322  else if (minPass < currentPassIndex){
323  while (!CanAssemble(connectlist,elContribute)){
324  const int el = WhoBlockedMe(connectlist,elContribute, felSequenceColorInv);
325  if (fnextBlocked[el] == -1) fnextBlocked[el] = nelProcessed;
326  int locindex = felSequenceColor[el];
327  RemoveEl(locindex,cmesh,elContribute,locindex);
328  // std::cout << "elcontribute " << elContribute << std::endl;
329  }
330  passIndex[elindex] = currentPassIndex;
331  AssembleColor(elindex,connectlist,elContribute);
332  felSequenceColor[nelProcessed] = elindex;
333  felSequenceColorInv[elindex] = nelProcessed;
334  nelProcessed++;
335  }
336  else{
337  DebugStop();
338  }
339  }
340  currentEl++;
341  if (currentEl == fElementOrder.NElements()){
342  currentEl = 0;
343  currentPassIndex++;
344  }
345  }
346 
347  //std::cout << "sequence: " << elSequence << std::endl;
348  //std::cout << "color: " << elSequenceColorInv << std::endl;
349 
350 
351  // exit(101);
352 #ifdef PZDEBUG
353  std::ofstream toto("../ColorMeshDebug.txt");
354  toto << "elSequence\n" << fElementOrder << std::endl;
355  toto << "elSequenceColor\n" << felSequenceColor << std::endl;
356  toto << "elSequenceColorInv\n" << felSequenceColorInv << std::endl;
357  toto << "elBlocked\n" << fnextBlocked << std::endl;
358  toto << "elContribute\n" << elContribute << std::endl;
359  toto << "passIndex\n" << passIndex << std::endl;
360  toto.close();
361 #endif
362 }
363 
364 TPZStructMatrixTBBFlow::TPZFlowGraph::TPZFlowGraph(TPZStructMatrixTBBFlow *strmat)
365 : cmesh(strmat->Mesh()), fStartNode(fGraph), fStruct(strmat), fGlobMatrix(0), fGlobRhs(0)
366 {
367  this->OrderElements();
368  this->ElementColoring();
369  this->CreateGraph();
370 }
371 
372 TPZStructMatrixTBBFlow::TPZFlowGraph::~TPZFlowGraph()
373 {
374  for (int k = 0; k < fNodes.size(); ++k) {
375  delete fNodes[k];
376  }
377 
378 }
379 
380 void TPZStructMatrixTBBFlow::TPZFlowGraph::ExecuteGraph(TPZFMatrix<STATE> *rhs, TPZMatrix<STATE> *matrix)
381 {
382 
383  this->fGlobMatrix = matrix;
384  this->fGlobRhs = rhs;
385  this->fStartNode.try_put(tbb::flow::continue_msg());
386  this->fGraph.wait_for_all();
387 
388 }
389 
390 TPZStructMatrixTBBFlow::TPZFlowGraph::TPZFlowGraph(TPZFlowGraph const &copy)
391 : cmesh(copy.fStruct->Mesh()), fStartNode(fGraph), fStruct(copy.fStruct), fGlobMatrix(0), fGlobRhs(0)
392 {
393  this->fnextBlocked = copy.fnextBlocked;
394  this->felSequenceColor = copy.felSequenceColor;
395  this->felSequenceColorInv = copy.felSequenceColorInv;
396  this->fElementOrder = copy.fElementOrder;
397  this->CreateGraph();
398 }
399 
400 void TPZStructMatrixTBBFlow::TPZFlowNode::operator()(tbb::flow::continue_msg) const
401 {
402  TPZCompMesh *cmesh = myGraph->fStruct->Mesh();
403  TPZAutoPointer<TPZGuiInterface> guiInterface = myGraph->fGuiInterface;
406 #ifdef LOG4CXX
407  if (logger->isDebugEnabled()) {
408  std::stringstream sout;
409  sout << "Computing element " << iel;
410  LOGPZ_DEBUG(logger, sout.str())
411  }
412 #endif
413 #ifdef LOG4CXX
414  std::stringstream sout;
415  sout << "Element " << iel << " elapsed time ";
416  TPZTimer timeforel(sout.str());
417  timeforel.start();
418 #endif
419 
420  int element = myGraph->felSequenceColor[iel];
421 
422  if (element >= 0){
423 
424  TPZCompEl *el = cmesh->ElementVec()[element];
425 
426  if(!el) return;
427 
428  if (myGraph->fGlobMatrix)
429  el->CalcStiff(ek,ef);
430  else
431  el->CalcResidual(ef);
432 
433  if(!el->HasDependency()) {
434 
435  if (myGraph->fGlobMatrix) {
437  myGraph->fStruct->FilterEquations(ek.fSourceIndex,ek.fDestinationIndex);
438  } else {
440  myGraph->fStruct->FilterEquations(ef.fSourceIndex,ef.fDestinationIndex);
441  }
442 
443  } else {
444  // the element has dependent nodes
445  if (myGraph->fGlobMatrix) {
446  ek.ApplyConstraints();
447  ef.ApplyConstraints();
449  myGraph->fStruct->FilterEquations(ek.fSourceIndex,ek.fDestinationIndex);
450  } else {
451  ef.ApplyConstraints();
453  myGraph->fStruct->FilterEquations(ef.fSourceIndex,ef.fDestinationIndex);
454  }
455 
456  }
457 
458 
459  if(myGraph->fGlobMatrix) {
460  // assemble the matrix
461  if(!ek.HasDependency()) {
462  myGraph->fGlobMatrix->AddKel(ek.fMat,ek.fSourceIndex,ek.fDestinationIndex);
463  myGraph->fGlobRhs->AddFel(ef.fMat,ek.fSourceIndex,ek.fDestinationIndex);
464  } else {
465  myGraph->fGlobMatrix->AddKel(ek.fConstrMat,ek.fSourceIndex,ek.fDestinationIndex);
466  myGraph->fGlobRhs->AddFel(ef.fConstrMat,ek.fSourceIndex,ek.fDestinationIndex);
467  }
468  } else {
469  if(!ef.HasDependency()) {
470  myGraph->fGlobRhs->AddFel(ef.fMat,ef.fSourceIndex,ef.fDestinationIndex);
471  } else {
472  myGraph->fGlobRhs->AddFel(ef.fConstrMat,ef.fSourceIndex,ef.fDestinationIndex);
473  }
474  }
475 
476  } // outsided if
477 
478 #ifdef LOG4CXX
479  timeforel.stop();
480  if (logger->isDebugEnabled())
481  {
482  std::stringstream sout;
483  sout << timeforel.processName() << timeforel;
484  LOGPZ_DEBUG(logger, sout.str())
485  }
486 #endif
487 
488 }
489 
490 void TPZStructMatrixTBBFlow::TPZFlowGraph::CreateGraph()
491 {
492  int64_t nelem = cmesh->NElements();
493  int64_t nconnects = cmesh->NConnects();
494  int64_t numberOfElements=felSequenceColor.NElements();
495 
496  // each graphnode represents an element that can be computed and assembled
497  fNodes.resize(felSequenceColor.NElements());
498  for (int64_t i=0; i<felSequenceColor.NElements(); i++) {
499  fNodes[i]= new tbb::flow::continue_node<tbb::flow::continue_msg>(fGraph, TPZFlowNode(this, i));
500  }
501  TPZVec<int64_t> elementloaded(nconnects,-1);
502 
503  for (int64_t graphindex = 0; graphindex<numberOfElements; graphindex++) {
504  int64_t el = felSequenceColor[graphindex];
505  TPZCompEl *cel = cmesh->Element(el);
506  if (!cel) {
507  continue;
508  }
509  TPZStack<int64_t> connects;
510  cel->BuildConnectList(connects);
511  int ngraphs = 0;
512  std::set<int64_t> fromwhere;
513  for (int ic=0; ic<connects.size(); ic++) {
514  int64_t c = connects[ic];
515  if (elementloaded[c] != -1) {
516  int64_t elorig = elementloaded[c];
517  // in order to compute only once
518  if (fromwhere.find(elorig) == fromwhere.end()) {
519 #ifdef LOG4CXX
520  if (logger->isDebugEnabled()) {
521  std::stringstream sout;
522  sout << "Adding edge from " << elorig << " to " << graphindex;
523  LOGPZ_DEBUG(logger, sout.str())
524  }
525 #endif
526  make_edge(*fNodes[elorig], *fNodes[graphindex]);
527  }
528  fromwhere.insert(elorig);
529  ngraphs++;
530  }
531  }
532  if (ngraphs == 0) {
533 #ifdef LOG4CXX
534  if (logger->isDebugEnabled()) {
535  std::stringstream sout;
536  sout << "Setting start element " << graphindex;
537  LOGPZ_DEBUG(logger, sout.str())
538  }
539 #endif
540 
541  make_edge(fStartNode, *fNodes[graphindex]);
542  }
543  for (int ic=0; ic<connects.size(); ic++) {
544  int64_t c = connects[ic];
545  elementloaded[c] = graphindex;
546  }
547  }
548 
549 }
550 
551 void TPZStructMatrixTBBFlow::TPZFlowGraph::OrderElements()
552 {
553  int numelconnected = 0;
554  int nconnect = cmesh->ConnectVec().NElements();
555  int ic;
556  //firstelconnect contains the first element index in the elconnect vector
557  TPZVec<int> firstelconnect(nconnect+1);
558  firstelconnect[0] = 0;
559  for(ic=0; ic<nconnect; ic++) {
560  numelconnected += cmesh->ConnectVec()[ic].NElConnected();
561  firstelconnect[ic+1] = firstelconnect[ic]+cmesh->ConnectVec()[ic].NElConnected();
562  }
563  //cout << "numelconnected " << numelconnected << endl;
564  //cout << "firstelconnect ";
565  // for(ic=0; ic<nconnect; ic++) cout << firstelconnect[ic] << ' ';
566  TPZVec<int> elconnect(numelconnected,-1);
567  int el;
568  TPZCompEl *cel;
569  for(el=0; el<cmesh->ElementVec().NElements(); el++) {
570  cel = cmesh->ElementVec()[el];
571  if(!cel) continue;
572  TPZStack<int64_t> connectlist;
573  cel->BuildConnectList(connectlist);
574  int nc = connectlist.NElements();
575  int ic;
576  for(ic=0; ic<nc; ic++) {
577  int cindex = connectlist[ic];
578  elconnect[firstelconnect[cindex]] = el;
579  firstelconnect[cindex]++;
580  }
581  }
582  // for(ic=0; ic<numelconnected; ic++) cout << elconnect[ic] << endl;
583  firstelconnect[0] = 0;
584  for(ic=0; ic<nconnect; ic++) {
585  firstelconnect[ic+1] = firstelconnect[ic]+cmesh->ConnectVec()[ic].NElConnected();
586  }
587  //cout << "elconnect\n";
588  // int no;
589  // for(no=0; no< fMesh->ConnectVec().NElements(); no++) {
590  //cout << "no numero " << no << ' ' << " seq num " << fMesh->ConnectVec()[no].SequenceNumber() << ' ';
591  // for(ic=firstelconnect[no]; ic<firstelconnect[no+1];ic++) cout << elconnect[ic] << ' ';
592  //cout << endl;
593  // }
594 
595  fElementOrder.Resize(cmesh->ElementVec().NElements(),-1);
596  fElementOrder.Fill(-1);
597  TPZVec<int> nodeorder(cmesh->ConnectVec().NElements(),-1);
598  firstelconnect[0] = 0;
599  for(ic=0; ic<nconnect; ic++) {
600  int seqnum = cmesh->ConnectVec()[ic].SequenceNumber();
601  if(seqnum >= 0) nodeorder[seqnum] = ic;
602  }
603  // cout << "nodeorder ";
604  /* for(ic=0; ic<fMesh->ConnectVec().NElements(); ic++) cout << nodeorder[ic] << ' ';
605  cout << endl;
606  cout.flush();*/
607  int seq;
608  int elsequence = 0;
609  TPZVec<int> elorderinv(cmesh->ElementVec().NElements(),-1);
610  for(seq=0; seq<nconnect; seq++) {
611  ic = nodeorder[seq];
612  if(ic == -1) continue;
613  int firstind = firstelconnect[ic];
614  int lastind = firstelconnect[ic+1];
615  int ind;
616  for(ind=firstind; ind<lastind; ind++) {
617  el = elconnect[ind];
618  if(el == -1) {
619  continue;
620  }
621  if(elorderinv[el]==-1) elorderinv[el] = elsequence++;
622  }
623  }
624  // cout << "elorderinv ";
625  // for(seq=0;seq<fMesh->ElementVec().NElements();seq++) cout << elorderinv[seq] << ' ';
626  // cout << endl;
627  elsequence = 0;
628  for(seq=0;seq<cmesh->ElementVec().NElements();seq++) {
629  if(elorderinv[seq] == -1) continue;
630  fElementOrder[elorderinv[seq]] = seq;
631  }
632 
633  for(seq=0;seq<cmesh->ElementVec().NElements();seq++) {
634  if(fElementOrder[seq]==-1) break;
635  }
636 
637  fElementOrder.Resize(seq);
638 }
639 
640 #endif
641 
Contains a class to record running statistics on CSV tables.
The timer class. Utility.
Definition: TPZTimer.h:46
static int MinPassIndex(TPZStack< int64_t > &connectlist, TPZVec< int > &elContribute, TPZVec< int > &passIndex)
static void RemoveEl(int el, TPZCompMesh *cmesh, TPZVec< int > &elContribute, int elSequence)
Contains TPZAnalysis class which implements the sequence of actions to perform a finite element analy...
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 RunStatsTable ass_rhs("-ass_rhs", "Assemble Stiffness")
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
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
static bool CanAssemble(TPZStack< int64_t > &connectlist, TPZVec< int > &elContribute)
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.
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef)
Computes the element stifness matrix and right hand side.
Definition: pzcompel.h:794
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Contains the TPZStructMatrixTBBFlow class which responsible for a interface among Matrix and Finite E...
Declarates the TPZBlock<REAL>class which implements block matrices.
TPZEquationFilter fEquationFilter
Object which will determine which equations will be assembled.
#define MAX(a, b)
Gets maxime value between a and b.
Definition: pzreal.h:81
int ClassId() const override
Define the class id associated with the class.
static TPZSavable * GetInstance(const int64_t &objId)
virtual TPZStructMatrixTBBFlow * Clone() override
TPZManVector< int64_t > fDestinationIndex
Definition: pzelmat.h:53
void ComputeDestinationIndices()
Definition: pzelmat.cpp:126
TPZSkylMatrix< REAL > matrix
Definition: numatst.cpp:255
static RunStatsTable stat_ass_graph_tbb("-ass_graph_tbb", "Run statistics table for the graph creation, coloring and tbb::flow::graph TPZStructMatrixTBBFlow.")
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
virtual TPZMatrix< STATE > * Create() override
static TPZAutoPointer< TPZSavable > GetAutoPointer(const int64_t &objId)
static void AssembleColor(int el, TPZStack< int64_t > &connectlist, TPZVec< int > &elContribute)
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
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 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.
void start()
Turns the timer on.
Definition: TPZTimer.cpp:28
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
TPZCompMesh * fMesh
Pointer to the computational mesh from which the matrix will be generated.
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
virtual void SetNumThreads(int n)
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
Refines geometrical mesh (all the elements) num times.
Free store vector implementation.
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
virtual void MultiThread_Assemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble the global system of equations into the matrix which has already been created.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
int64_t NEqExpand() const
Retorna o numero de equacoes do sistema original.
Implements an interface to check the consistency of two implementations. Utility. ...
TPZManVector< int64_t > fSourceIndex
Definition: pzelmat.h:53
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 TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
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
std::set< int > fMaterialIds
Set of material ids to be considered. It is a private attribute.
int fNumThreads
Number of threads in Assemble process.
Contains declaration of TPZSubCompMesh class which implements a group of computational elements as a ...
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
virtual void CalcResidual(TPZElementMatrix &ef)
Computes the element right hand side.
Definition: pzcompel.cpp:610
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Definition: pzcmesh.h:183
Contains declaration of TPZInterpolatedElement class which implements computational element of the in...
TPZAutoPointer< TPZCompMesh > fCompMesh
Autopointer control of the computational mesh.
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
virtual void Print(std::ostream &out) const
Definition: pzmatrix.h:253
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 Read(TPZStream &buf, void *context) override
read objects from the stream
int ClassId() const override
Define the class id associated with the class.
static RunStatsTable ass_stiff("-ass_stiff", "Assemble Stiffness")
static int WhoBlockedMe(TPZStack< int64_t > &connectlist, TPZVec< int > &elContribute, TPZVec< int > &elSeqinv)
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 void WritePointer(const TPZSavable *obj, TPZStream *stream)
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
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.