Skip to content

Commit

Permalink
Created TPZMatrix::NewMatrix method
Browse files Browse the repository at this point in the history
  • Loading branch information
orlandini committed May 22, 2021
1 parent 22e3842 commit edf4f62
Show file tree
Hide file tree
Showing 16 changed files with 26 additions and 11 deletions.
1 change: 1 addition & 0 deletions Frontal/TPZFrontMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class TPZFrontMatrix : public TPZAbstractFrontMatrix<TVar> {
}

// CLONEDEF(TPZFrontMatrix)
inline TPZFrontMatrix*NewMatrix() const override {return new TPZFrontMatrix{};}
virtual TPZMatrix<TVar>*Clone() const override { return new TPZFrontMatrix(*this); }
/**
* @brief Sends a message to decompose equations from lower_eq to upper_eq, according to destination index
Expand Down
3 changes: 2 additions & 1 deletion Matrix/pzblockdiag.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class TPZBlockDiagonal : public TPZMatrix<TVar>
TPZBlockDiagonal (const TPZVec<int> &blocksizes);
/** @brief Copy constructor */
TPZBlockDiagonal (const TPZBlockDiagonal & );


TPZBlockDiagonal* NewMatrix() const override{ return new TPZBlockDiagonal{};}
CLONEDEF(TPZBlockDiagonal)

/** @brief Creates a copy from another TPZBlockDiagonal*/
Expand Down
1 change: 1 addition & 0 deletions Matrix/pzbndmat.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class TPZFBMatrix : public TPZMatrix<TVar>
TPZFBMatrix (const TPZFBMatrix<TVar> & ) = default;
/** @brief Move constructor */
TPZFBMatrix (TPZFBMatrix<TVar> && ) = default;
inline TPZFBMatrix<TVar>*NewMatrix() const override {return new TPZFBMatrix<TVar>{};}
CLONEDEF(TPZFBMatrix)
/** @brief Copy-assignment operator*/
TPZFBMatrix &operator= (const TPZFBMatrix<TVar> & A ) = default;
Expand Down
2 changes: 1 addition & 1 deletion Matrix/pzfmatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class TPZFMatrix: public TPZMatrix<TVar> {
TPZFMatrix&operator= (const TPZFMatrix<TVar> &A );
//!Move-assignment operator
TPZFMatrix&operator= (TPZFMatrix<TVar> &&A );

inline TPZFMatrix<TVar>*NewMatrix() const override {return new TPZFMatrix<TVar>{};}
CLONEDEF(TPZFMatrix<TVar>)
TPZFMatrix(const TPZMatrix<TVar> & refmat);

Expand Down
4 changes: 2 additions & 2 deletions Matrix/pzmatred.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class TPZMatRed: public TPZMatrix<TVar>

if(cp.fK00) fK00 = cp.fK00;
}

inline TPZMatRed<TVar,TSideMatrix>*NewMatrix() const override {return new TPZMatRed<TVar,TSideMatrix>{};}
CLONEDEF(TPZMatRed)

/** @brief Creates a copy from another TPZMatRed*/
Expand Down Expand Up @@ -233,7 +233,7 @@ class TPZMatRed: public TPZMatrix<TVar>

/** @brief Saveable methods */
public:
int ClassId() const override;
int ClassId() const override;


void Write(TPZStream &buf, int withclassid) const override;
Expand Down
6 changes: 4 additions & 2 deletions Matrix/pzmatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ class TPZMatrix: public TPZBaseMatrix
TPZMatrix<TVar> &operator=(const TPZMatrix<TVar> &);
/** @brief Move assignment operator*/
TPZMatrix<TVar> &operator=(TPZMatrix<TVar> &&);

/** @brief To create a matrix of the same type */
virtual TPZMatrix<TVar>*NewMatrix() const = 0;
/** @brief To create clone matrix */
virtual TPZMatrix<TVar>*Clone() const = 0;

/**
Expand Down Expand Up @@ -87,7 +89,7 @@ class TPZMatrix: public TPZBaseMatrix
/** @brief Creates a copy from a given matrix of arbitrary storage format.
Every implementation should check for type compatibility */
virtual void CopyFrom(const TPZMatrix<TVar> *mat) = 0;

