22 static LoggerPtr logger(Logger::getLogger(
"pz.frontal.frontmerda"));
23 static LoggerPtr loggerfw(Logger::getLogger(
"pz.frontal.frontmerdatotal"));
28 template<
class TVar,
class store,
class front>
32 template<
class TVar,
class store,
class front>
36 int64_t loop_limit, global;
37 loop_limit = destinationindex.
NElements();
38 for(i=0;i<loop_limit;i++){
39 global = destinationindex[i];
40 fNumElConnected[global]--;
42 upper_eq=fLastDecomposed;
43 lower_eq=fLastDecomposed+1;
44 while(upper_eq < fNumEq-1 && fNumElConnected[upper_eq+1]==0) upper_eq++;
45 fLastDecomposed=upper_eq;
47 if (logger->isDebugEnabled())
49 std::stringstream sout;
50 sout <<
"Constructor frontmatrix lower_eq "<< lower_eq <<
" upper_eq " << upper_eq <<
" fNumElConnected " << fNumElConnected;
57 template<class TVar, class store, class front>
60 fNumElConnected=numelconnected;
61 fNumElConnectedBackup = fNumElConnected;
63 if (logger->isDebugEnabled())
65 std::stringstream sout;
66 sout <<
"fNumElConnected " << fNumElConnected;
73 template<class TVar, class store, class front>
77 fFront.
AddKel(elmat, destinationindex);
79 if (loggerfw->isInfoEnabled())
81 std::stringstream sout;
82 sout <<
"Frondwidth after AddKel "<< fFront.NElements();
88 EquationsToDecompose(destinationindex, mineq, maxeq);
92 fFront.DecomposeEquations(mineq,maxeq,AuxEqn);
94 fStorage.AddEqnArray(&AuxEqn);
95 if(maxeq == this->Rows()-1){
96 fStorage.FinishWriting();
100 this->fDecomposed = fFront.GetDecomposeType();
104 template<
class TVar,
class store,
class front>
107 fFront.AddKel(elmat, sourceindex, destinationindex);
109 if (loggerfw->isInfoEnabled())
111 std::stringstream sout;
112 sout <<
"Frondwidth after AddKel "<< fFront.FrontSize();
117 int64_t mineq, maxeq;
118 EquationsToDecompose(destinationindex, mineq, maxeq);
121 fFront.DecomposeEquations(mineq,maxeq,AuxEqn);
123 fStorage.AddEqnArray(&AuxEqn);
124 if(maxeq == this->Rows()-1){
126 fStorage.FinishWriting();
130 this->fDecomposed = fFront.GetDecomposeType();
134 template<
class TVar,
class store,
class front>
137 fFront.SymbolicAddKel(destinationindex);
138 int64_t mineq, maxeq;
139 EquationsToDecompose(destinationindex, mineq, maxeq);
142 fFront.SymbolicDecomposeEquations(mineq,maxeq);
149 template<
class TVar,
class store,
class front>
154 template<
class TVar,
class store,
class front>
166 template<
class TVar,
class store,
class front>
178 template<
class TVar,
class store,
class front>
183 template<
class TVar,
class store,
class front>
187 out <<
"Frontal Matrix associated"<< endl;
189 out <<
"Stored Equations" << endl;
191 out <<
"Number of Equations " <<
fNumEq << endl;
192 out <<
"Number of Elements connected to DF" << endl;
198 template<
class TVar,
class store,
class front>
228 for(j=i;j<4;j++) KEl2(j,i)=KEl2(i,j);
250 for(i=0;i<4;i++) NumConnected[i]=2;
261 TestFront.
AddKel(KEl1,DestInd1);
262 TestFront.
AddKel(KEl2,DestInd2);
263 TestFront.
AddKel(KEl3,DestInd3);
266 template<
class TVar,
class store,
class front>
269 double nfreerate = ( (double)
fFront.NFree() / (double)
fFront.FrontSize() ) * 100;
273 if (logger->isDebugEnabled())
275 std::stringstream sout;
276 sout <<
"Compressing front nfreerate " << nfreerate <<
" NFree " <<
fFront.NFree() <<
" Front elements " <<
fFront.FrontSize();
282 if (loggerfw->isInfoEnabled())
284 std::stringstream sout;
285 sout <<
"Frondwidth after Compress "<<
fFront.FrontSize();
292 template<class TVar, class store, class front>
294 if (
fFront.GetDecomposeType() != dt) {
298 if (logger->isDebugEnabled())
301 std::stringstream sout;
302 B.
Print(
"On input " , sout);
308 if (logger->isDebugEnabled())
310 std::stringstream sout;
311 B.
Print(
"After forward and diagonal " , sout);
317 if (logger->isDebugEnabled())
319 std::stringstream sout;
320 B.
Print(
"Final result " , sout);
328 template<
class TVar,
class store,
class front>
335 template<
class TVar,
class store,
class front>
342 template<
class TVar,
class store,
class front>
344 cout <<
"Entering Forward Substitution\n";
352 template<
class TVar,
class store,
class front>
354 cout <<
"Entering Backward Substitution\n";
362 template<
class TVar,
class store,
class front>
367 template<
class TVar,
class store,
class front>
371 template<
class TVar,
class store,
class front>
376 template<
class TVar,
class store,
class front>
Has the same porpouse of EqnStack but stores the EqnArrays in a different form (binary files)...
int64_t fNumEq
Indicates number of equations.
void CheckCompress()
Checks if FrontMatrix needs a compression, if so calls Compress method.
int Subst_Backward(TPZFMatrix< TVar > *b) const override
Backward substitution and result is on b.
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.
TPZFrontMatrix()
Simple Constructor.
Responsible for the frontal method as a whole. Frontal.
It is an equation array, generally in its decomposed form. Frontal.
Contains the TPZFront class which implements decomposition process of the frontal matrix...
Responsible for storing arrays of equations (mostly in a decomposed form). Frontal.
Implements a matrix stored in a frontal decomposition scheme. Frontal.
store fStorage
Indicates storage schema. Assumes values TPZFileEqnStorage for binary file and TPZStackEqnStorage for...
MatrixOutputFormat
Defines output format.
virtual int Resize(const int64_t newRows, const int64_t newCols)
Redimensions a matriz keeping the previous values.
Abstract class implements storage and decomposition process of the frontal matrix involving simmetry ...
TPZVec< int > fNumElConnectedBackup
Contains the number of elements which still need to contribute to a given equation.
Contains the TPZEqnArray class which implements an equation array.
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 SymbolicAddKel(TPZVec< int64_t > &destinationindex)
Add a contribution of a stiffness matrix using the indexes to compute the frontwidth. It does it symbolicaly.
#define LOGPZ_INFO(A, B)
Define log for informations.
int Subst_Forward(TPZFMatrix< TVar > *b) const override
Forward substitution and result is on b.
#define DebugStop()
Returns a message to user put a breakpoint in.
void FinishWriting()
Finishes writing of a binary file and closes it.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
void SetNumElConnected(TPZVec< int > &numelconnected)
Initializes the number of elements connected to each equation.
~TPZFrontMatrix()
Simple Destructor.
int64_t fLastDecomposed
Indicates last decomposed equation.
void ReOpen()
Reopen the binary file.
int ClassId() const override
Define the class id associated with the class.
front fFront
Indicates Front matrix type. Assumes values TPZFrontSym for symmetric front and TPZFrontNonSym for no...
int ClassId() const override
Define the class id associated with the class.
Full matrix class. Matrix.
int Substitution(TPZFMatrix< TVar > *) const override
Executes a substitution on a TPZFMatrix<REAL> object applies both forward and backward substitution a...
int32_t Hash(std::string str)
void EquationsToDecompose(TPZVec< int64_t > &destinationindex, int64_t &lower_eq, int64_t &upper_eq)
Sends a message to decompose equations from lower_eq to upper_eq, according to destination index...
TPZVec< int > fNumElConnected
Contains the number of elements which still need to contribute to a given equation.
virtual int Zero() override
Reinitialize the structure of the frontal matrix.
virtual void AddKel(TPZFMatrix< TVar > &elmat, TPZVec< int64_t > &destinationindex) override
Add a contribution of a stiffness matrix putting it on destination indexes position.
void SetFileName(char option, const char *name)
Sets a file name for generic input or output.
Contains the TPZAbstractFrontMatrix class which implements a matrix stored in a frontal decomposition...
void Print(const char *name, std::ostream &out, const MatrixOutputFormat form=EFormatted) const override
Prints a FrontMatrix object.
virtual void Print(std::ostream &out) const
int64_t NElements() const
Returns the number of elements of the vector.
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
void AllocData()
Allocates data for the FrontMatrix.
Abstract class implements storage and decomposition process of the frontal matrix involving non-simet...
Contains TPZSFMatrix class which implements a symmetric full matrix.
DecomposeType
Defines decomposition type for any matrix classes.