Clean-up of extended addressing and matrix

This commit is contained in:
Hrvoje Jasak 2015-11-02 17:29:19 +00:00
parent 45838c7dbe
commit 1452de4bab
6 changed files with 89 additions and 76 deletions

View file

@ -27,6 +27,14 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::extendedBlockLduMatrix<Type>::clearOut()
{
deleteDemandDrivenData(extendedLowerPtr_);
deleteDemandDrivenData(extendedUpperPtr_);
}
template<class Type>
void Foam::extendedBlockLduMatrix<Type>::mapOffDiagCoeffs
(
@ -253,15 +261,7 @@ Foam::extendedBlockLduMatrix<Type>::extendedBlockLduMatrix
template<class Type>
Foam::extendedBlockLduMatrix<Type>::~extendedBlockLduMatrix()
{
if (extendedLowerPtr_)
{
delete extendedLowerPtr_;
}
if (extendedUpperPtr_)
{
delete extendedUpperPtr_;
}
clearOut();
}

View file

@ -85,9 +85,15 @@ private:
//- Disallow default bitwise assignement
void operator=(const extendedBlockLduMatrix<Type>&);
//- Map upper and lower coeffs from ordinary block matrix to extended
// block matrix
void mapOffDiagCoeffs(const BlockLduMatrix<Type>&);
// Helper functions
//- Clear all demand driven data - helper function
void clearOut();
//- Map upper and lower coeffs from ordinary block matrix to
// extended block matrix
void mapOffDiagCoeffs(const BlockLduMatrix<Type>&);
public:
@ -106,9 +112,8 @@ public:
);
// Destructor
~extendedBlockLduMatrix();
//- Destructor
~extendedBlockLduMatrix();
// Member functions

View file

@ -35,58 +35,9 @@ namespace Foam
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::extendedLduAddressing::extendedLduAddressing
(
const lduAddressing& lduAddr,
const label extensionLevel
)
:
lduAddr_(lduAddr),
p_(extensionLevel),
extendedLowerPtr_(NULL),
extendedUpperPtr_(NULL),
faceMapPtr_(NULL),
extendedLosortPtr_(NULL),
extendedOwnerStartPtr_(NULL),
extendedLosortStartPtr_(NULL)
{
// Issue an error if a negative extension level is selected
if (p_ < 0)
{
FatalErrorIn
(
"extendedLduAddressing::extendedLduAddressing"
)
<< "Negative extension level not allowed."
<< abort(FatalError);
}
// Disallow extension level 0 as it is the same as ordinary lduAddressing
else if (p_ == 0)
{
FatalErrorIn
(
"extendedLduAddressing::extendedLduAddressing"
)
<< "Extension level 0 not allowed as it is the same as ordinary "
<< "lduAddressing."
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * /
Foam::extendedLduAddressing::~extendedLduAddressing()
{
clearAllDemandDrivenData();
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::extendedLduAddressing::clearAllDemandDrivenData() const
void Foam::extendedLduAddressing::clearOut() const
{
deleteDemandDrivenData(extendedLowerPtr_);
deleteDemandDrivenData(extendedUpperPtr_);
@ -460,6 +411,55 @@ void Foam::extendedLduAddressing::calcExtendedLosortStart() const
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::extendedLduAddressing::extendedLduAddressing
(
const lduAddressing& lduAddr,
const label extensionLevel
)
:
lduAddr_(lduAddr),
p_(extensionLevel),
extendedLowerPtr_(NULL),
extendedUpperPtr_(NULL),
faceMapPtr_(NULL),
extendedLosortPtr_(NULL),
extendedOwnerStartPtr_(NULL),
extendedLosortStartPtr_(NULL)
{
// Issue an error if a negative extension level is selected
if (p_ < 0)
{
FatalErrorIn
(
"extendedLduAddressing::extendedLduAddressing"
)
<< "Negative extension level not allowed."
<< abort(FatalError);
}
// Disallow extension level 0 as it is the same as ordinary lduAddressing
else if (p_ == 0)
{
FatalErrorIn
(
"extendedLduAddressing::extendedLduAddressing"
)
<< "Extension level 0 not allowed as it is the same as ordinary "
<< "lduAddressing."
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * /
Foam::extendedLduAddressing::~extendedLduAddressing()
{
clearOut();
}
// * * * * * * * * * * * * Public Member Functions * * * * * * * * * * * * * //
const Foam::unallocLabelList&
@ -591,7 +591,7 @@ bool Foam::extendedLduAddressing::updateMesh(const mapPolyMesh& mpm) const
) << "Clearing extendedLduAddressing data" << endl;
}
clearAllDemandDrivenData();
clearOut();
return true;
}

View file

@ -106,7 +106,7 @@ class extendedLduAddressing
// Helper functions
//- Clear all demand driven data - helper function
void clearAllDemandDrivenData() const;
void clearOut() const;
//- Recursive function that inserts cell neighbours in a hash set
// Parameters:

View file

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "extendedLduMatrix.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -33,6 +34,15 @@ namespace Foam
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::extendedLduMatrix::clearOut()
{
deleteDemandDrivenData(extendedLowerPtr_);
deleteDemandDrivenData(extendedUpperPtr_);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::extendedLduMatrix::extendedLduMatrix
@ -118,15 +128,7 @@ Foam::extendedLduMatrix::extendedLduMatrix
Foam::extendedLduMatrix::~extendedLduMatrix()
{
if (extendedLowerPtr_)
{
delete extendedLowerPtr_;
}
if (extendedUpperPtr_)
{
delete extendedUpperPtr_;
}
clearOut();
}

View file

@ -78,6 +78,12 @@ class extendedLduMatrix
void operator=(const extendedLduMatrix&);
// Helper functions
//- Clear all demand driven data - helper function
void clearOut();
public: