NeoPZ
TPZStrMatrixGCTP.cpp
Go to the documentation of this file.
1 
6 #include "TPZStrMatrixGCTP.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 #include <functional>
29 
30 using namespace std;
31 
32 #include "pzlog.h"
33 
34 #include "pz_pthread.h"
35 #include "run_stats_table.h"
36 #include "TPZRenumbering.h"
37 #include "TPZThreadPool.h"
38 
39 #ifdef LOG4CXX
40 static LoggerPtr logger(Logger::getLogger("pz.strmatrix.TPZStructMatrixGCTP"));
41 static LoggerPtr loggerel(Logger::getLogger("pz.strmatrix.element"));
42 static LoggerPtr loggerel2(Logger::getLogger("pz.strmatrix.elementinterface"));
43 static LoggerPtr loggerelmat(Logger::getLogger("pz.strmatrix.elementmat"));
44 static LoggerPtr loggerCheck(Logger::getLogger("pz.strmatrix.checkconsistency"));
45 #endif
46 
47 #ifdef CHECKCONSISTENCY
48 static TPZCheckConsistency stiffconsist("ElementStiff");
49 #endif
50 
51 RunStatsTable stat_ass_graph_gctp("-ass_graph_gctp", "Run statistics table for the graph creation and coloring TPZStructMatrixGCTP.");
52 
58 }
59 
65 }
66 
70 fNColors(copy.fNColors) {
71 }
72 
74  cout << "TPZStructMatrixGCTP::Create should never be called\n";
75  return 0;
76 }
77 
79  cout << "TPZStructMatrixGCTP::Clone should never be called\n";
80  return 0;
81 }
82 
83 static RunStatsTable ass_stiff("-ass_stiff", "Assemble Stiffness");
84 static RunStatsTable ass_rhs("-ass_rhs", "Assemble Stiffness");
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  } else {
99  this->Serial_Assemble(stiffness, rhsloc, guiInterface);
100  }
101 
102  fEquationFilter.Scatter(rhsloc, rhs);
103  } else {
104  if (this->fNumThreads) {
105  this->MultiThread_Assemble(stiffness, rhs, guiInterface);
106  } else {
107  this->Serial_Assemble(stiffness, rhs, guiInterface);
108  }
109  }
110  ass_stiff.stop();
111 }
112 
114  ass_rhs.start();
115  if (fEquationFilter.IsActive()) {
116  int64_t neqcondense = fEquationFilter.NActiveEquations();
117  int64_t neqexpand = fEquationFilter.NEqExpand();
118  if (rhs.Rows() != neqexpand || Norm(rhs) != 0.) {
119  DebugStop();
120  }
121  TPZFMatrix<STATE> rhsloc(neqcondense, rhs.Cols(), 0.);
122  if (this->fNumThreads) {
123  this->MultiThread_Assemble(rhsloc, guiInterface);
124  } else {
125  this->Serial_Assemble(rhsloc, guiInterface);
126  }
127  fEquationFilter.Scatter(rhsloc, rhs);
128  } else {
129  if (this->fNumThreads) {
130  this->MultiThread_Assemble(rhs, guiInterface);
131  } else {
132  this->Serial_Assemble(rhs, guiInterface);
133  }
134  }
135  ass_rhs.stop();
136 }
137 
139  if (!fMesh) {
140  LOGPZ_ERROR(logger, "Serial_Assemble called without mesh")
141  DebugStop();
142  }
143 #ifdef LOG4CXX
144  if (loggerelmat->isDebugEnabled()) {
145  if (dynamic_cast<TPZSubCompMesh *> (fMesh)) {
146  std::stringstream sout;
147  sout << "AllEig = {};";
148  LOGPZ_DEBUG(loggerelmat, sout.str())
149  }
150  }
151 #endif
152 #ifdef PZDEBUG
153  if (rhs.Rows() != fEquationFilter.NActiveEquations()) {
154  DebugStop();
155  }
156 #endif
157 
159 #ifdef LOG4CXX
160  bool globalresult = true;
161  bool writereadresult = true;
162 #endif
163  TPZTimer calcstiff("Computing the stiffness matrices");
164  TPZTimer assemble("Assembling the stiffness matrices");
166 
167  int64_t nelem = fMesh->NElements();
168  int64_t count = 0;
169  for (int64_t iel = 0; iel < nelem; iel++) {
170  TPZCompEl *el = elementvec[iel];
171  if (!el) continue;
172  int matidsize = fMaterialIds.size();
173  if (matidsize) {
174  TPZMaterial * mat = el->Material();
175  TPZSubCompMesh *submesh = dynamic_cast<TPZSubCompMesh *> (el);
176  if (!mat) {
177  if (!submesh) {
178  continue;
179  } else if (!submesh->NeedsComputing(fMaterialIds)) continue;
180  } else {
181  int matid = mat->Id();
182  if (!this->ShouldCompute(matid)) continue;
183  }
184  }
185 
186  count++;
187  if (!(count % 1000)) {
188  std::cout << '*';
189  std::cout.flush();
190  }
191  if (!(count % 20000)) {
192  std::cout << std::endl;
193  }
194  calcstiff.start();
195 
196  ek.Reset(fMesh, TPZElementMatrix::EK);
198  el->CalcStiff(ek, ef);
199 
200  if (guiInterface && guiInterface->AmIKilled()) {
201  return;
202  }
203 
204 #ifdef LOG4CXX
205  if (loggerelmat->isDebugEnabled()) {
206  if (dynamic_cast<TPZSubCompMesh *> (fMesh)) {
207  std::stringstream objname;
208  objname << "Element" << iel;
209  std::string name = objname.str();
210  objname << " = ";
211  std::stringstream sout;
212  ek.fMat.Print(objname.str().c_str(), sout, EMathematicaInput);
213  sout << "AppendTo[AllEig,Eigenvalues[" << name << "]];";
214 
215  LOGPZ_DEBUG(loggerelmat, sout.str())
216  }
217  }
218 
219 #endif
220 
221 #ifdef CHECKCONSISTENCY
222  //extern TPZCheckConsistency stiffconsist("ElementStiff");
223  stiffconsist.SetOverWrite(true);
224  bool result;
225  result = stiffconsist.CheckObject(ek.fMat);
226  if (!result) {
227  globalresult = false;
228  std::stringstream sout;
229  sout << "element " << iel << " computed differently";
230  LOGPZ_ERROR(loggerCheck, sout.str())
231  }
232 
233 #endif
234 
235  calcstiff.stop();
236  assemble.start();
237 
238  if (!ek.HasDependency()) {
239  ek.ComputeDestinationIndices();
240  fEquationFilter.Filter(ek.fSourceIndex, ek.fDestinationIndex);
241  stiffness.AddKel(ek.fMat, ek.fSourceIndex, ek.fDestinationIndex);
242  rhs.AddFel(ef.fMat, ek.fSourceIndex, ek.fDestinationIndex);
243 
244 #ifdef LOG4CXX
245  if (loggerel->isDebugEnabled()) {
246  std::stringstream sout;
247  TPZGeoEl *gel = el->Reference();
248  if (gel) {
249  TPZManVector<REAL> center(gel->Dimension()), xcenter(3, 0.);
250  gel->CenterPoint(gel->NSides() - 1, center);
251  gel->X(center, xcenter);
252  sout << "Stiffness for computational element index " << el->Index() << std::endl;
253  sout << "Stiffness for geometric element " << gel->Index() << " center " << xcenter << std::endl;
254  } else {
255  sout << "Stiffness for computational element without associated geometric element" << std::endl;
256  }
257  ek.Print(sout);
258  ef.Print(sout);
259  LOGPZ_DEBUG(loggerel, sout.str())
260  }
261 #endif
262  } else {
263  // the element has dependent nodes
264  ek.ApplyConstraints();
265  ef.ApplyConstraints();
266  ek.ComputeDestinationIndices();
267  fEquationFilter.Filter(ek.fSourceIndex, ek.fDestinationIndex);
268  stiffness.AddKel(ek.fConstrMat, ek.fSourceIndex, ek.fDestinationIndex);
269  rhs.AddFel(ef.fConstrMat, ek.fSourceIndex, ek.fDestinationIndex);
270 #ifdef LOG4CXX
271  if (loggerel->isDebugEnabled() && !dynamic_cast<TPZSubCompMesh *> (fMesh)) {
272  std::stringstream sout;
273  TPZGeoEl *gel = el->Reference();
274  if (gel) {
275  TPZManVector<REAL> center(gel->Dimension()), xcenter(3, 0.);
276  gel->CenterPoint(gel->NSides() - 1, center);
277  gel->X(center, xcenter);
278  sout << "Stiffness for geometric element " << gel->Index() << " center " << xcenter << std::endl;
279  } else {
280  sout << "Stiffness for computational element index " << iel << std::endl;
281  }
282  ek.Print(sout);
283  ef.Print(sout);
284  LOGPZ_DEBUG(loggerel, sout.str())
285  }
286 #endif
287  }
288  assemble.stop();
289  }
290 
291 #ifdef LOG4CXX
292  if (loggerCheck->isDebugEnabled()) {
293  std::stringstream sout;
294  sout << "The comparison results are : consistency check " << globalresult << " write read check " << writereadresult;
295  stiffness.Print("Matriz de Rigidez: ", sout, EMathematicaInput);
296  rhs.Print("Right Hand side", sout, EMathematicaInput);
297  LOGPZ_DEBUG(loggerCheck, sout.str())
298  }
299 
300 #endif
301 
302 }
303 
305  TPZTimer calcresidual("Computing the residual vector");
306  TPZTimer assemble("Assembling the residual vector");
307 
309 
311 
312  for (auto iel : fElementOrder) {
313  TPZCompEl *el = elementvec[iel];
314  if (!el) continue;
315 
316  TPZMaterial * mat = el->Material();
317  if (!mat) continue;
318  int matid = mat->Id();
319  if (!this->ShouldCompute(matid)) continue;
320 
321 
322  calcresidual.start();
324  el->CalcResidual(ef);
325 
326  calcresidual.stop();
327 
328  assemble.start();
329 
330  if (!ef.HasDependency()) {
333  rhs.AddFel(ef.fMat, ef.fSourceIndex, ef.fDestinationIndex);
334  } else {
335  // the element has dependent nodes
336  ef.ApplyConstraints();
340  }
341 
342  assemble.stop();
343 
344  }
345 #ifdef LOG4CXX
346  {
347  if (logger->isDebugEnabled()) {
348  std::stringstream sout;
349  sout << calcresidual.processName() << " " << calcresidual << std::endl;
350  sout << assemble.processName() << " " << assemble;
351  LOGPZ_DEBUG(logger, sout.str().c_str());
352  }
353  }
354 #endif
355 }
356 
358  TPZMatrix<STATE> *stiff = Create();
359 
360  //int64_t neq = stiff->Rows();
361  int64_t cols = MAX(1, rhs.Cols());
362  rhs.Redim(fEquationFilter.NEqExpand(), cols);
363  Assemble(*stiff, rhs, guiInterface);
364 
365 #ifdef LOG4CXX2
366  if (loggerel->isDebugEnabled()) {
367  std::stringstream sout;
368  stiff->Print("Stiffness matrix", sout);
369  rhs.Print("Right hand side", sout);
370  LOGPZ_DEBUG(loggerel, sout.str())
371  }
372 #endif
373  return stiff;
374 
375 }
376 
378  if (guiInterface && guiInterface->AmIKilled()) {
379  return;
380  }
381 
382  auto cmesh = this->Mesh();
383 
384  std::function<void(TPZStack<int64_t>)> job = [this, cmesh, &mat, &rhs, &guiInterface] (TPZStack<int64_t> indices) {
385  for (auto index : indices){
386  int64_t iel = fElementOrder[index];
387  if (iel >= 0) {
388  TPZCompEl *el = cmesh->ElementVec()[iel];
389  if (!el) {
390  return;
391  }
394 
395  el->CalcStiff(ek, ef);
396  if (guiInterface && guiInterface->AmIKilled()) {
397  return;
398  }
399 
400  if (!el->HasDependency()) {
402  if (this->EquationFilter().IsActive()){
404  }
405  } else {
406  // the element has dependent nodes
407  ek.ApplyConstraints();
408  ef.ApplyConstraints();
410  if (this->EquationFilter().IsActive()){
412  }
413  }
414 
415  // Assemble matrix and rhs
416  if (!ek.HasDependency()) {
417  mat.AddKel(ek.fMat, ek.fSourceIndex, ek.fDestinationIndex);
418  rhs.AddFel(ef.fMat, ek.fSourceIndex, ek.fDestinationIndex);
419  } else {
422  }
423 
424  } else {
425  std::cout << "the element in ElColorSequence is negative???\n";
426  DebugStop();
427  }
428  }
429  };
430 
431  int64_t n_elements = fElementOrder.size();
432  for (int64_t color = 0; color < fNColors; ++color) {
433  TPZTaskGroup colorGroup;
435  int64_t elem_count = 0;
436  for (int64_t i = 0; i < n_elements; ++i) {
437  if (fElementColors[i] == color) {
438  indices[(elem_count++)%fNumThreads].push_back(i);
439  }
440  }
441  for (auto &ind_vec:indices) {
442  TPZThreadPool::globalInstance().run(1, &colorGroup, job, ind_vec);
443  }
444  colorGroup.Wait();
445  }
446 
447 #ifdef LOG4CXX
448  if (loggerCheck->isDebugEnabled()) {
449  std::stringstream sout;
450  mat.Print("Matriz de Rigidez: ", sout, EMathematicaInput);
451  rhs.Print("Right hand side", sout, EMathematicaInput);
452  LOGPZ_DEBUG(loggerCheck, sout.str())
453  }
454 #endif
455 }
456 
458  if (guiInterface && guiInterface->AmIKilled()) {
459  return;
460  }
461 
462  auto cmesh = this->Mesh();
463 
464  std::function<void(TPZStack<int64_t>) > job = [this, cmesh, &rhs, &guiInterface] (TPZStack<int64_t> indices) {
465  for (auto index: indices){
466  int64_t iel = fElementOrder[index];
467  if (iel >= 0) {
468  TPZCompEl *el = cmesh->ElementVec()[iel];
469  if (!el) {
470  return;
471  }
473 
474  el->CalcResidual(ef);
475  if (guiInterface && guiInterface->AmIKilled()) {
476  return;
477  }
478 
479  if (!el->HasDependency()) {
481  if (this->EquationFilter().IsActive()){
483  }
484  } else {
485  // the element has dependent nodes
486  ef.ApplyConstraints();
488  if (this->EquationFilter().IsActive()){
490  }
491  }
492 
493  // Assemble rhs
494  if (!ef.HasDependency()) {
495  rhs.AddFel(ef.fMat, ef.fSourceIndex, ef.fDestinationIndex);
496  } else {
498  }
499 
500  } else {
501  std::cout << "the element in ElColorSequence is negative???\n";
502  DebugStop();
503  }
504  }
505  };
506 
507  int64_t n_elements = fElementOrder.size();
508  for (int64_t color = 0; color < fNColors; ++color) {
509  TPZTaskGroup colorGroup;
511  int64_t elem_count = 0;
512  for (int64_t i = 0; i < n_elements; ++i) {
513  if (fElementColors[i] == color) {
514  indices[(elem_count++)%fNumThreads].push_back(i);
515  }
516  }
517  for (auto &ind_vec:indices) {
518  TPZThreadPool::globalInstance().run(1, &colorGroup, job, ind_vec);
519  }
520  colorGroup.Wait();
521  }
522 
523 #ifdef LOG4CXX
524  if (loggerCheck->isDebugEnabled()) {
525  std::stringstream sout;
526  rhs.Print("Right hand side", sout, EMathematicaInput);
527  LOGPZ_DEBUG(loggerCheck, sout.str())
528  }
529 #endif
530 }
531 
533  int64_t numelconnected = 0;
534  int64_t nconnect = cmesh->NConnects();
535  //firstelconnect contains the first element index in the elconnect vector
536  TPZVec<int64_t> firstelconnect(nconnect + 1);
537  firstelconnect[0] = 0;
538  for (int64_t ic = 0; ic < nconnect; ic++) {
539  numelconnected += cmesh->ConnectVec()[ic].NElConnected();
540  firstelconnect[ic + 1] = firstelconnect[ic] + cmesh->ConnectVec()[ic].NElConnected();
541  }
542  TPZVec<int64_t> elconnect(numelconnected, -1);
543  int64_t el;
544  TPZCompEl *cel;
545 
546 #ifdef NOORDER
547  int64_t count = 0;
548  std::cout << __PRETTY_FUNCTION__ << " no element order\n";
549  ElementOrder.Resize(cmesh->NElements(), -1);
550  for (el = 0; el < cmesh->ElementVec().NElements(); el++) {
551  cel = cmesh->ElementVec()[el];
552  if (!cel) continue;
553  ElementOrder[count] = el;
554  count++;
555  }
556  ElementOrder.Resize(count);
557  return;
558 #endif
559  for (el = 0; el < cmesh->ElementVec().NElements(); el++) {
560  cel = cmesh->ElementVec()[el];
561  if (!cel) continue;
562  TPZStack<int64_t> connectlist;
563  cel->BuildConnectList(connectlist);
564  int64_t nc = connectlist.NElements();
565  for (int64_t ic = 0; ic < nc; ic++) {
566  int64_t cindex = connectlist[ic];
567  elconnect[firstelconnect[cindex]] = el;
568  firstelconnect[cindex]++;
569  }
570  }
571  firstelconnect[0] = 0;
572  for (int64_t ic = 0; ic < nconnect; ic++) {
573  firstelconnect[ic + 1] = firstelconnect[ic] + cmesh->ConnectVec()[ic].NElConnected();
574  }
575 
576  ElementOrder.Resize(cmesh->ElementVec().NElements(), -1);
577  ElementOrder.Fill(-1);
578  TPZVec<int64_t> nodeorder(cmesh->ConnectVec().NElements(), -1);
579  firstelconnect[0] = 0;
580  for (int64_t ic = 0; ic < nconnect; ic++) {
581  int64_t seqnum = cmesh->ConnectVec()[ic].SequenceNumber();
582  if (seqnum >= 0) nodeorder[seqnum] = ic;
583  }
584  int64_t elsequence = 0;
585  TPZVec<int> elorderinv(cmesh->ElementVec().NElements(), -1);
586  for (int64_t seq = 0; seq < nconnect; seq++) {
587  int64_t ic = nodeorder[seq];
588  if (ic == -1) continue;
589  int64_t firstind = firstelconnect[ic];
590  int64_t lastind = firstelconnect[ic + 1];
591  for (int64_t ind = firstind; ind < lastind; ind++) {
592  el = elconnect[ind];
593  if (el == -1) {
594  continue;
595  }
596  if (elorderinv[el] == -1) elorderinv[el] = elsequence++;
597  }
598  }
599  elsequence = 0;
600  for (int64_t seq = 0; seq < cmesh->ElementVec().NElements(); seq++) {
601  if (elorderinv[seq] == -1) continue;
602  ElementOrder[elorderinv[seq]] = seq;
603  }
604  int64_t seq;
605  for (seq = 0; seq < cmesh->ElementVec().NElements(); seq++) {
606  if (ElementOrder[seq] == -1) break;
607  }
608 
609  ElementOrder.Resize(seq);
610 }
611 
613  return Hash("TPZStructMatrixGCTP") ^ TPZStructMatrixBase::ClassId() << 1;
614 }
615 
616 void TPZStructMatrixGCTP::Read(TPZStream& buf, void* context) {
617  TPZStructMatrixBase::Read(buf, context);
618 
619  buf.Read(fElementOrder);
620  buf.Read(fElementColors);
621  buf.Read(&fNColors);
622 }
623 
624 void TPZStructMatrixGCTP::Write(TPZStream& buf, int withclassid) const {
625  TPZStructMatrixBase::Write(buf, withclassid);
626 
627  buf.Write(fElementOrder);
628  buf.Write(fElementColors);
629  buf.Write(&fNColors);
630 }
631 
int64_t NElements() const
Number of computational elements allocated.
Definition: pzcmesh.h:169
static RunStatsTable ass_stiff("-ass_stiff", "Assemble Stiffness")
Contains a class to record running statistics on CSV tables.
int fNumThreads
Number of threads in Assemble process.
The timer class. Utility.
Definition: TPZTimer.h:46
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.
void Read(TPZStream &buf, void *context) override
read objects from the stream
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 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
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.
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.
Contains the TPZRenumbering class which defines the behavior to implementing node sequence numbering ...
virtual TPZEquationFilter & EquationFilter()
access method for the equation filter
virtual void CalcStiff(TPZElementMatrix &ek, TPZElementMatrix &ef)
Computes the element stifness matrix and right hand side.
Definition: pzcompel.h:794
TPZEquationFilter fEquationFilter
Object which will determine which equations will be assembled.
static TPZThreadPool & globalInstance()
Declarates the TPZBlock<REAL>class which implements block matrices.
int64_t NElements() const
Access method to query the number of elements of the vector.
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
virtual int NSides() const =0
Returns the number of connectivities of the element.
static void OrderElement(TPZCompMesh *cmesh, TPZVec< int64_t > &ElementOrder)
Find the order to assemble the elements.
int ClassId() const override
Define the class id associated with the class.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
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.
bool ShouldCompute(int matid) const override
Establish whether the element should be computed.
std::shared_future< void > run(const int priority, TPZAutoPointer< std::packaged_task< void(void) > > &task, TPZTaskGroup *taskGroup=NULL)
submits a task to be executed by TPZThreadPool
TPZManVector< int64_t > fDestinationIndex
Definition: pzelmat.h:53
void ComputeDestinationIndices()
Definition: pzelmat.cpp:126
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.
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
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
int ClassId() const override
Define the class id associated with the class.
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.
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
Defines the behaviour of all geometric elements. GeometryTPZGeoEl is the common denominator for all g...
Definition: pzgeoel.h:43
virtual TPZMatrix< STATE > * Create() override
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
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
It is responsible for a interface between Matrix and Finite Element classes. Structural Matrix This c...
Free store vector implementation.
virtual TPZMatrix< STATE > * CreateAssemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface, unsigned numthreads_assemble, unsigned numthreads_decompose)
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
virtual void AddKel(TPZFMatrix< TVar > &elmat, TPZVec< int64_t > &destinationindex)
Add a contribution of a stiffness matrix.
Definition: pzmatrix.cpp:506
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.
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
Implements an interface to check the consistency of two implementations. Utility. ...
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
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
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
virtual void MultiThread_Assemble(TPZFMatrix< STATE > &rhs, TPZAutoPointer< TPZGuiInterface > guiInterface)
Assemble the global right hand side.
static int64_t ColorElements(const TPZCompMesh *cmesh, const TPZVec< int64_t > &elementIndices, TPZVec< int64_t > &elementColors)
Assigns a color to the elements in the elementIndices list such that two elements that share a connec...
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 ...
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...
void Reset(TPZCompMesh *mesh=NULL, MType type=Unknown)
Reset the data structure.
Definition: pzelmat.h:59
Implements computational mesh. Computational Mesh.
Definition: pzcmesh.h:47
TPZAdmChunkVector< TPZCompEl * > & ElementVec()
Returns a reference to the element pointers vector.
Definition: pzcmesh.h:183
RunStatsTable stat_ass_graph_gctp("-ass_graph_gctp", "Run statistics table for the graph creation and coloring TPZStructMatrixGCTP.")
Contains declaration of TPZInterpolatedElement class which implements computational element of the in...
int Id() const
Definition: TPZMaterial.h:170
virtual TPZStructMatrixGCTP * Clone() override
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
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
TPZVec< int64_t > fElementColors
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
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
TPZManVector< int64_t > fElementOrder
Contains TPZSFMatrix class which implements a symmetric full matrix.
virtual void Read(bool &val)
Definition: TPZStream.cpp:91