NeoPZ
tpzdohrsubstructCondense.h
Go to the documentation of this file.
1 
6 #ifndef TPZDOHRSUBSTRUCTCONDENSE_H
7 #define TPZDOHRSUBSTRUCTCONDENSE_H
8 
9 #include "pzfmatrix.h"
10 #include "tpzautopointer.h"
11 #include "pzstepsolver.h"
12 #include "pzysmp.h"
13 #include "pzmatred.h"
14 #include "TPZSavable.h"
15 
21 template<class TVar>
23 {
24  public:
25 
26  public:
27 int ClassId() const override;
28 
29 
31 
33 
35 
37 
39 
42  {
43  return fNumExternalEquations;
44  }
45 
48  void AdjustResidual(TPZFMatrix<TVar> &r_global);
51  void Contribute_rc_local(TPZFMatrix<TVar> &residual_local, TPZFMatrix<TVar> &rc_local) const;
53  void Contribute_Kc(TPZMatrix<TVar> &Kc, TPZVec<int> &coarseindex);
60  void Contribute_v1_local(TPZFMatrix<TVar> &v1_local, TPZFMatrix<TVar> &invKc_rc) const;
62  void Contribute_v2_local(TPZFMatrix<TVar> &residual_local, TPZFMatrix<TVar> &v2_local);
68  void Contribute_v3_local(TPZFMatrix<TVar> &v3, TPZFMatrix<TVar> &v1Plusv2) const;
72  void Print(std::ostream &out) const;
73 
75  void ContributeKULocal(const TVar alpha, const TPZFMatrix<TVar> &u, TPZFMatrix<TVar> &z) const;
80  void ContributeDiagonalLocal(TPZFMatrix<TVar> &StiffnessDiag);
85  void ComputeWeightsLocal(TPZFMatrix<TVar> &StiffnessDiagLocal);
94  void Initialize();
95 
98 
100  void GetCoarseStiffness(TPZMatrix<TVar> &stiff, TPZVec<int> &indices);
101 
107  static void PermuteScatter(const TPZVec<int> &permute, const TPZFMatrix<TVar> &input, TPZFMatrix<TVar> &output, int first, int last);
113  static void PermuteGather(const TPZVec<int> &permute, const TPZFMatrix<TVar> &input, TPZFMatrix<TVar> &output, int first, int last);
114 
116  void Write(TPZStream &buf, int withclassid) const override;
117 
119  void Read(TPZStream &input, void *context) override;
120 
121  public:
123  void PrepareSystems();
128  void SolveSystemPhi();
131 
136 
139 
146 
149  TPZFMatrix<TVar> fPhiC; //Phí(i)
152 
158  TPZManVector<TVar> fWeights; //W(i) = diagonal(fWeights)
165 
172  std::map<std::pair<ENumbering, ENumbering> , TPZVec<int> > fPermutationsScatter;
173 
175 
178  {
179  if(!wasRealloc) {
180  std::cout << "TPZDohrSubstructCondense::ReallocMatRed\n";
183  fMatRedComplete.ReallocForNuma(0);
184 
185  wasRealloc = true;
186  }
187  }
188 
190  {
191  return fPermutationsScatter[std::pair<ENumbering,ENumbering>(destination,origin)];
192  }
193 
195  {
196  return fPermutationsScatter[std::pair<ENumbering,ENumbering>(origin,destination)];
197  }
198 
199  const TPZVec<int> &GatherVec(ENumbering origin, ENumbering destination) const;
200 
201  const TPZVec<int> &ScatterVec(ENumbering origin, ENumbering destination) const;
202 
207  mutable TPZAutoPointer<TPZMatRed<TVar, TPZFMatrix<TVar> > > fMatRed; //R(Ii)*K(i)*R(Ii)invertida
209  TPZFMatrix<TVar> fLocalLoad; //F(i) - Actually it's a vector
211  TPZFMatrix<TVar> fLocalWeightedResidual; //W(i)*R(i)*r - Actually it's a vector
212 
216 };
217 
218 template<class TVar>
220  return Hash("TPZDohrSubstructCondense") ^ ClassIdOrHash<TVar>() << 1;
221 }
222 
223 #endif
Contains declaration of the TPZSavable class which defines the interface to save and restore objects ...
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 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).
TPZVec< int > & GatherVec(ENumbering origin, ENumbering destination)
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")
Contains TPZMatRed class which implements a simple substructuring of a linear system of equations...
void GetCoarseStiffness(TPZMatrix< TVar > &stiff, TPZVec< int > &indices)
Assemble the coarse dof stiffness matrix.
void Contribute_v1_local(TPZFMatrix< TVar > &v1_local, TPZFMatrix< TVar > &invKc_rc) const
It computes the local contribution to v1.
void ReallocSolver()
Definition: pzmatred.h:76
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 AddInternalSolution(TPZFMatrix< TVar > &sol)
Add the internal solution to the final result.
int fNumExternalEquations
Number of equations which connect to the global structure.
void AdjustResidual(TPZFMatrix< TVar > &r_global)
Adjust the residual to reflect a static condensation.
To condense matrix divided in sub structures. Sub Structure.
Contains TPZMatrixclass which implements full matrix (using column major representation).
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...
TPZManVector< TVar > fWeights
Weights associated with each variable/equation.
TPZAutoPointer< TPZMatRed< TVar, TPZFMatrix< TVar > > > fMatRedComplete
Matrix problem which solves the phi and zi problems.
Contains the TPZFYsmpMatrix class which implements a non symmetric sparse matrix. ...
TPZFMatrix< TVar > fLocalLoad
Local load vector.
int ClassId() const override
Define the class id associated with the class.
Contains declaration of the TPZAutoPointer class which has Increment and Decrement actions are mutexe...
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
Full matrix class. Matrix.
Definition: pzfmatrix.h:32
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
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...
void GetCoarseResidual(TPZFMatrix< TVar > &rc, TPZVec< int > &indices)
Assemble the contribution to the coarse residual.
TPZFMatrix< TVar > fLocalWeightedResidual
Local weighted residual - .
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 TPZStepSolver class which defines step solvers class.
void UGlobal(TPZFMatrix< TVar > &Uext, TPZFMatrix< TVar > &UGlobal)
Computes the global solution based on the interface solution.
std::map< std::pair< ENumbering, ENumbering >, TPZVec< int > > fPermutationsScatter
Permutation vectors.
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
int NumEquations()
Return the number of equations which contribute to the global system.
void Write(TPZStream &buf, int withclassid) const override
method for streaming the object to a stream
This class defines the interface to save and restore objects from TPZStream objects. Persistency.
Definition: TPZSavable.h:67
void ReallocForNuma(int node)
TPZFMatrix< TVar > fPhiC
Vectors associated with each constraint.
void ContributeRhs(TPZFMatrix< TVar > &rhs)
Computes the condensed right hand side for the substructure.
int fNumInternalEquations
Number of internal equations of the substructure.
Root matrix class (abstract). Matrix.
Definition: pzmatrix.h:60
This class implements a reference counter mechanism to administer a dynamically allocated object...