4 #ifdef USING_NEW_SKYLMAT 19 #include "pzsaveable.h" 20 #include "pzmatdefs.h" 123 template<
class TVar2>
129 int64_t nel = origstorage.
size();
132 for (int64_t el=0; el<nel; el++) {
137 TVar2 *first_orig = &origstorage[0];
138 for (int64_t el=0; el<size_el; el++) {
139 fElem[el] = first+(origelem[el]-first_orig);
150 const TPZVec<TVar. &Storage()
178 int PutVal(
const int64_t row,
const int64_t col,
const TVar &element );
183 const TVar&
GetVal(
const int64_t row,
const int64_t col )
const;
185 TVar&
operator()(
const int64_t row,
const int64_t col);
187 virtual TVar&
s(
const int64_t row,
const int64_t col) {
return operator()(row, col); }
192 const TVar alpha,
const TVar beta ,
const int opt = 0)
const ;
212 int Resize(
const int64_t newDim ,
const int64_t );
218 int Redim(
const int64_t newDim ,
const int64_t );
219 int Redim(
const int64_t newDim) {
return Redim(newDim,newDim);}
241 const int FromCurrent = 0,
const int direction = 1) ;
257 virtual void AutoFill(int64_t nrow, int64_t ncol,
int symmetric);
279 virtual std::string
ClassName()
const {
return(
"TPZSkylMatrix"); }
281 int64_t
Size(
const int64_t column)
const 284 if (column < 0 || column >= this->
Rows()) {
297 TVar*
Diag(int64_t col) {
return fElem[col+1]-1;}
300 void DecomposeColumn(int64_t col, int64_t prevcol, std::list<int64_t> &singular);
351 template<
class TVar,
int N>
352 inline TVar
TemplateSum(
const TVar *p1,
const TVar *p2){
365 #else // USING_NEW_SKYLMAT 378 #include "pzsaveable.h" 379 #include "pzmatdefs.h" 444 template<
class TVar2>
451 for (int64_t el=0; el<nel; el++) {
456 TVar2 *first_orig = &orig.
fStorage[0];
457 for (int64_t el=0; el<size_el; el++) {
458 fElem[el] = first+(orig.
fElem[el]-first_orig);
464 int PutVal(
const int64_t row,
const int64_t col,
const TVar &element )
override;
465 const TVar &
GetVal(
const int64_t row,
const int64_t col )
const override;
468 TVar &
operator()(
const int64_t row,
const int64_t col);
469 virtual TVar &
s(
const int64_t row,
const int64_t col)
override;
475 const TVar alpha,
const TVar beta ,
const int opt = 0)
const override;
494 int Resize(
const int64_t newDim ,
const int64_t )
override;
498 int Redim(
const int64_t newDim ,
const int64_t )
override;
499 int Redim(
const int64_t newDim) {
return Redim(newDim,newDim);}
518 const int FromCurrent = 0,
const int direction = 1)
override;
536 virtual void AutoFill(int64_t nrow, int64_t ncol,
int symmetric) ;
555 virtual std::string
ClassName()
const {
return(
"TPZSkylMatrix"); }
558 int64_t
Size(
const int64_t column)
const 561 if (column < 0 || column >= this->
Rows()) {
580 void DecomposeColumn(int64_t col, int64_t prevcol, std::list<int64_t> &singular);
588 int Clear()
override;
634 template<
class TVar,
int N>
645 #endif // USING_NEW_SKYLMAT int Subst_LForward(TPZFMatrix< TVar > *b) const override
Computes B = Y, where A*Y = B, A is lower triangular with A(i,i)=1.
int Resize(const int64_t newDim, const int64_t) override
Redimensions a matriz keeping the previous values.
void AddKel(TPZFMatrix< TVar > &elmat, TPZVec< int64_t > &sourceindex, TPZVec< int64_t > &destinationindex) override
Add a contribution of a stiffness matrix.
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.
virtual void resize(const int64_t newsize)
TVar & operator()(const int64_t row, const int64_t col)
TPZVec< TVar > fStorage
fStorage is a unique vector which contains all the data of the skyline matrix
Templated vector implementation.
static void ComputeMaxSkyline(const TPZSkylMatrix< TVar > &first, const TPZSkylMatrix< TVar > &second, TPZVec< int64_t > &res)
Computes the highest skyline of both objects.
void Write(TPZStream &buf, int withclassid) const override
Packs the object structure in a stream of bytes.
virtual int64_t MemoryFootprint() const override
Returns the approximate size of the memory footprint (amount of memory required to store this object)...
int Decompose_Cholesky() override
Decomposes the current matrix using Cholesky method. The current matrix has to be symmetric...
void CopyFrom(TPZSkylMatrix< TVar2 > &orig)
copy the values from a matrix with a different precision
TPZSkylMatrix & operator-=(const TPZSkylMatrix< TVar > &A)
int64_t SkyHeight(int64_t col)
return the height of the skyline for a given column
void Copy(const TPZSkylMatrix< TVar > &)
int Subst_Diag(TPZFMatrix< TVar > *b) const override
Computes B = Y, where A*Y = B, A is diagonal matrix.
TPZSkylMatrix & operator*=(TVar value)
Implements a skyline storage format. A Skyline matrix is symmetric so square. Matrix.
double TemplateSum< double, 1 >(const double *p1, const double *p2)
Implements product of the values into p1 and p2.
TVar * Diag(int64_t col)
This method returns a pointer to the diagonal element of the matrix of the col column.
TPZSkylMatrix operator*(const TVar v) const
virtual void UpdateFrom(TPZAutoPointer< TPZMatrix< TVar > > mat) override
Updates the values of the matrix based on the values of the matrix.
virtual TVar & s(const int64_t row, const int64_t col) override
The operators check on the bounds if the DEBUG variable is defined.
int64_t size() const
Returns the number of elements of the vector.
int Subst_Forward(TPZFMatrix< TVar > *b) const override
Computes B = Y, where A*Y = B, A is lower triangular.
void SetSkyline(const TPZVec< int64_t > &skyline)
modify the skyline of the matrix, throwing away its values skyline indicates the minimum row number w...
void CopyFrom(TPZMatrix< TVar2 > ©)
virtual std::string ClassName() const
TPZSkylMatrix & operator+=(const TPZSkylMatrix< TVar > &A)
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
TPZSkylMatrix & operator=(const TPZSkylMatrix< TVar > &A)
int Redim(const int64_t newDim)
Free store vector implementation.
int64_t Rows() const
Returns number of rows.
int Zero() override
Zeroes the matrix.
int Decompose_LDLt() override
Decomposes the current matrix using LDLt.
static int64_t NumElements(const TPZVec< int64_t > &skyline)
int64_t Size(const int64_t column) const
TPZVec< TVar * > fElem
Storage to keep the first elements to each equation.
Full matrix class. Matrix.
int Subst_Backward(TPZFMatrix< TVar > *b) const override
Computes B = Y, where A*Y = B, A is upper triangular.
virtual void MultAdd(const TPZFMatrix< TVar > &x, const TPZFMatrix< TVar > &y, TPZFMatrix< TVar > &z, const TVar alpha, const TVar beta, const int opt=0) const override
It computes z = beta * y + alpha * opt(this)*x but z and x can not overlap in memory.
int Clear() override
It clears data structure.
int32_t Hash(std::string str)
int Redim(const int64_t newDim, const int64_t) override
Redimensions the matrix reinitializing it with zero.
Contains TPZMatrix<TVar>class, root matrix class.
TPZSkylMatrix operator-() const
void Read(TPZStream &buf, void *context) override
Unpacks the object structure from a stream of bytes.
virtual void SolveSOR(int64_t &numiterations, const TPZFMatrix< TVar > &F, TPZFMatrix< TVar > &result, TPZFMatrix< TVar > *residual, TPZFMatrix< TVar > &scratch, const REAL overrelax, REAL &tol, const int FromCurrent=0, const int direction=1) override
Solves the linear system using Successive Over Relaxation method (Gauss Seidel). ...
TPZSkylMatrix operator+(const TPZSkylMatrix< TVar > &A) const
int PutVal(const int64_t row, const int64_t col, const TVar &element) override
Put values without bounds checking This method is faster than "Put" if DEBUG is defined.
static void InitializeElem(const TPZVec< int64_t > &skyline, TPZVec< TVar > &storage, TPZVec< TVar *> &elem)
virtual int IsSimetric() const override
declare the object as simetric matrix
void AddSameStruct(TPZSkylMatrix< TVar > &B, double k=1.)
Add a skyline matrix B with same structure of this It makes this += k * B.
void DecomposeColumn(int64_t col, int64_t prevcol)
int Decompose_Cholesky_blk(int64_t blk_sz)
int ClassId() const override
Define the class id associated with the class.
Defines the interface for saving and reading data. Persistency.
#define CLONEDEF(A)
To create clone matrix.
TPZSkylMatrix(const TPZSkylMatrix< TVar > &A)
virtual ~TPZSkylMatrix()
destructor of the skyline matrix
TVar TemplateSum(const TVar *p1, const TVar *p2)
Implements iterative sum over N steps.
void DecomposeColumn2(int64_t col, int64_t prevcol)
int ClassId() const override
Define the class id associated with the class.
int Subst_LBackward(TPZFMatrix< TVar > *b) const override
Computes B = Y, where A*Y = B, A is upper triangular with A(i,i)=1.
virtual void AutoFill(int64_t nrow, int64_t ncol, int symmetric)
Root matrix class (abstract). Matrix.
This class implements a reference counter mechanism to administer a dynamically allocated object...