NeoPZ
tpzdohrsubstructCondense.cpp
Go to the documentation of this file.
1 
7 #include "tpzverysparsematrix.h"
8 #include <iostream>
9 #include "pzlog.h"
10 #include "TPZfTime.h"
11 
12 #ifdef LOG4CXX
13 static LoggerPtr logger(Logger::getLogger("substruct.dohrsubstructcondense"));
14 #endif
15 
16 using namespace std;
17 
18 template<class TVar>
20 
21 
22 template<class TVar>
23 TPZDohrSubstructCondense<TVar>::TPZDohrSubstructCondense() : fNEquations(-1), fNumInternalEquations(-1), fNumExternalEquations(-1), wasRealloc(false)
24 {
25  //Inicializacao
26 }
27 
28 template<class TVar>
30 {
31  //Limpesa
32 }
33 
38 template<class TVar>
40 {
41  fPhiC_Weighted_Condensed.Multiply(residual_local, rc_local, 1);
42 }
43 
44 template<class TVar>
46  int i;
47  int j;
48  for (i=0;i<fCoarseNodes.NElements();i++) {
49  for (j=0;j<fCoarseNodes.NElements();j++) {
50  if ((Kc.IsSimetric() && coarseindex[j] >= coarseindex[i]) || !Kc.IsSimetric()) {
51  Kc(coarseindex[i],coarseindex[j]) += fKCi(i,j);
52  }
53  }
54  }
55 }
56 
57 template<class TVar>
59  int neqs = fNumExternalEquations;
60  v1_local.Resize(neqs, 1);
61  fPhiC_Weighted_Condensed.Multiply(invKc_rc_local,v1_local);
62 }
63 
67 template<class TVar>
69 {
70  const TPZVec<int> &scatter = ScatterVec(ExternalFirst, Submesh);
71  int ncoarse = fCoarseNodes.NElements();
72  int ncols = residual_local.Cols();
73  TPZFMatrix<TVar> LocalWeightedResidual(fNEquations+ncoarse,ncols,0.);
74  int ninput = residual_local.Rows();
75  int i;
76  for (int ic=0; ic<ncols; ic++)
77  {
78  for (i=0;i<ninput;i++)
79  {
80  LocalWeightedResidual(scatter[i],ic) += fWeights[scatter[i]] * residual_local(i,ic);
81  }
82  }
83 #ifdef LOG4CXX
84  if(logger->isDebugEnabled())
85  {
86  std::stringstream sout;
87  LocalWeightedResidual.Print("LocalWeightedResidual ",sout);
88  LOGPZ_DEBUG(logger, sout.str());
89  }
90 #endif
91  fMatRedComplete->SetF(LocalWeightedResidual);
92  TPZFMatrix<TVar> U1(ncoarse,ncols,0.), UGlobal(fNEquations+ncoarse,ncols,0.);
93  fMatRedComplete->U1(U1);
94 #ifdef LOG4CXX
95  if(logger->isDebugEnabled())
96  {
97  std::stringstream sout;
98  U1.Print("U1 ",sout);
99  LOGPZ_DEBUG(logger,sout.str())
100  }
101 #endif
102  fMatRedComplete->UGlobal(U1,UGlobal);
103 #ifdef LOG4CXX
104  if(logger->isDebugEnabled())
105  {
106  std::stringstream sout;
107  UGlobal.Print("UGlobal ",sout);
108  LOGPZ_DEBUG(logger,sout.str())
109  }
110 #endif
112  v2_local.Resize(ninput, ncols);
113  for (int ic=0; ic<ncols; ic++)
114  {
115  for (i=0;i<ninput;i++)
116  {
117  v2_local(i,ic) = fWeights[gather2[i]] * UGlobal(gather2[i],ic);
118  }
119  }
120 }
121 
122 template<class TVar>
124  std::cout << __PRETTY_FUNCTION__ << " should never be called\n";
125 }
126 
127 template<class TVar>
128 void TPZDohrSubstructCondense<TVar>::Print(std::ostream &out) const
129 {
130  out << __PRETTY_FUNCTION__ << std::endl;
131  out << "fNEquations " << fNEquations << std::endl;
132  out << "fNumInternalEquations " << fNumInternalEquations << std::endl;
133  out << "fNumExternalEquations " << fNumExternalEquations << std::endl;
134  const TPZVec<int> &internaleq = GatherVec(Submesh, InternalFirst);
135  out << "Internal equations-first-Gather " << internaleq << std::endl;
136  const TPZVec<int> &exteq = GatherVec(Submesh, ExternalFirst);
137  out << "External equations-first-Gather " << exteq << std::endl;
138  out << "Numbering of the Coarse nodes in the global mesh fCoarseNodes " << fCoarseNodes << std::endl;
139  fMatRedComplete->Print("The matrix which computes phi and fKCi ",out,EMathematicaInput);
140  fMatRed->Print("The matrix with the internal nodes condensed ", out,EMathematicaInput);
141  fKCi.Print("Coarse Matrix fKCi",out);
142  fPhiC.Print("fPhiC : ",out,EMathematicaInput);
143  out << "fWeights = " << fWeights << endl;
144  fPhiC_Weighted_Condensed.Print("fPhiC_Weighted_Condensed", out);
145  fLocalLoad.Print("fLocalLoad ", out);
146  fLocalWeightedResidual.Print("fLocalWeightedResidual ", out);
147  fAdjustSolution.Print("fAdjustSolution", out);
148 }
149 
150 template<class TVar>
152  int ncoarse = fCoarseNodes.NElements();
153  int i,j;
154  TPZFMatrix<TVar> rhs(this->fNEquations+ncoarse,ncoarse,0.);
155  for(i=0; i<ncoarse; i++)
156  {
157  rhs(fNEquations+i,i) = 1.;
158  }
159  fMatRedComplete->SetF(rhs);
160  fKCi.Resize(ncoarse,ncoarse);
163  for(i=0; i<ncoarse; i++)
164  {
165  fKCi(i,i) += 10.;
166  for(j=0; j<ncoarse; j++)
167  {
168  fKCi(i,j) = -fKCi(i,j);
169  }
170  fWeights[fCoarseNodes[i]] = fKCi(i,i);
171  }
172  fPhiC.Resize(fNEquations,ncoarse);
173  for(i=0; i<fNEquations; i++)
174  {
175  for(j=0; j<ncoarse; j++)
176  {
177  fPhiC(i,j) = rhs(i,j);
178  }
179  }
180 }
181 
182 template<class TVar>
184  int i;
185 #ifdef LOG4CXX
186  {
187  std::stringstream sout;
188  sout << "Weight used for assembly" << fWeights;
189  if (logger->isDebugEnabled())
190  {
191  LOGPZ_DEBUG(logger, sout.str());
192  }
193  }
194 #endif
195 
197 
198  int neqs = fNumExternalEquations;
199  StiffnessDiagLocal.Resize(neqs,1);
200  for (i=0;i<neqs;i++) {
201  StiffnessDiagLocal(i,0) = fWeights[gather[i]];
202  }
203 }
204 
205 template<class TVar>
207  int i;
208  //fWeights.Fill(1.);
210  int neqs = fNumExternalEquations;
211  for (i=0;i<neqs;i++) {
212  fWeights[scatter[i]] = fWeights[scatter[i]] / StiffnessDiagLocal(i,0);
213  }
214  for(; i<fNEquations; i++)
215  {
216  fWeights[scatter[i]] = 1.;
217  }
218 #ifdef LOG4CXX
219  {
220  std::stringstream sout;
221  sout << "Weights = " << fWeights;
222  if (logger->isDebugEnabled())
223  {
224  LOGPZ_DEBUG(logger, sout.str());
225  }
226  }
227 #endif
229  int c,nc = fPhiC.Cols();
230  fPhiC_Weighted_Condensed.Resize(neqs,nc);
231  for (i=0;i<neqs;i++)
232  {
233  for(c=0; c<nc; c++)
234  {
235  fPhiC_Weighted_Condensed(i,c) = fPhiC(gather[i],c)*fWeights[gather[i]];
236  }
237  }
238 }
239 
244 template<class TVar>
246 {
247  int nglob = fNEquations;
248  int ncols = rhs.Cols();
249  typedef std::pair<ENumbering,ENumbering> Numbering;
250  Numbering relat(ExternalFirst,Submesh);
251  Numbering relat2(InternalFirst,Submesh);
252  typename std::map<std::pair<ENumbering, ENumbering> , TPZVec<int> >::const_iterator itrelat, itrelat2, itrelat3;
253  itrelat = fPermutationsScatter.find(relat);
254  itrelat2 = fPermutationsScatter.find(relat2);
255  if(itrelat == fPermutationsScatter.end() || itrelat2 == fPermutationsScatter.end() )
256  {
257  DebugStop();
258  return;
259  }
260  TPZFMatrix<TVar> resglobal(nglob,ncols,0.),resloc(fNumExternalEquations,ncols,0.);
261  PermuteGather (itrelat2->second, fLocalLoad, resglobal, 0, nglob);
262  fMatRed->SetF(resglobal);
263  fMatRed->F1Red(resloc);
264 #ifdef LOG4CXX
265  if (logger->isDebugEnabled()) {
266  std::stringstream sout;
267  resglobal.Print("resglobal ",sout);
268  LOGPZ_DEBUG(logger, sout.str())
269  }
270 #endif
271  resglobal.Zero();
272  PermuteScatter(itrelat->second, resloc, resglobal, 0, fNumExternalEquations);
273  PermuteGather(itrelat->second, resglobal, rhs, 0, fNumExternalEquations);
274 #ifdef LOG4CXX
275  {
276  std::stringstream sout;
277  resloc.Print("Condensed F", sout);
278  resglobal.Print("Scattered F", sout);
279  rhs.Print("External first", sout);
280  sout << "vector for scatter " << itrelat->second << std::endl;
281  sout << "vector for gather " << itrelat->second << std::endl;
282  if (logger->isDebugEnabled())
283  {
284  LOGPZ_DEBUG(logger, sout.str());
285  }
286  }
287 #endif
288 #ifdef PZDEBUG
289  TPZFMatrix<TVar> test(resloc);
290  test -= rhs;
291  // TVar err = Norm(test);
292 #endif
293 }
294 
298 template<class TVar>
300 {
301  int nglob = fNEquations;
302  int ncols = UGlob.Cols();
303  USub.Redim (nglob, ncols);
304  typedef std::pair<ENumbering,ENumbering> Numbering;
305  Numbering relat(Submesh,ExternalFirst);
306  Numbering relat2(InternalFirst,Submesh);
307  typename std::map<std::pair<ENumbering, ENumbering> , TPZVec<int> >::const_iterator itrelat, itrelat2, itrelat3;
308  itrelat2 = fPermutationsScatter.find(relat2);
309  itrelat = fPermutationsScatter.find(relat);
310  if(itrelat2 == fPermutationsScatter.end() || itrelat == fPermutationsScatter.end())
311  {
312  DebugStop();
313  return;
314  }
315  TPZFMatrix<TVar> uloc(nglob,ncols,0.);
316  {
318  fMatRed->UGlobal2(UGlob,uloc);
319 // PermuteGather(itrelat->second, UGlob, uext, 0, fNumExternalEquations);
320 
321  }
322  PermuteScatter(itrelat2->second, uloc, USub , 0, nglob);
323 #ifdef LOG4CXX
324  {
325  std::stringstream sout;
326  // uext.Print("Boundary node solution", sout);
327  uloc.Print("Complete solution internal first", sout);
328  UGlob.Print("submesh solution", sout);
329  if (logger->isDebugEnabled())
330  {
331  LOGPZ_DEBUG(logger, sout.str());
332  }
333  }
334 #endif
335 }
336 
337 template<class TVar>
339 {
340  int i,j;
341  int nglob = fNEquations;
342  int ncols = u.Cols();
344  TPZFMatrix<TVar> uloc(nglob,ncols,0.), uborder(fNEquations-fNumInternalEquations,ncols,0.),resborder(fNEquations-fNumInternalEquations,ncols,0.);
345  typedef std::pair<ENumbering,ENumbering> Numbering;
346  Numbering relat(ExternalFirst,Submesh);
347  Numbering relat2(InternalFirst,Submesh);
348  typename std::map<std::pair<ENumbering, ENumbering> , TPZVec<int> >::const_iterator itrelat, itrelat2;
349  itrelat = fPermutationsScatter.find(relat);
350  itrelat2 = fPermutationsScatter.find(relat2);
351  if(itrelat == fPermutationsScatter.end() || itrelat2 == fPermutationsScatter.end())
352  {
353  return;
354  }
355 #ifdef LOG4CXX
356  if(logger->isDebugEnabled())
357  {
358  std::stringstream sout;
359  sout << "Scatter from external do submesh" << itrelat->second << std::endl;
360  sout << "Scatter from submesh to internal" << itrelat2->second << std::endl;
361  LOGPZ_DEBUG(logger,sout.str())
362  }
363 #endif
364  PermuteScatter(itrelat->second, u, uloc, 0, u.Rows());
365  PermuteGather(itrelat2->second, uloc, uborder, fNumInternalEquations, fNEquations);
366 #ifdef LOG4CXX
367  if(logger->isDebugEnabled())
368  {
369  std::stringstream sout;
370  u.Print("Input matrix ", sout);
371  uloc.Print("Natural ordering matrix",sout);
372  uborder.Print("Matrix passed to the matred object", sout);
373  LOGPZ_DEBUG(logger,sout.str())
374  }
375 #endif
376  fMatRed->Multiply(uborder,resborder);
377 
378  TPZFMatrix<TVar> resglobal(nglob,ncols,0.),resloc(fNumExternalEquations,ncols,0.);
379  PermuteScatter(itrelat2->second, resborder, resglobal, fNumInternalEquations, fNEquations);
380  PermuteGather(itrelat->second, resglobal, resloc, 0, u.Rows());
381 #ifdef LOG4CXX
382  {
383  std::stringstream sout;
384  sout << "Value of the local multiply = ";
385  resborder.Print("resborder " ,sout);
386  resglobal.Print("resglobal ",sout);
387  resloc.Print("resloc ",sout);
388  if (logger->isDebugEnabled())
389  {
390  LOGPZ_DEBUG(logger, sout.str());
391  }
392  }
393 #endif
394  int zcols = z.Cols();
395  for (i=0;i<neqs;i++) {
396  /* Sum row "i" of temp1 with row "fGlobalNodes[i]" of z */
397  for (j=0;j<zcols;j++) {
398  z(i,j) += alpha*resloc(i,j);
399  }
400  }
401 }
402 
403 template<class TVar>
405  PrepareSystems();
406  SolveSystemPhi();
407 
408 }
409 
410 template<class TVar>
412 }
413 
418 template<class TVar>
420 {
421  // std::cout << __PRETTY_FUNCTION__ << " should never be called\n";
422 }
423 
427 template<class TVar>
429 {
430 }
431 
437 template<class TVar>
439 {
440  int i,j,ncol = input.Cols();
441  for(i=first; i<last; i++) for(j=0; j<ncol; j++)
442  {
443  output(permute[i],j) = input.GetVal(i-first,j);
444  }
445 }
446 
452 template<class TVar>
454 {
455  int i,j,ncol = input.Cols();
456  for(i=first; i<last; i++) for(j=0; j<ncol; j++)
457  {
458  output(i-first,j) = input.GetVal(permute[i],j);
459  }
460 }
461 
463 template<class TVar>
465 {
466  typename std::map<std::pair<ENumbering,ENumbering>, TPZVec<int> >::const_iterator it;
467  it = fPermutationsScatter.find(std::pair<ENumbering,ENumbering>(destination,origin));
468  if(it != fPermutationsScatter.end())
469  {
470  return it->second;
471  }
472  else
473  {
474  LOGPZ_ERROR(logger,"Gathervec not found");
475  dummyvec.Resize(0);
476  return dummyvec;
477  }
478 }
479 
480 template<class TVar>
482 {
483  typename std::map<std::pair<ENumbering,ENumbering>, TPZVec<int> >::const_iterator it;
484  it = fPermutationsScatter.find(std::pair<ENumbering,ENumbering>(destination,origin));
485  if(it != fPermutationsScatter.end())
486  {
487  return it->second;
488  }
489  else
490  {
491  LOGPZ_ERROR(logger,"Gathervec not found");
492  dummyvec.Resize(0);
493  return dummyvec;
494  }
495 }
496 
498 template<class TVar>
499 void TPZDohrSubstructCondense<TVar>::Write(TPZStream &out, int withclassid) const
500 {
501  SAVEABLE_STR_NOTE(out,"fMatRedComplete");
502  if(fMatRedComplete)
503  {
504  int one = 1;
505  out.Write(&one);
506  fMatRedComplete->Write(out,0);
507  }
508  else {
509  int zero = 0;
510  out.Write(&zero);
511  }
512  SAVEABLE_STR_NOTE(out,"fNEquations");
513  out.Write(&fNEquations);
514  SAVEABLE_STR_NOTE(out,"fNumInternalEquations");
516  SAVEABLE_STR_NOTE(out,"fNumExternalEquations");
518  std::cout << fNEquations << " " << fNumInternalEquations << " " << fNumExternalEquations << std::endl;
519  out.Write( fCoarseNodes);
520  std::cout << fCoarseNodes << std::endl;
521  int one(1),two(2),three(3),four(4);
522 
523  out.Write(&one);
524  fPhiC.Write(out, 0);
525  out.Write(&two);
526  fPhiC_Weighted_Condensed.Write(out, 0);
527  out.Write(&three);
528  out.Write( fWeights);
529  fKCi.Write(out, 0);
530  out.Write(&four);
531  typename std::map<std::pair<ENumbering, ENumbering> , TPZVec<int> >::const_iterator it;
532  int sc = fPermutationsScatter.size();
533  out.Write(&sc);
534  for (it=fPermutationsScatter.begin(); it != fPermutationsScatter.end(); it++) {
535  int a = it->first.first;
536  int b = it->first.second;
537  out.Write(&a);
538  out.Write(&b);
539  out.Write( it->second);
540  }
541  if (fMatRed) {
542  int one = 1;
543  out.Write(&one);
544  fMatRed->Write(out, 0);
545  }
546  else {
547  int zero = 0;
548  out.Write(&zero);
549  }
550 
551  fLocalLoad.Write(out, 0);
552  fLocalWeightedResidual.Write(out, 0);
553  fAdjustSolution.Write(out, 0);
554 
555 }
556 
558 template<class TVar>
560 {
561  int a;
562  SAVEABLE_SKIP_NOTE(input);
563  input.Read(&a);
564  if (a) {
566  fMatRedComplete->Read(input,0);
567  }
568 
569  SAVEABLE_SKIP_NOTE(input);
570  input.Read(&fNEquations);
571  SAVEABLE_SKIP_NOTE(input);
572  input.Read(&fNumInternalEquations);
573  SAVEABLE_SKIP_NOTE(input);
574  input.Read(&fNumExternalEquations);
575  std::cout << fNEquations << " " << fNumInternalEquations << " " << fNumExternalEquations << std::endl;
576  input.Read( fCoarseNodes);
577  std::cout << fCoarseNodes << std::endl;
578  int one(-1),two(-2),three(-3),four(-4);
579 
580  input.Read(&one);
581  fPhiC.Read(input, 0);
582  input.Read(&two);
583  fPhiC_Weighted_Condensed.Read(input, 0);
584  input.Read(&three);
585  input.Read( fWeights);
586  fKCi.Read(input, 0);
587  input.Read(&four);
588  int nc;
589  input.Read(&nc);
590  for (int ic=0; ic<nc; ic++) {
591  int a;
592  int b;
593  input.Read(&a);
594  input.Read(&b);
595  ENumbering orig = (ENumbering)(a),dest = (ENumbering)(b);
596  std::pair<ENumbering, ENumbering> p(orig,dest);
597  input.Read( fPermutationsScatter[p]);
598  }
599  int control;
600  input.Read(&control);
601  if(control)
602  {
604  fMatRed->Read(input, 0);
605  }
606  fLocalLoad.Read(input, 0);
607  fLocalWeightedResidual.Read(input, 0);
608  fAdjustSolution.Read(input, 0);
609 
610 
611 }
612 
613 template class TPZDohrSubstructCondense<float>;
614 template class TPZDohrSubstructCondense<double>;
616 
620 
static TPZVec< int > dummyvec
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.
int fNEquations
Number of equations of the substructure.
void ComputeWeightsLocal(TPZFMatrix< TVar > &StiffnessDiagLocal)
Computes the weight matrix.
void Contribute_Kc(TPZMatrix< TVar > &Kc, TPZVec< int > &coarseindex)
It computes the local contribution to K(c)
void F1Red(TPZFMatrix< TVar > &F1)
Computes the reduced version of the right hand side .
Definition: pzmatred.cpp:171
void UGlobal(const TPZFMatrix< TVar > &U1, TPZFMatrix< TVar > &result)
Computes the complete vector based on the solution u1.
Definition: pzmatred.cpp:342
void Contribute_v3_local(TPZFMatrix< TVar > &v3, TPZFMatrix< TVar > &v1Plusv2) const
It computes the local contribution to v(3)
void Contribute_rc_local(TPZFMatrix< TVar > &residual_local, TPZFMatrix< TVar > &rc_local) const
It computes the local contribution to r(c).
Definition: test.py:1
TPZVec< int > & GatherVec(ENumbering origin, ENumbering destination)
void SetF(const TPZFMatrix< TVar > &F)
Copies the F vector in the internal data structure.
Definition: pzmatred.cpp:140
void UGlobal2(TPZFMatrix< TVar > &U1, TPZFMatrix< TVar > &result)
Definition: pzmatred.cpp:397
void SolveSystemPhi()
Solves the system for Phi and for v2 It stores the results in fPhiC and fzi.
clarg::argString input("-if", "input file", "cube1.txt")
void Contribute_v1_local(TPZFMatrix< TVar > &v1_local, TPZFMatrix< TVar > &invKc_rc) const
It computes the local contribution to v1.
void ContributeKULocal(const TVar alpha, const TPZFMatrix< TVar > &u, TPZFMatrix< TVar > &z) const
compute the multiplication of the local stiffness matrix with the vector u
TPZFMatrix< TVar > fPhiC_Weighted_Condensed
Phi * W matrix and condensed to the equations which are part of the global system.
void Contribute_v2_local(TPZFMatrix< TVar > &residual_local, TPZFMatrix< TVar > &v2_local)
It computes the local contribution to v2.
void Initialize()
Initializes the substructure.
void Print(const char *name=NULL, std::ostream &out=std::cout, const MatrixOutputFormat=EFormatted) const override
Prints the object data structure.
Definition: pzmatred.cpp:454
void AddInternalSolution(TPZFMatrix< TVar > &sol)
Add the internal solution to the final result.
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
void Read(TPZStream &buf, void *context) override
read objects from the stream
Definition: pzmatred.cpp:696
int fNumExternalEquations
Number of equations which connect to the global structure.
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
virtual int IsSimetric() const
Checks if the current matrix is symmetric.
Definition: pzmatrix.h:394
void AdjustResidual(TPZFMatrix< TVar > &r_global)
Adjust the residual to reflect a static condensation.
To condense matrix divided in sub structures. Sub Structure.
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
static void PermuteGather(const TPZVec< int > &permute, const TPZFMatrix< TVar > &input, TPZFMatrix< TVar > &output, int first, int last)
Apply a gather permutation to the input vector using a scatter permutation output[i-first] = input[pe...
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
TPZManVector< TVar > fWeights
Weights associated with each variable/equation.
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
TPZAutoPointer< TPZMatRed< TVar, TPZFMatrix< TVar > > > fMatRedComplete
Matrix problem which solves the phi and zi problems.
TPZFMatrix< TVar > fLocalLoad
Local load vector.
Contains the TPZDohrSubstructCondense class which condenses matrix divided in sub structures...
void PrepareSystems()
It prepares the datas for solving systems for phi and zi.
TPZFMatrix< TVar > fKCi
Stiffness matrix associated with the constraints.
void Read(TPZStream &input, void *context) override
method for reading the object for a stream
Contains the TPZfTime class which calculates times.
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Definition: pzlog.h:93
Full matrix class. Matrix.
Definition: pzfmatrix.h:32
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Definition: pzfmatrix.h:616
TPZFMatrix< TVar > fAdjustSolution
Solution vector which needs to be added to the converged system solution.
void Print(std::ostream &out) const
TPZAutoPointer< TPZMatRed< TVar, TPZFMatrix< TVar > > > fMatRed
Inverted (LU or Cholesky or LDLt) stiffness matrix for the internal degrees of freedom Calculado...
TPZVec< int > & ScatterVec(ENumbering origin, ENumbering destination)
void ContributeDiagonalLocal(TPZFMatrix< TVar > &StiffnessDiag)
Computes the contribution of each substructure node to global Stiffness diagonal (or something like t...
Implements a simple substructuring of a linear system of equations, composed of 4 submatrices...
Definition: pzmatred.h:34
TPZFMatrix< TVar > fLocalWeightedResidual
Local weighted residual - .
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
Definition: pzmatred.cpp:659
virtual void Multiply(const TPZFMatrix< TVar > &A, TPZFMatrix< TVar > &res, int opt=0) const
It mutiplies itself by TPZMatrix<TVar>A putting the result in res.
Definition: pzmatrix.cpp:1916
static void PermuteScatter(const TPZVec< int > &permute, const TPZFMatrix< TVar > &input, TPZFMatrix< TVar > &output, int first, int last)
Apply a scatter permutation to the input vector using a scatter permutation output[permute[i]] = inpu...
Contains TPZVerySparseMatrix class which implements a matrix whose nonzero elements are stored in bin...
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
void UGlobal(TPZFMatrix< TVar > &Uext, TPZFMatrix< TVar > &UGlobal)
Computes the global solution based on the interface solution.
virtual void Print(std::ostream &out) const
Definition: pzmatrix.h:253
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Definition: pzfmatrix.cpp:1016
std::map< std::pair< ENumbering, ENumbering >, TPZVec< int > > fPermutationsScatter
Permutation vectors.
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
#define SAVEABLE_STR_NOTE(buf, str)
Definition: TPZSavable.h:42
void Write(TPZStream &buf, int withclassid) const override
method for streaming the object to a stream
TPZFMatrix< TVar > fPhiC
Vectors associated with each constraint.
const TVar & GetVal(const int64_t row, const int64_t col) const override
Get values without bounds checking This method is faster than "Get" if DEBUG is defined.
Definition: pzfmatrix.h:566
void ContributeRhs(TPZFMatrix< TVar > &rhs)
Computes the condensed right hand side for the substructure.
int fNumInternalEquations
Number of internal equations of the substructure.
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716
#define SAVEABLE_SKIP_NOTE(buf)
Definition: TPZSavable.h:43
virtual void Read(bool &val)
Definition: TPZStream.cpp:91
void U1(TPZFMatrix< TVar > &F)
Returns the second vector, inverting K11.
Definition: pzmatred.cpp:289
Root matrix class (abstract). Matrix.
Definition: pzmatrix.h:60