/** @brief Fill matrix storage with randomic values */
/** This method use GetVal and PutVal which are implemented by each type matrices */
void AutoFill(int64_t nrow, int64_t ncol, int symmetric) override;
Expand Down
1 change: 1 addition & 0 deletions Matrix/pzsbndmat.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class TPZSBMatrix : public TPZMatrix<TVar>
TPZSBMatrix(const int64_t dim,const int64_t band );
TPZSBMatrix(const TPZSBMatrix<TVar> &A ) = default;
TPZSBMatrix(TPZSBMatrix<TVar> &&A ) = default;
inline TPZSBMatrix<TVar>*NewMatrix() const override {return new TPZSBMatrix<TVar>{};}
CLONEDEF(TPZSBMatrix)
TPZSBMatrix &operator= (TPZSBMatrix<TVar> &&A ) = default;
TPZSBMatrix &operator= (const TPZSBMatrix<TVar> &A ) = default;
Expand Down
1 change: 1 addition & 0 deletions Matrix/pzsfulmat.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class TPZSFMatrix : public TPZMatrix<TVar> {
TPZSFMatrix (const TPZMatrix<TVar> & );
TPZSFMatrix &operator= (const TPZSFMatrix<TVar> &A );
TPZSFMatrix &operator= (TPZSFMatrix<TVar> &&A );
inline TPZSFMatrix<TVar>*NewMatrix() const override {return new TPZSFMatrix<TVar>{};}
CLONEDEF(TPZSFMatrix)

~TPZSFMatrix();
Expand Down
3 changes: 2 additions & 1 deletion Matrix/pzskylmat.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class TPZSkylMatrix : public TPZMatrix<TVar>
TPZSkylMatrix &operator= (TPZSkylMatrix<TVar> &&A ) = default;
/** @brief destructor of the skyline matrix */
virtual ~TPZSkylMatrix() { Clear(); }


inline TPZSkylMatrix<TVar>*NewMatrix() const override {return new TPZSkylMatrix<TVar>{};}
CLONEDEF(TPZSkylMatrix)

virtual int64_t MemoryFootprint() const override {
Expand Down
4 changes: 4 additions & 0 deletions Matrix/pzskylnsymmat.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class TPZSkylNSymMatrix : public TPZMatrix<TVar>
Copy(A);
}
TPZSkylNSymMatrix(TPZSkylNSymMatrix &&A ) = default;
inline TPZSkylNSymMatrix<TVar>*NewMatrix() const override
{
return new TPZSkylNSymMatrix<TVar>{};
}
CLONEDEF(TPZSkylNSymMatrix)
TPZSkylNSymMatrix& operator=(const TPZSkylNSymMatrix&A);
TPZSkylNSymMatrix& operator=(TPZSkylNSymMatrix&&A) = default;
Expand Down
2 changes: 1 addition & 1 deletion Matrix/pzsysmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public :
TPZSYsmpMatrix &operator=(const TPZSYsmpMatrix<TVar> &copy) = default;
/** @brief Move-assignment operator*/
TPZSYsmpMatrix &operator=(TPZSYsmpMatrix<TVar> &&copy) = default;
inline TPZSYsmpMatrix<TVar>*NewMatrix() const override {return new TPZSYsmpMatrix<TVar>{};}
CLONEDEF(TPZSYsmpMatrix)
/** @brief Destructor */
virtual ~TPZSYsmpMatrix();
Expand Down
2 changes: 1 addition & 1 deletion Matrix/pzysmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TPZFYsmpMatrix : public TPZMatrix<TVar> {
TPZFYsmpMatrix &operator=(TPZFYsmpMatrix<TVar> &&copy) = default;

TPZFYsmpMatrix &operator=(const TPZVerySparseMatrix<TVar> &cp);
inline TPZFYsmpMatrix<TVar>*NewMatrix() const override {return new TPZFYsmpMatrix<TVar>{};}
CLONEDEF(TPZFYsmpMatrix)

virtual ~TPZFYsmpMatrix();
Expand Down
3 changes: 2 additions & 1 deletion Matrix/tpzverysparsematrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class TPZVerySparseMatrix: public TPZMatrix<TVar>
#endif
return fExtraSparseData[std::pair<int64_t, int64_t>(row, col)];
}

inline TPZVerySparseMatrix<TVar>*NewMatrix() const override
{return new TPZVerySparseMatrix<TVar>{};}
CLONEDEF(TPZVerySparseMatrix)

/** @brief Creates a copy from another TPZVerySparseMatrix*/
Expand Down
2 changes: 1 addition & 1 deletion Solvers/Multigrid/pztransfer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public :
fDoubleValLastUsed(cp.fDoubleValLastUsed)
{
}

inline TPZTransfer*NewMatrix() const override {return new TPZTransfer{};}
virtual TPZMatrix<TVar> *Clone() const override { return new TPZTransfer(*this); }

/** @brief Creates a copy from another TPZTransfer*/
Expand Down
1 change: 1 addition & 0 deletions SubStruct/tpzdohrmatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class TPZDohrMatrix : public TPZMatrix<TVar>
}

// CLONEDEF(TPZDohrMatrix)
inline TPZDohrMatrix*NewMatrix() const override {return new TPZDohrMatrix{};}
virtual TPZMatrix<TVar>*Clone() const override { return new TPZDohrMatrix(*this); }

~TPZDohrMatrix();
Expand Down
1 change: 1 addition & 0 deletions SubStruct/tpzdohrprecond.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class TPZDohrPrecond : public TPZMatrix<TVar>
~TPZDohrPrecond();

// CLONEDEF(TPZDohrPrecond)
inline TPZDohrPrecond*NewMatrix() const override {return new TPZDohrPrecond{};}
virtual TPZMatrix<TVar>*Clone() const override { return new TPZDohrPrecond(*this); }

/** @brief The matrix class is a placeholder for a list of substructures */
Expand Down

0 comments on commit edf4f62

Please sign in to comment.