NeoPZ
tpzdohrprecond.cpp
Go to the documentation of this file.
1 
8 #include "tpzdohrprecond.h"
10 #include "pzskylmat.h"
11 
12 #include "pzvisualmatrix.h"
13 #include "tpzdohrassemblelist.h"
14 
15 #include <sstream>
16 #include "pzlog.h"
17 
18 #include "TPZfTime.h"
19 #include "TPZTimeTemp.h"
20 
21 #include "pz_pthread.h"
22 
23 #include "arglib.h"
24 
25 #include "tpzparallelenviroment.h"
26 #include "TPZPersistenceManager.h"
27 
28 
29 #ifdef LOG4CXX
30 static LoggerPtr logger(Logger::getLogger("substruct.dohrprecond"));
31 static LoggerPtr loggerv1v2(Logger::getLogger("substruct.v1v2"));
32 #endif
33 
34 using namespace std;
35 
36 template<class TVar, class TSubStruct>
38 : TPZMatrix<TVar>(origin), fGlobal(origin.SubStructures()), fCoarse(0), fNumCoarse(origin.NumCoarse()), fNumThreads(0), fAssemble(assemble)
39 {
40  fNumThreads = origin.NumThreads();
41 }
42 
43 template<class TVar, class TSubStruct>
46 {
47  if (cp.fCoarse) {
48  fCoarse = (TPZStepSolver<TVar> *) cp.fCoarse->Clone();
49  }
50 }
51 
53 template<class TVar, class TSubStruct>
55 {
56 }
57 
58 template<class TVar, class TSubStruct>
60 {
61  if (fCoarse)
62  {
63  delete fCoarse;
64  fCoarse = 0;
65  }
66 }
67 
70 #ifdef USING_TBB
71 #include <tbb/blocked_range.h>
72 #include <tbb/partitioner.h>
73 #include <tbb/parallel_for.h>
74 #endif
75 
76 template<class TVar, class TSubStruct>
78 {
79 private:
81  std::vector<TPZDohrPrecondV2SubData<TVar,TSubStruct> > mWorkItems;
82 
85 
86 public:
87 
89  ParallelAssembleTask(TPZAutoPointer<TPZDohrAssembleList<TVar> > assemblyStruct) : fAssemblyStructure(assemblyStruct) {}
90 
93  mWorkItems.push_back(data);
94  }
95 
96 #ifdef USING_TBB
97 
98  void operator()(const tbb::blocked_range<size_t>& range) const
99  {
100 
101  for(size_t i=range.begin(); i!=range.end(); ++i )
102  {
103 
104  TPZDohrPrecondV2SubData<TVar,TSubStruct> data = mWorkItems[i];
106  data.fSubStructure->ReallocMatRed();
107  data.fSubStructure->Contribute_v2_local(data.fInput_local, data.fv2_local->fAssembleData);
108  fAssemblyStructure->AddItem(data.fv2_local);
109  }
110  }
111 
113  void run_parallel_for(tbb::affinity_partitioner &ap)
114  {
115  /* TBB Parallel for. It will split the range
116  * into N sub-ranges and
117  * invoke the operator() for each sub-range.
118  */
119  parallel_for(tbb::blocked_range<size_t>(0, mWorkItems.size()), *this, ap);
120  }
121 
122 #endif
123 
124 
125 }; /* ParallelAssembleTask */
126 
127 
128 template<class TVar, class TSubStruct>
129 void TPZDohrPrecond<TVar, TSubStruct>::MultAddTBB(const TPZFMatrix<TVar> &x,const TPZFMatrix<TVar> &y, TPZFMatrix<TVar> &z, const TVar alpha,const TVar beta,const int opt) const {
130 
131 #ifdef USING_TBB
132  if ((!opt && this->Cols() != x.Rows()) || this->Rows() != x.Rows())
133  this->Error( "Operator* <matrices with incompatible dimensions>" );
134  if(x.Cols() != y.Cols() || x.Cols() != z.Cols() || x.Rows() != y.Rows() || x.Rows() != z.Rows()) {
135  this->Error ("TPZFMatrix::MultiplyAdd incompatible dimensions\n");
136  }
137 
138  int64_t rows = this->Rows();
139  int64_t cols = this->Cols();
140  this->PrepareZ(y,z,beta,opt);
141 
142  TPZFMatrix<TVar> v1(rows,x.Cols(),0.);
143  TPZFMatrix<TVar> v2(cols,x.Cols(),0.);
144 
145  TPZVec<pthread_t> AllThreads(2);
146  TPZDohrPrecondThreadV1Data<TVar,TSubStruct> v1threaddata(this,x,v1);
147 
148  PZ_PTHREAD_CREATE(&AllThreads[0], 0,
150  &v1threaddata, __FUNCTION__);
151 
153 
154  ParallelAssembleTask<TVar, TSubStruct> tbb_work(assemblelist);
155 
156  typename std::list<TPZAutoPointer<TSubStruct> >::const_iterator it;
157 
158  int isub=0;
160  for(it= fGlobal.begin(); it != fGlobal.end(); it++,isub++)
161  {
162  TPZFMatrix<TVar> *Residual_local = new TPZFMatrix<TVar>;
163  fAssemble->Extract(isub,x,*Residual_local);
164  TPZDohrPrecondV2SubData<TVar,TSubStruct> data(isub,*it,Residual_local);
165  tbb_work.addWorkItem(data);
166  }
167 
168 
169  tbb_work.run_parallel_for(pzenviroment.fSubstructurePartitioner);
170 
172  assemblelist.operator->(), __FUNCTION__);
173 
174  for (int i=0; i<2; i++) {
175  void *result;
176  PZ_PTHREAD_JOIN(AllThreads[i], &result, __FUNCTION__);
177  }
178 
179  v2 += v1;
180 
182  int64_t xcols = x.Cols();
183  for (int64_t ic=0; ic<xcols; ic++)
184  {
185  for (int64_t c=0; c<rows; c++) {
186  z(c,ic) += v2(c,ic);
187  }
188  }
189 
190 #endif
191 }
192 
193 template<class TVar, class TSubStruct>
194 void TPZDohrPrecond<TVar, TSubStruct>::MultAdd(const TPZFMatrix<TVar> &x,const TPZFMatrix<TVar> &y, TPZFMatrix<TVar> &z, const TVar alpha,const TVar beta,const int opt) const {
195 
196 #ifdef USING_TBB
197  MultAddTBB(x, y, z, alpha, beta, opt);
198  return;
199 #endif
200 
201  if ((!opt && this->Cols() != x.Rows()) || this->Rows() != x.Rows())
202  this->Error( "Operator* <matrices with incompatible dimensions>" );
203  if(x.Cols() != y.Cols() || x.Cols() != z.Cols() || x.Rows() != y.Rows() || x.Rows() != z.Rows()) {
204  this->Error ("TPZFMatrix::MultiplyAdd incompatible dimensions\n");
205  }
206  TPZfTime precondi; // init of timer
207  int64_t rows = this->Rows();
208  int64_t cols = this->Cols();
209  int64_t c;
210  this->PrepareZ(y,z,beta,opt);
211 #ifdef LOG4CXX
212  {
213  std::stringstream sout;
214  x.Print("x entry vector",sout);
215  if (logger->isDebugEnabled())
216  {
217  LOGPZ_DEBUG(logger, sout.str());
218  }
219  if (loggerv1v2->isDebugEnabled())
220  {
221  LOGPZ_DEBUG(loggerv1v2, sout.str())
222  }
223  }
224 #endif
225  TPZFMatrix<TVar> v1(rows,x.Cols(),0.);
226  TPZFMatrix<TVar> v2(cols,x.Cols(),0.);
227  if(fNumThreads <= 0)
228  {
229  ComputeV1(x,v1);
230  ComputeV2(x,v2);
231  }
232  else
233  {
234  TPZVec<pthread_t> AllThreads(fNumThreads+2);
235  TPZDohrPrecondThreadV1Data<TVar,TSubStruct> v1threaddata(this,x,v1);
236 
237  PZ_PTHREAD_CREATE(&AllThreads[0], 0,
239  &v1threaddata, __FUNCTION__);
240 
242 
244  typename std::list<TPZAutoPointer<TSubStruct> >::const_iterator it;
245 
246  int isub=0;
247  //Criar tarefa que execute a distribuicao de cada elemento do fGlobal
248  for(it= fGlobal.begin(); it != fGlobal.end(); it++,isub++)
249  {
250  TPZFMatrix<TVar> *Residual_local = new TPZFMatrix<TVar>;
251  fAssemble->Extract(isub,x,*Residual_local);
252  TPZDohrPrecondV2SubData<TVar,TSubStruct> data(isub,*it,Residual_local);
253  v2work.AddItem(data);
254  }
255 
256  int i;
257  for (i=0; i<fNumThreads; i++) {
258  PZ_PTHREAD_CREATE(&AllThreads[i+2], 0,
260  &v2work, __FUNCTION__);
261  }
262  // v2work.ThreadWork(&v2work);
263 
265  assemblelist.operator->(), __FUNCTION__);
266  // assemblelist->Assemble(assemblelist.operator->());
267 
268  for (i=0; i<fNumThreads+2; i++) {
269  void *result;
270  PZ_PTHREAD_JOIN(AllThreads[i], &result, __FUNCTION__);
271  }
272  // ComputeV2(x,v2);
273  }
274  v2 += v1;
275 
276 #ifndef MAKEINTERNAL
277  isub=0;
278  //Criar tarefa que execute a distribuicao de cada elemento do fGlobal
279  for(it= fGlobal.begin(); it != fGlobal.end(); it++,isub++)
280  {
281  TPZFNMatrix<100> v2Expand((*it)->fNEquations,1,0.), v3Expand((*it)->fNEquations,1,0.);
282  int64_t neqs = (*it)->fGlobalEqs.NElements();
283  TPZFMatrix<TVar> v3_local(neqs,1,0.), v2_local(neqs,1,0.);
284  fAssemble->Extract(isub,v2,v2_local);
285  int64_t i;
286  for (i=0;i<neqs;i++)
287  {
288  std::pair<int,int> ind = (*it)->fGlobalEqs[i];
289  v2Expand(ind.first,0) += v2_local(i,0);
290  }
291 
292  (*it)->Contribute_v3_local(v2Expand,v3Expand);
293  for (i=0;i<neqs;i++)
294  {
295  std::pair<int,int> ind = (*it)->fGlobalEqs[i];
296  v3_local(i,0) += v3Expand(ind.first,0);
297  }
298 #ifdef LOG4CXX
299  {
300  std::stringstream sout;
301  v2Expand.Print("v1+v2 Expand",sout);
302  v3Expand.Print("v3 Expand", sout);
303  v2_local.Print("v1+v2 local",sout);
304  v3_local.Print("v3 local",sout);
305  if (logger->isDebugEnabled())
306  {
307  LOGPZ_DEBUG(logger, sout.str());
308  }
309  }
310 #endif
311  fAssemble->Assemble(isub,v3_local,v2);
312  }
313 #endif
314  // wait task para finalizacao da chamada
315  // esperar a versao correta do v1
316  /* Sum v1+v2+v3 with z */
317  int64_t xcols = x.Cols();
318  for (int64_t ic=0; ic<xcols; ic++)
319  {
320  for (c=0; c<rows; c++) {
321  z(c,ic) += v2(c,ic);
322  }
323  }
324  tempo.fPreCond.Push(precondi.ReturnTimeDouble()); // end of timer
325 }
326 
327 
328 template<class TVar, class TSubStruct>
330 {
331  //Compute the skyline of the coarse equations
333  int64_t ic;
334  for (ic=0; ic<fNumCoarse; ic++) {
335  skyline[ic] = ic;
336  }
337  int64_t nsub = fAssemble->fCoarseEqs.NElements();
338  int64_t isub;
339  for (isub=0; isub<nsub; isub++) {
340  int64_t nc = fAssemble->fCoarseEqs[isub].NElements();
341  int64_t ic;
342  int64_t mineq = 0;
343  if(nc != 0) mineq = fAssemble->fCoarseEqs[isub][0];
344  for (ic=0; ic<nc; ic++) {
345  int64_t eq = fAssemble->fCoarseEqs[isub][ic];
346  mineq = mineq > eq ? eq : mineq;
347  }
348  for (ic=0; ic<nc; ic++) {
349  int64_t eq = fAssemble->fCoarseEqs[isub][ic];
350  if(skyline[eq] > mineq) skyline[eq] = mineq;
351  }
352  }
353  /* Computing K(c) */
354  TPZMatrix<TVar> *coarse = new TPZSkylMatrix<TVar>(fNumCoarse,skyline);
355 #ifdef PZDEBUG
356  {
357  TPZFMatrix<TVar> coarse2(*coarse);
358  for (isub=0; isub<nsub; isub++) {
359  int64_t nc = fAssemble->fCoarseEqs[isub].NElements();
360  int64_t ic;
361  for (ic=0; ic<nc; ic++) {
362  int64_t ieq = fAssemble->fCoarseEqs[isub][ic];
363  int64_t jc;
364  for (jc=0; jc<nc; jc++) {
365  int64_t jeq = fAssemble->fCoarseEqs[isub][jc];
366  coarse2(ieq,jeq) = 1.;
367  }
368  }
369 
370  }
371  VisualMatrix(coarse2,"CoarseMatrix.vtk");
372  }
373 #endif
374  typename std::list<TPZAutoPointer<TSubStruct> >::iterator it;
375  int count = 0;
376  for(it= fGlobal.begin(); it != fGlobal.end(); it++,count++)
377  {
378  (*it)->Contribute_Kc(*coarse,fAssemble->fCoarseEqs[count]);
379  }
380  fCoarse = new TPZStepSolver<TVar>(coarse);
381 }
382 
383 template<class TVar, class TSubStruct>
385 {
386  /* Computing r(c) */
387  TPZFMatrix<TVar> CoarseResidual(fNumCoarse,x.Cols());
388  CoarseResidual.Zero();
389  typename std::list<TPZAutoPointer<TSubStruct> >::const_iterator it;
390 
391  int isub = 0;
392  for(it= fGlobal.begin(); it != fGlobal.end(); it++, isub++) {
393  TPZFMatrix<TVar> xloc, CoarseResidual_local;
394  fAssemble->Extract(isub,x,xloc);
395  // (*it)->LoadWeightedResidual(xloc);
396  (*it)->Contribute_rc_local(xloc,CoarseResidual_local);
397  fAssemble->AssembleCoarse(isub,CoarseResidual_local,CoarseResidual);
398  }
399 #ifdef LOG4CXX
400  {
401  std::stringstream sout;
402  CoarseResidual.Print("Coarse Residual",sout);
403  if (logger->isDebugEnabled())
404  {
405  LOGPZ_DEBUG(logger, sout.str());
406  }
407  }
408 #endif
409  /* Computing K(c)_inverted*r(c) and stores it in "product" */
410  fCoarse->SetDirect(ELDLt);
411  //Dado global
412  TPZFMatrix<TVar> CoarseSolution(fNumCoarse,x.Cols());
413  fCoarse->Solve(CoarseResidual,CoarseSolution);
414 #ifdef LOG4CXX
415  {
416  std::stringstream sout;
417  CoarseSolution.Print("CoarseSolution",sout);
418  if (logger->isDebugEnabled())
419  {
420  LOGPZ_DEBUG(logger, sout.str());
421  }
422  }
423 #endif
424  isub=0;
425  //Criar tarefa que execute a distribuicao de cada elemento do fGlobal
426  for(it= fGlobal.begin(); it != fGlobal.end(); it++,isub++)
427  {
428  // Gerenciamento Global->Local sobre o product
429  //product é administrado pelo DM mas permanece no processador 0
430  // tarefa separada, expansao da solucao coarse
431  TPZFMatrix<TVar> v1_local,CoarseSolution_local;
432  fAssemble->ExtractCoarse(isub,CoarseSolution,CoarseSolution_local);
433  (*it)->Contribute_v1_local(v1_local,CoarseSolution_local);
434 
435  fAssemble->Assemble(isub,v1_local,v1);
436  }
437 #ifdef LOG4CXX
438  {
439  std::stringstream sout;
440  v1.Print("v1 vector",sout);
441  if (loggerv1v2->isDebugEnabled())
442  {
443  LOGPZ_DEBUG(loggerv1v2, sout.str())
444  }
445  }
446 #endif
447 }
448 
449 template<class TVar, class TSubStruct>
451 {
452 
453  typename std::list<TPZAutoPointer<TSubStruct> >::const_iterator it;
454 
455  int isub=0;
456  //Criar tarefa que execute a distribuicao de cada elemento do fGlobal
457  for(it= fGlobal.begin(); it != fGlobal.end(); it++,isub++)
458  {
459  // contribute v2 deve ser uma tarefa inicializada mais cedo
460  TPZFNMatrix<100,TVar> Residual_local,v2_local;
461  fAssemble->Extract(isub,x,Residual_local);
462  (*it)->Contribute_v2_local(Residual_local,v2_local);
463 #ifdef LOG4CXX
464  {
465  std::stringstream sout;
466  sout << "Substructure " << isub << std::endl;
467  Residual_local.Print("Residual local",sout);
468  v2_local.Print("v2_local",sout);
469  if (logger->isDebugEnabled())
470  {
471  LOGPZ_DEBUG(logger, sout.str());
472  }
473  }
474 #endif
475  // v2_local += v1_local;
476  fAssemble->Assemble(isub,v2_local,v2);
477  }
478 #ifdef LOG4CXX
479  {
480  std::stringstream sout;
481  v2.Print("v2 vector",sout);
482  if (loggerv1v2->isDebugEnabled())
483  {
484  LOGPZ_DEBUG(loggerv1v2, sout.str())
485  }
486  }
487 #endif
488 }
489 
490 template<class TVar, class TSubStruct>
492 {
495  while (data.IsValid()) {
496  data.fSubStructure->Contribute_v2_local(data.fInput_local,data.fv2_local->fAssembleData);
497  myptr->fAssemblyStructure->AddItem(data.fv2_local);
498  data = myptr->PopItem();
499  }
500  return voidptr;
501 }
502 
508 template<class TVar, class TSubStruct>
510 {
511  TPZMatrix<TVar>::Read(buf,context);
513  fAssemble = ptr->fAssembly;
514  fGlobal = ptr->SubStructures();
515  buf.Read(&fNumCoarse);
516  buf.Read(&fNumThreads);
518 }
524 template<class TVar, class TSubStruct>
525 void TPZDohrPrecond<TVar, TSubStruct>::Write( TPZStream &buf, int withclassid ) const
526 {
527  TPZMatrix<TVar>::Write(buf, withclassid);
528  buf.Write(&fNumCoarse);
529  buf.Write(&fNumThreads);
531 }
532 
533 
537 
541 
542 //template class TPZDohrPrecond<std::complex<float>,TPZDohrSubstruct<std::complex<float> > >;
544 //template class TPZDohrPrecond<std::complex<long double>,TPZDohrSubstruct<std::complex<long double> > >;
545 
546 //template class TPZDohrPrecond<std::complex<float>, TPZDohrSubstructCondense<std::complex<float> > >;
548 //template class TPZDohrPrecond<std::complex<long double>, TPZDohrSubstructCondense<std::complex<long double> > >;
549 
550 
551 #ifndef BORLAND
552 
556 
557 template class TPZRestoreClass<TPZDohrPrecond<std::complex<double>, TPZDohrSubstruct<std::complex<double>> >>;
558 
562 
563 template class TPZRestoreClass<TPZDohrPrecond<std::complex<double>, TPZDohrSubstructCondense<std::complex<double>> >>;
564 
565 #endif
TPZAutoPointer< TPZFMatrix< TVar > > fInput_local
Input matrix.
Assembling using Dohrmann algorithm. Sub structure.
Contains the TPZTimeTemp class which takes times.
Definition: pzmatrix.h:52
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 Write(TPZStream &buf, int withclassid) const override
Packs the object structure in a stream of bytes.
Definition: pzmatrix.cpp:1420
void VisualMatrix(TPZFMatrix< TVar > &matrix, const std::string &outfilename)
This function calls the function that create a Data Explorer file or VTK file that allow to visualiz...
Auxiliar structure for v2 vector to compute the preconditioner developed by Dohrmann. Sub Structure.
void ComputeV2(const TPZFMatrix< TVar > &x, TPZFMatrix< TVar > &v2) const
Compute the contribution of the sub domains.
TPZTimeTemp tempo
External variable to TPZTimeTemp (to take time)
Definition: TPZTimeTemp.cpp:11
static int Error(const char *msg, const char *msg2=0)
Returns error messages.
Definition: pzmatrix.cpp:1402
clarg::argInt nsub("-nsub", "number of substructs", 4)
Auxiliar structure with list for v2 vector data. Sub Structure.
Defines step solvers class. Solver.
Definition: pzmganalysis.h:17
TPZAutoPointer< TSubStruct > fSubStructure
Pointer to the dohr matrix.
Calculate the Times. Utility.
Definition: TPZfTime.h:21
TPZStack< REAL > fPreCond
Time to PreCond for each iteration.
Definition: TPZTimeTemp.h:61
void PrepareZ(const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar beta, const int opt) const
Is an auxiliar method used by MultiplyAdd.
Definition: pzmatrix.cpp:135
int64_t fNumCoarse
Size of the coarse system.
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
Implements sub structure matrices using Dohrman algorithm. Sub Structure.
Implements a matrix divided into substructures. Matrix Sub structure.
Definition: tpzdohrmatrix.h:30
static TPZSavable * GetInstance(const int64_t &objId)
std::list< TPZAutoPointer< TSubStruct > > fGlobal
The matrix class is a placeholder for a list of substructures.
Contains the declaration of the VisualMatrix functions to VTK and DX packages.
Contains the TPZDohrAssembleItem and TPZDohrAssembleList structs to assembling using Dohrman algorith...
int fNumThreads
Number of threads used during preconditioning.
Implements a skyline storage format. A Skyline matrix is symmetric so square. Matrix.
Definition: pzskylmat.h:394
TPZAutoPointer< TPZDohrAssembleItem< TVar > > fv2_local
The local contribution to the v2 vector.
#define PZ_PTHREAD_JOIN(thread, val, fn)
Definition: pz_pthread.h:34
Implements a matrix which computes the preconditioner developed by Dohrmann. Sub Structure.
int Zero() override
Makes Zero all the elements.
Definition: pzfmatrix.h:651
TPZDohrPrecondV2SubData< TVar, TSubStruct > PopItem()
Interface to pop an item in a thread safe way.
void Push(const T object)
Pushes a copy of the object on the stack.
Definition: pzstack.h:80
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
void AddItem(TPZAutoPointer< TPZDohrAssembleItem< TVar > > assembleItem)
Add an item to the list in a thread safe way.
To condense matrix divided in sub structures. Sub Structure.
Contains the TPZParallelEnviroment class which store the parallel enviroment variables.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
TPZAutoPointer< TPZDohrAssembleList< TVar > > fAssemblyStructure
The local contribution to the v2 vector.
TPZAutoPointer< TPZDohrAssembleList< TVar > > fAssemblyStructure
The local contribution to the v2 vector.
void parallel_for(int n, body_t &obj)
Definition: pzparallel.h:24
Contains the TPZDohrPrecond class which implements a matrix which computes the preconditioner develop...
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
List of items to assembling using Dohrmann algorithm.
Contains the TPZDohrSubstructCondense class which condenses matrix divided in sub structures...
double ReturnTimeDouble()
When called, returns the time since the creation of the object in a double.
Definition: TPZfTime.cpp:35
Contains TPZSkyline class which implements a skyline storage format.
void Read(TPZStream &buf, void *context) override
Unpacks the object structure from a stream of bytes.
Definition: pzmatrix.cpp:1413
Contains the TPZfTime class which calculates times.
Full matrix class. Matrix.
Definition: pzfmatrix.h:32
virtual void MultAddTBB(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha, const TVar beta, const int opt) const
virtual void MultAdd(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha, const TVar beta, const int opt) const override
The only method any matrix class needs to implement.
Auxiliar structure with thread to compute the preconditioner developed by Dohrmann. Sub Structure.
int NumThreads() const
Definition: tpzdohrmatrix.h:74
TPZParallelEnviroment pzenviroment
const SubsList & SubStructures() const
Definition: tpzdohrmatrix.h:64
TPZDohrPrecond()
Empty constructor for restoring.
#define PZ_PTHREAD_CREATE(thread, attr, routine, args, fn)
Definition: pz_pthread.h:31
void addWorkItem(TPZDohrPrecondV2SubData< TVar, TSubStruct > data)
Add a new work item to the array.
void Read(TPZStream &buf, void *context) override
Unpacks the object structure from a stream of bytes.
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
void Write(TPZStream &buf, int withclassid) const override
Packs the object structure in a stream of bytes.
virtual void Print(std::ostream &out) const
Definition: pzmatrix.h:253
void ComputeV1(const TPZFMatrix< TVar > &x, TPZFMatrix< TVar > &v1) const
Compute the contribution of the coarse matrix.
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
ParallelAssembleTask(TPZAutoPointer< TPZDohrAssembleList< TVar > > assemblyStruct)
Constructor.
TPZStepSolver< TVar > * fCoarse
The global matrix associated with the coarse degrees of freedom.
void Initialize()
Initialize the necessary datastructures.
void ReallocForNuma(int node)
TVar & operator()(const int64_t row, const int64_t col)
The operators check on the bounds if the DEBUG variable is defined.
Definition: pzmatrix.h:867
TPZAutoPointer< TPZDohrAssembly< TVar > > fAssemble
static void WritePointer(const TPZSavable *obj, TPZStream *stream)
TPZAutoPointer< TPZDohrAssembly< TVar > > fAssembly
Definition: tpzdohrmatrix.h:45
std::vector< TPZDohrPrecondV2SubData< TVar, TSubStruct > > mWorkItems
Array of work items.
Implements an interface to register a class id and a restore function. Persistence.
Definition: TPZSavable.h:150
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716
virtual void Read(bool &val)
Definition: TPZStream.cpp:91
Root matrix class (abstract). Matrix.
Definition: pzmatrix.h:60
This class implements a reference counter mechanism to administer a dynamically allocated object...