13 static LoggerPtr logger(Logger::getLogger(
"substruct.dohrsubstructcondense"));
51 Kc(coarseindex[i],coarseindex[j]) +=
fKCi(i,j);
72 int ncols = residual_local.
Cols();
74 int ninput = residual_local.
Rows();
76 for (
int ic=0; ic<ncols; ic++)
78 for (i=0;i<ninput;i++)
80 LocalWeightedResidual(scatter[i],ic) +=
fWeights[scatter[i]] * residual_local(i,ic);
84 if(logger->isDebugEnabled())
86 std::stringstream sout;
87 LocalWeightedResidual.
Print(
"LocalWeightedResidual ",sout);
95 if(logger->isDebugEnabled())
97 std::stringstream sout;
104 if(logger->isDebugEnabled())
106 std::stringstream sout;
107 UGlobal.
Print(
"UGlobal ",sout);
112 v2_local.
Resize(ninput, ncols);
113 for (
int ic=0; ic<ncols; ic++)
115 for (i=0;i<ninput;i++)
124 std::cout << __PRETTY_FUNCTION__ <<
" should never be called\n";
130 out << __PRETTY_FUNCTION__ << std::endl;
135 out <<
"Internal equations-first-Gather " << internaleq << std::endl;
137 out <<
"External equations-first-Gather " << exteq << std::endl;
138 out <<
"Numbering of the Coarse nodes in the global mesh fCoarseNodes " <<
fCoarseNodes << std::endl;
141 fKCi.Print(
"Coarse Matrix fKCi",out);
143 out <<
"fWeights = " <<
fWeights << endl;
155 for(i=0; i<ncoarse; i++)
160 fKCi.Resize(ncoarse,ncoarse);
163 for(i=0; i<ncoarse; i++)
166 for(j=0; j<ncoarse; j++)
175 for(j=0; j<ncoarse; j++)
177 fPhiC(i,j) = rhs(i,j);
187 std::stringstream sout;
188 sout <<
"Weight used for assembly" <<
fWeights;
189 if (logger->isDebugEnabled())
199 StiffnessDiagLocal.
Resize(neqs,1);
200 for (i=0;i<neqs;i++) {
201 StiffnessDiagLocal(i,0) =
fWeights[gather[i]];
211 for (i=0;i<neqs;i++) {
220 std::stringstream sout;
222 if (logger->isDebugEnabled())
229 int c,nc =
fPhiC.Cols();
248 int ncols = rhs.
Cols();
249 typedef std::pair<ENumbering,ENumbering> Numbering;
252 typename std::map<std::pair<ENumbering, ENumbering> ,
TPZVec<int> >::const_iterator itrelat, itrelat2, itrelat3;
265 if (logger->isDebugEnabled()) {
266 std::stringstream sout;
267 resglobal.Print(
"resglobal ",sout);
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())
302 int ncols = UGlob.
Cols();
303 USub.
Redim (nglob, ncols);
304 typedef std::pair<ENumbering,ENumbering> Numbering;
307 typename std::map<std::pair<ENumbering, ENumbering> ,
TPZVec<int> >::const_iterator itrelat, itrelat2, itrelat3;
325 std::stringstream sout;
327 uloc.
Print(
"Complete solution internal first", sout);
328 UGlob.
Print(
"submesh solution", sout);
329 if (logger->isDebugEnabled())
342 int ncols = u.
Cols();
345 typedef std::pair<ENumbering,ENumbering> Numbering;
348 typename std::map<std::pair<ENumbering, ENumbering> ,
TPZVec<int> >::const_iterator itrelat, itrelat2;
356 if(logger->isDebugEnabled())
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;
367 if(logger->isDebugEnabled())
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);
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())
394 int zcols = z.
Cols();
395 for (i=0;i<neqs;i++) {
397 for (j=0;j<zcols;j++) {
398 z(i,j) += alpha*resloc(i,j);
440 int i,j,ncol = input.
Cols();
441 for(i=first; i<last; i++)
for(j=0; j<ncol; j++)
443 output(permute[i],j) = input.
GetVal(i-first,j);
455 int i,j,ncol = input.
Cols();
456 for(i=first; i<last; i++)
for(j=0; j<ncol; j++)
458 output(i-first,j) = input.
GetVal(permute[i],j);
466 typename std::map<std::pair<ENumbering,ENumbering>,
TPZVec<int> >::const_iterator it;
483 typename std::map<std::pair<ENumbering,ENumbering>,
TPZVec<int> >::const_iterator it;
521 int one(1),two(2),three(3),four(4);
531 typename std::map<std::pair<ENumbering, ENumbering> ,
TPZVec<int> >::const_iterator it;
535 int a = it->first.first;
536 int b = it->first.second;
539 out.
Write( it->second);
578 int one(-1),two(-2),three(-3),four(-4);
581 fPhiC.Read(input, 0);
590 for (
int ic=0; ic<nc; ic++) {
596 std::pair<ENumbering, ENumbering> p(orig,dest);
600 input.
Read(&control);
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 .
void UGlobal(const TPZFMatrix< TVar > &U1, TPZFMatrix< TVar > &result)
Computes the complete vector based on the solution u1.
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 SetF(const TPZFMatrix< TVar > &F)
Copies the F vector in the internal data structure.
void UGlobal2(TPZFMatrix< TVar > &U1, TPZFMatrix< TVar > &result)
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.
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...
void Read(TPZStream &buf, void *context) override
read objects from the stream
int fNumExternalEquations
Number of equations which connect to the global structure.
virtual void Write(const bool val)
virtual int IsSimetric() const
Checks if the current matrix is symmetric.
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.
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.
TPZManVector< TVar > fWeights
Weights associated with each variable/equation.
int64_t Rows() const
Returns number of rows.
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
~TPZDohrSubstructCondense()
Contains the TPZfTime class which calculates times.
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Full matrix class. Matrix.
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
TPZVec< int > fCoarseNodes
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...
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.
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.
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.
void UGlobal(TPZFMatrix< TVar > &Uext, TPZFMatrix< TVar > &UGlobal)
Computes the global solution based on the interface solution.
virtual void Print(std::ostream &out) const
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
std::map< std::pair< ENumbering, ENumbering >, TPZVec< int > > fPermutationsScatter
Permutation vectors.
Defines the interface for saving and reading data. Persistency.
int64_t NElements() const
Returns the number of elements of the vector.
#define SAVEABLE_STR_NOTE(buf, str)
TPZDohrSubstructCondense()
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.
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...
#define SAVEABLE_SKIP_NOTE(buf)
virtual void Read(bool &val)
void U1(TPZFMatrix< TVar > &F)
Returns the second vector, inverting K11.
Root matrix class (abstract). Matrix.