Bug fix: addressing memory leak in Block AMG
This commit is contained in:
parent
9fe6dc62d2
commit
7f3174ef59
13 changed files with 95 additions and 94 deletions
|
@ -34,11 +34,12 @@ Author
|
||||||
|
|
||||||
#include "BlockMatrixAgglomeration.H"
|
#include "BlockMatrixAgglomeration.H"
|
||||||
#include "boolList.H"
|
#include "boolList.H"
|
||||||
|
#include "tolerancesSwitch.H"
|
||||||
#include "coeffFields.H"
|
#include "coeffFields.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "BlockGAMGInterfaceField.H"
|
#include "BlockGAMGInterfaceField.H"
|
||||||
#include "processorLduInterfaceField.H"
|
#include "processorLduInterfaceField.H"
|
||||||
#include "tolerancesSwitch.H"
|
#include "coarseBlockAmgLevel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -397,14 +398,14 @@ Foam::BlockMatrixAgglomeration<Type>::~BlockMatrixAgglomeration()
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::autoPtr<Foam::BlockLduMatrix<Type> >
|
Foam::autoPtr<Foam::BlockAmgLevel<Type> >
|
||||||
Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
{
|
{
|
||||||
if (!coarsen_)
|
if (!coarsen_)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<amgMatrix> "
|
"autoPtr<BlockAmgLevel<Type> > "
|
||||||
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
||||||
) << "Requesting coarse matrix when it cannot be created"
|
) << "Requesting coarse matrix when it cannot be created"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -434,8 +435,8 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<BlockLduMatrix<Type> > BlockMatrixAgglomeration<Type>::"
|
"autoPtr<BlockLduMatrix<Type> >"
|
||||||
"restrictMatrix() const"
|
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
||||||
) << "agglomIndex array does not correspond to fine level. " << endl
|
) << "agglomIndex array does not correspond to fine level. " << endl
|
||||||
<< " Size: " << agglomIndex_.size()
|
<< " Size: " << agglomIndex_.size()
|
||||||
<< " number of equations: " << matrix_.lduAddr().size()
|
<< " number of equations: " << matrix_.lduAddr().size()
|
||||||
|
@ -609,23 +610,23 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
const_cast<BlockLduMatrix<Type>&>(matrix_).interfaces();
|
const_cast<BlockLduMatrix<Type>&>(matrix_).interfaces();
|
||||||
|
|
||||||
// Set the coarse interfaces and coefficients
|
// Set the coarse interfaces and coefficients
|
||||||
lduInterfacePtrsList* coarseInterfacesPtr =
|
lduInterfacePtrsList coarseInterfaces(interfaceSize);
|
||||||
new lduInterfacePtrsList(interfaceSize);
|
|
||||||
lduInterfacePtrsList& coarseInterfaces = *coarseInterfacesPtr;
|
|
||||||
|
|
||||||
labelListList coarseInterfaceAddr(interfaceSize);
|
labelListList coarseInterfaceAddr(interfaceSize);
|
||||||
|
|
||||||
// Add the coarse level
|
// Add the coarse level
|
||||||
|
|
||||||
// Set the coarse ldu addressing onto the list
|
// Set the coarse ldu addressing onto the list
|
||||||
lduPrimitiveMesh* coarseAddrPtr =
|
autoPtr<lduPrimitiveMesh> coarseAddrPtr
|
||||||
|
(
|
||||||
new lduPrimitiveMesh
|
new lduPrimitiveMesh
|
||||||
(
|
(
|
||||||
nCoarseEqns_,
|
nCoarseEqns_,
|
||||||
coarseOwner,
|
coarseOwner,
|
||||||
coarseNeighbour,
|
coarseNeighbour,
|
||||||
true
|
true
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Initialise transfer of restrict addressing on the interface
|
// Initialise transfer of restrict addressing on the interface
|
||||||
forAll (interfaceFields, intI)
|
forAll (interfaceFields, intI)
|
||||||
|
@ -679,7 +680,7 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
intI,
|
intI,
|
||||||
GAMGInterface::New
|
GAMGInterface::New
|
||||||
(
|
(
|
||||||
*coarseAddrPtr,
|
coarseAddrPtr(),
|
||||||
fineInterface,
|
fineInterface,
|
||||||
fineInterface.interfaceInternalField(agglomIndex_),
|
fineInterface.interfaceInternalField(agglomIndex_),
|
||||||
fineInterfaceAddr[intI]
|
fineInterfaceAddr[intI]
|
||||||
|
@ -702,15 +703,17 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
// Add interfaces
|
// Add interfaces
|
||||||
coarseAddrPtr->addInterfaces
|
coarseAddrPtr->addInterfaces
|
||||||
(
|
(
|
||||||
*coarseInterfacesPtr,
|
coarseInterfaces,
|
||||||
coarseInterfaceAddr,
|
coarseInterfaceAddr,
|
||||||
matrix_.patchSchedule()
|
matrix_.patchSchedule()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set the coarse level matrix
|
// Set the coarse level matrix
|
||||||
BlockLduMatrix<Type>* coarseMatrixPtr =
|
autoPtr<BlockLduMatrix<Type> > coarseMatrixPtr
|
||||||
new BlockLduMatrix<Type>(*coarseAddrPtr);
|
(
|
||||||
BlockLduMatrix<Type>& coarseMatrix = *coarseMatrixPtr;
|
new BlockLduMatrix<Type>(coarseAddrPtr())
|
||||||
|
);
|
||||||
|
BlockLduMatrix<Type>& coarseMatrix = coarseMatrixPtr();
|
||||||
|
|
||||||
typename BlockLduInterfaceFieldPtrsList<Type>::Type&
|
typename BlockLduInterfaceFieldPtrsList<Type>::Type&
|
||||||
coarseInterfaceFieldsTransfer =
|
coarseInterfaceFieldsTransfer =
|
||||||
|
@ -818,7 +821,7 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<amgMatrix>"
|
"autoPtr<BlockAmgLevel<Type> >"
|
||||||
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
||||||
) << "Matrix diagonal of square type and upper of "
|
) << "Matrix diagonal of square type and upper of "
|
||||||
<< "linear type is not implemented"
|
<< "linear type is not implemented"
|
||||||
|
@ -828,7 +831,7 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<amgMatrix>"
|
"autoPtr<BlockAmgLevel<Type> >"
|
||||||
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
||||||
) << "Matrix diagonal of square type and upper of "
|
) << "Matrix diagonal of square type and upper of "
|
||||||
<< "scalar type is not implemented"
|
<< "scalar type is not implemented"
|
||||||
|
@ -839,7 +842,7 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<amgMatrix>"
|
"autoPtr<BlockAmgLevel<Type> >"
|
||||||
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
||||||
) << "Matrix diagonal of linear type not implemented"
|
) << "Matrix diagonal of linear type not implemented"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -848,7 +851,7 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<amgMatrix>"
|
"autoPtr<BlockAmgLevel<Type> >"
|
||||||
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
||||||
) << "Matrix diagonal of scalar type not implemented"
|
) << "Matrix diagonal of scalar type not implemented"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
@ -900,7 +903,7 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<amgMatrix>"
|
"autoPtr<BlockAmgLevel<Type> >"
|
||||||
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
||||||
) << "Matrix diagonal of square type and upper of "
|
) << "Matrix diagonal of square type and upper of "
|
||||||
<< "linear type is not implemented"
|
<< "linear type is not implemented"
|
||||||
|
@ -910,7 +913,7 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<amgMatrix>"
|
"autoPtr<BlockAmgLevel<Type> >"
|
||||||
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
||||||
) << "Matrix diagonal of square type and upper of "
|
) << "Matrix diagonal of square type and upper of "
|
||||||
<< "scalar type is not implemented"
|
<< "scalar type is not implemented"
|
||||||
|
@ -922,8 +925,8 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<amgMatrix> BlockMatrixAgglomeration<Type>::"
|
"autoPtr<BlockAmgLevel<Type> > "
|
||||||
"restrictMatrix() const"
|
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
||||||
) << "Matrix diagonal of linear type not implemented"
|
) << "Matrix diagonal of linear type not implemented"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
@ -931,14 +934,25 @@ Foam::BlockMatrixAgglomeration<Type>::restrictMatrix() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<amgMatrix> BlockMatrixAgglomeration<Type>::"
|
"autoPtr<BlockAmgLevel<Type> > "
|
||||||
"restrictMatrix() const"
|
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
||||||
) << "Matrix diagonal of scalar type not implemented"
|
) << "Matrix diagonal of scalar type not implemented"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<BlockLduMatrix<Type> >(coarseMatrixPtr);
|
return autoPtr<BlockAmgLevel<Type> >
|
||||||
|
(
|
||||||
|
new coarseBlockAmgLevel<Type>
|
||||||
|
(
|
||||||
|
coarseAddrPtr,
|
||||||
|
coarseMatrixPtr,
|
||||||
|
this->dict(),
|
||||||
|
this->type(),
|
||||||
|
this->groupSize(),
|
||||||
|
this->minCoarseEqns()
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Restrict matrix
|
//- Restrict matrix
|
||||||
virtual autoPtr<BlockLduMatrix<Type> > restrictMatrix() const;
|
virtual autoPtr<BlockAmgLevel<Type> > restrictMatrix() const;
|
||||||
|
|
||||||
//- Restrict residual
|
//- Restrict residual
|
||||||
virtual void restrictResidual
|
virtual void restrictResidual
|
||||||
|
|
|
@ -31,7 +31,8 @@ Class
|
||||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::autoPtr<Foam::BlockMatrixCoarsening<Type> > Foam::BlockMatrixCoarsening<Type>::New
|
Foam::autoPtr<Foam::BlockMatrixCoarsening<Type> >
|
||||||
|
Foam::BlockMatrixCoarsening<Type>::New
|
||||||
(
|
(
|
||||||
const word& coarseningType,
|
const word& coarseningType,
|
||||||
const BlockLduMatrix<Type>& matrix,
|
const BlockLduMatrix<Type>& matrix,
|
||||||
|
@ -47,7 +48,8 @@ Foam::autoPtr<Foam::BlockMatrixCoarsening<Type> > Foam::BlockMatrixCoarsening<Ty
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<BlockMatrixCoarsening<Type> > BlockMatrixCoarsening<Type>::New\n"
|
"autoPtr<BlockMatrixCoarsening<Type> > "
|
||||||
|
"BlockMatrixCoarsening<Type>::New\n"
|
||||||
"(\n"
|
"(\n"
|
||||||
" const word& coarseningType,\n"
|
" const word& coarseningType,\n"
|
||||||
" const lduMatrix& matrix,\n"
|
" const lduMatrix& matrix,\n"
|
||||||
|
|
|
@ -91,29 +91,25 @@ class BlockMatrixCoarsening
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("BlockMatrixCoarsening");
|
TypeName("BlockMatrixCoarsening");
|
||||||
|
|
||||||
// KRJ: 2012-12-15: Replaced by the above function
|
|
||||||
//- Runtime type information
|
|
||||||
//virtual const word& type() const = 0;
|
|
||||||
|
|
||||||
|
|
||||||
// Declare run-time constructor selection tables
|
// Declare run-time constructor selection tables
|
||||||
|
|
||||||
declareRunTimeSelectionTable
|
declareRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
autoPtr,
|
||||||
|
BlockMatrixCoarsening,
|
||||||
|
matrix,
|
||||||
(
|
(
|
||||||
autoPtr,
|
const BlockLduMatrix<Type>& matrix,
|
||||||
BlockMatrixCoarsening,
|
const dictionary& dict,
|
||||||
matrix,
|
const label groupSize,
|
||||||
(
|
const label minCoarseEqns
|
||||||
const BlockLduMatrix<Type>& matrix,
|
),
|
||||||
const dictionary& dict,
|
(matrix, dict, groupSize, minCoarseEqns)
|
||||||
const label groupSize,
|
);
|
||||||
const label minCoarseEqns
|
|
||||||
),
|
|
||||||
(matrix, dict, groupSize, minCoarseEqns)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
|
@ -154,6 +150,12 @@ public:
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return access to dictionary
|
||||||
|
const dictionary& dict() const
|
||||||
|
{
|
||||||
|
return dict_;
|
||||||
|
}
|
||||||
|
|
||||||
//- Return group size
|
//- Return group size
|
||||||
label groupSize() const
|
label groupSize() const
|
||||||
{
|
{
|
||||||
|
@ -170,7 +172,7 @@ public:
|
||||||
virtual bool coarsen() const = 0;
|
virtual bool coarsen() const = 0;
|
||||||
|
|
||||||
//- Restrict matrix
|
//- Restrict matrix
|
||||||
virtual autoPtr<BlockLduMatrix<Type> > restrictMatrix
|
virtual autoPtr<BlockAmgLevel<Type> > restrictMatrix
|
||||||
() const = 0;
|
() const = 0;
|
||||||
|
|
||||||
//- Restrict residual
|
//- Restrict residual
|
||||||
|
|
|
@ -25,6 +25,7 @@ License
|
||||||
|
|
||||||
#include "blockMatrixAgglomerations.H"
|
#include "blockMatrixAgglomerations.H"
|
||||||
#include "blockMatrixCoarsenings.H"
|
#include "blockMatrixCoarsenings.H"
|
||||||
|
#include "coarseBlockAmgLevel.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
|
@ -58,18 +58,18 @@ namespace Foam
|
||||||
//- Restrict matrix
|
//- Restrict matrix
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline autoPtr<BlockLduMatrix<scalar> >
|
inline autoPtr<BlockAmgLevel<scalar> >
|
||||||
BlockMatrixAgglomeration<scalar>::restrictMatrix() const
|
BlockMatrixAgglomeration<scalar>::restrictMatrix() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<BlockLduMatrix<scalar> > "
|
"autoPtr<BlockAmgLevel<scalar> > "
|
||||||
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
"BlockMatrixAgglomeration<Type>::restrictMatrix() const"
|
||||||
) << "Function not implemented for Type=scalar. " << endl
|
) << "Function not implemented for Type=scalar. " << endl
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
|
||||||
// Dummy return to keep compiler happy
|
// Dummy return to keep compiler happy
|
||||||
return autoPtr<BlockLduMatrix<scalar> >(NULL);
|
return autoPtr<BlockAmgLevel<scalar> >(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,18 +52,20 @@ namespace Foam
|
||||||
//- Restrict matrix
|
//- Restrict matrix
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline autoPtr<BlockLduMatrix<tensor> > BlockMatrixAgglomeration<tensor>::restrictMatrix
|
inline autoPtr<BlockAmgLevel<tensor> >
|
||||||
|
BlockMatrixAgglomeration<tensor>::restrictMatrix
|
||||||
() const
|
() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<BlockLduMatrix<tensor> > BlockMatrixAgglomeration<Type>::"
|
"autoPtr<BlockAmgLevel<tensor> > "
|
||||||
|
"BlockMatrixAgglomeration<Type>::"
|
||||||
"restrictMatrix() const"
|
"restrictMatrix() const"
|
||||||
) << "Function not implemented for Type=tensor. " << endl
|
) << "Function not implemented for Type=tensor. " << endl
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
|
||||||
// Dummy return to keep compiler happy
|
// Dummy return to keep compiler happy
|
||||||
return autoPtr<BlockLduMatrix<tensor> >(NULL);
|
return autoPtr<BlockAmgLevel<tensor> >(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,25 +46,25 @@ namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class BlockMatrixAgglomeration Declaration
|
Class BlockMatrixAgglomeration Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
//- Restrict matrix
|
//- Restrict matrix
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline autoPtr<BlockLduMatrix<vector> >
|
inline autoPtr<BlockAmgLevel<vector> >
|
||||||
BlockMatrixAgglomeration<vector>::restrictMatrix
|
BlockMatrixAgglomeration<vector>::restrictMatrix
|
||||||
() const
|
() const
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"autoPtr<BlockLduMatrix<vector> > BlockMatrixAgglomeration<Type>::"
|
"autoPtr<BlockAmgLevel<vector> > BlockMatrixAgglomeration<Type>::"
|
||||||
"restrictMatrix() const"
|
"restrictMatrix() const"
|
||||||
) << "Function not implemented for Type=vector. " << endl
|
) << "Function not implemented for Type=vector. " << endl
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
|
|
||||||
// Dummy return to keep compiler happy
|
// Dummy return to keep compiler happy
|
||||||
return autoPtr<BlockLduMatrix<vector> >(NULL);
|
return autoPtr<BlockAmgLevel<vector> >(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,14 +47,15 @@ Author
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::coarseBlockAmgLevel<Type>::coarseBlockAmgLevel
|
Foam::coarseBlockAmgLevel<Type>::coarseBlockAmgLevel
|
||||||
(
|
(
|
||||||
|
autoPtr<lduPrimitiveMesh> addrPtr,
|
||||||
autoPtr<BlockLduMatrix<Type> > matrixPtr,
|
autoPtr<BlockLduMatrix<Type> > matrixPtr,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& coarseningType,
|
const word& coarseningType,
|
||||||
const label groupSize,
|
const label groupSize,
|
||||||
const label minCoarseEqns,
|
const label minCoarseEqns
|
||||||
const word& smootherType
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
addrPtr_(addrPtr),
|
||||||
matrixPtr_(matrixPtr),
|
matrixPtr_(matrixPtr),
|
||||||
x_(matrixPtr_->diag().size(),pTraits<Type>::zero),
|
x_(matrixPtr_->diag().size(),pTraits<Type>::zero),
|
||||||
b_(matrixPtr_->diag().size(),pTraits<Type>::zero),
|
b_(matrixPtr_->diag().size(),pTraits<Type>::zero),
|
||||||
|
@ -388,23 +389,12 @@ Foam::coarseBlockAmgLevel<Type>::makeNextLevel() const
|
||||||
{
|
{
|
||||||
if (coarseningPtr_->coarsen())
|
if (coarseningPtr_->coarsen())
|
||||||
{
|
{
|
||||||
return autoPtr<Foam::BlockAmgLevel<Type> >
|
return coarseningPtr_->restrictMatrix();
|
||||||
(
|
|
||||||
new coarseBlockAmgLevel
|
|
||||||
(
|
|
||||||
coarseningPtr_->restrictMatrix(),
|
|
||||||
dict(),
|
|
||||||
coarseningPtr_->type(),
|
|
||||||
coarseningPtr_->groupSize(),
|
|
||||||
coarseningPtr_->minCoarseEqns(),
|
|
||||||
smootherPtr_->type()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Final level: cannot coarsen
|
// Final level: cannot coarsen
|
||||||
return autoPtr<Foam::BlockAmgLevel<Type> >();
|
return autoPtr<BlockAmgLevel<Type> >();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ SourceFiles
|
||||||
#include "BlockAmgLevel.H"
|
#include "BlockAmgLevel.H"
|
||||||
#include "BlockLduSmoother.H"
|
#include "BlockLduSmoother.H"
|
||||||
#include "BlockLduMatrix.H"
|
#include "BlockLduMatrix.H"
|
||||||
|
#include "lduPrimitiveMesh.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -58,6 +59,9 @@ class coarseBlockAmgLevel
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
//- Matrix addressing object. This also contains coupling interfaces
|
||||||
|
autoPtr<lduPrimitiveMesh> addrPtr_;
|
||||||
|
|
||||||
//- Matrix
|
//- Matrix
|
||||||
autoPtr<BlockLduMatrix<Type> > matrixPtr_;
|
autoPtr<BlockLduMatrix<Type> > matrixPtr_;
|
||||||
|
|
||||||
|
@ -100,12 +104,12 @@ public:
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
coarseBlockAmgLevel
|
coarseBlockAmgLevel
|
||||||
(
|
(
|
||||||
|
autoPtr<lduPrimitiveMesh> addrPtr,
|
||||||
autoPtr<BlockLduMatrix<Type> > matrixPtr,
|
autoPtr<BlockLduMatrix<Type> > matrixPtr,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& coarseningType,
|
const word& coarseningType,
|
||||||
const label groupSize,
|
const label groupSize,
|
||||||
const label minCoarseEqns,
|
const label minCoarseEqns
|
||||||
const word& smootherType
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,7 @@ Foam::fineBlockAmgLevel<Type>::fineBlockAmgLevel
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& coarseningType,
|
const word& coarseningType,
|
||||||
const label groupSize,
|
const label groupSize,
|
||||||
const label minCoarseEqns,
|
const label minCoarseEqns
|
||||||
const word& smootherType
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
matrix_(matrix),
|
matrix_(matrix),
|
||||||
|
@ -314,18 +313,7 @@ Foam::fineBlockAmgLevel<Type>::makeNextLevel() const
|
||||||
{
|
{
|
||||||
if (coarseningPtr_->coarsen())
|
if (coarseningPtr_->coarsen())
|
||||||
{
|
{
|
||||||
return autoPtr<Foam::BlockAmgLevel<Type> >
|
return coarseningPtr_->restrictMatrix();
|
||||||
(
|
|
||||||
new coarseBlockAmgLevel<Type>
|
|
||||||
(
|
|
||||||
coarseningPtr_->restrictMatrix(),
|
|
||||||
dict(),
|
|
||||||
coarseningPtr_->type(),
|
|
||||||
coarseningPtr_->groupSize(),
|
|
||||||
coarseningPtr_->minCoarseEqns(),
|
|
||||||
smootherPtr_->type()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -108,8 +108,7 @@ public:
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& coarseningType,
|
const word& coarseningType,
|
||||||
const label groupSize,
|
const label groupSize,
|
||||||
const label minCoarseEqns,
|
const label minCoarseEqns
|
||||||
const word& smootherType
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,7 @@ Foam::BlockAmgPrecon<Type>::BlockAmgPrecon
|
||||||
dict,
|
dict,
|
||||||
dict.lookup("coarseningType"),
|
dict.lookup("coarseningType"),
|
||||||
readLabel(dict.lookup("groupSize")),
|
readLabel(dict.lookup("groupSize")),
|
||||||
readLabel(dict.lookup("minCoarseEqns")),
|
readLabel(dict.lookup("minCoarseEqns"))
|
||||||
dict.lookup("smoother")
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Reference in a new issue