Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes | Private Member Functions | Static Private Attributes | List of all members
Nektar::MultiRegions::PreconditionerDiagonal Class Reference

#include <PreconditionerDiagonal.h>

Inheritance diagram for Nektar::MultiRegions::PreconditionerDiagonal:
Inheritance graph
[legend]
Collaboration diagram for Nektar::MultiRegions::PreconditionerDiagonal:
Collaboration graph
[legend]

Public Member Functions

 PreconditionerDiagonal (const boost::shared_ptr< GlobalLinSys > &plinsys, const AssemblyMapSharedPtr &pLocToGloMap)
virtual ~PreconditionerDiagonal ()
- Public Member Functions inherited from Nektar::MultiRegions::Preconditioner
 Preconditioner (const boost::shared_ptr< GlobalLinSys > &plinsys, const AssemblyMapSharedPtr &pLocToGloMap)
virtual ~Preconditioner ()
void DoPreconditioner (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
void DoPreconditionerWithNonVertOutput (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const Array< OneD, NekDouble > &pNonVertOutput, Array< OneD, NekDouble > &pVertForce=NullNekDouble1DArray)
void DoTransformToLowEnergy (Array< OneD, NekDouble > &pInOut, int offset)
void DoTransformToLowEnergy (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
void DoTransformFromLowEnergy (Array< OneD, NekDouble > &pInOut)
void DoMultiplybyInverseTransformationMatrix (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
void DoMultiplybyInverseTransposedTransformationMatrix (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
void BuildPreconditioner ()
void InitObject ()
Array< OneD, NekDoubleAssembleStaticCondGlobalDiagonals ()
 Performs global assembly of diagonal entries to global Schur complement matrix.
const DNekScalBlkMatSharedPtrGetBlockTransformedSchurCompl () const
const DNekScalBlkMatSharedPtrGetBlockCMatrix () const
const DNekScalBlkMatSharedPtrGetBlockInvDMatrix () const
const DNekScalBlkMatSharedPtrGetBlockSchurCompl () const
const DNekScalBlkMatSharedPtrGetBlockTransformationMatrix () const
const DNekScalBlkMatSharedPtrGetBlockTransposedTransformationMatrix () const
DNekScalMatSharedPtr TransformedSchurCompl (int offset, const boost::shared_ptr< DNekScalMat > &loc_mat)

Static Public Member Functions

static PreconditionerSharedPtr create (const boost::shared_ptr< GlobalLinSys > &plinsys, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
 Creates an instance of this class.

Static Public Attributes

static std::string className
 Name of class.

Protected Attributes

Array< OneD, NekDoublem_diagonals
PreconditionerType m_preconType
- Protected Attributes inherited from Nektar::MultiRegions::Preconditioner
const boost::weak_ptr
< GlobalLinSys
m_linsys
PreconditionerType m_preconType
DNekMatSharedPtr m_preconditioner
boost::shared_ptr< AssemblyMapm_locToGloMap
LibUtilities::CommSharedPtr m_comm

Private Member Functions

void DiagonalPreconditionerSum (void)
void StaticCondDiagonalPreconditionerSum (void)
virtual void v_InitObject ()
virtual void v_DoPreconditioner (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
virtual void v_BuildPreconditioner ()

Static Private Attributes

static std::string lookupIds []
static std::string def

Additional Inherited Members

- Protected Member Functions inherited from Nektar::MultiRegions::Preconditioner
virtual DNekScalMatSharedPtr v_TransformedSchurCompl (int offset, const boost::shared_ptr< DNekScalMat > &loc_mat)
 Get block elemental transposed transformation matrix $\mathbf{R}^{T}$.

Detailed Description

Definition at line 50 of file PreconditionerDiagonal.h.

Constructor & Destructor Documentation

Nektar::MultiRegions::PreconditionerDiagonal::PreconditionerDiagonal ( const boost::shared_ptr< GlobalLinSys > &  plinsys,
const AssemblyMapSharedPtr pLocToGloMap 
)

Definition at line 61 of file PreconditionerDiagonal.cpp.

: Preconditioner(plinsys, pLocToGloMap),
m_preconType(pLocToGloMap->GetPreconType())
{
}
virtual Nektar::MultiRegions::PreconditionerDiagonal::~PreconditionerDiagonal ( )
inlinevirtual

Definition at line 73 of file PreconditionerDiagonal.h.

{}

Member Function Documentation

static PreconditionerSharedPtr Nektar::MultiRegions::PreconditionerDiagonal::create ( const boost::shared_ptr< GlobalLinSys > &  plinsys,
const boost::shared_ptr< AssemblyMap > &  pLocToGloMap 
)
inlinestatic

Creates an instance of this class.

Definition at line 54 of file PreconditionerDiagonal.h.

{
p->InitObject();
return p;
}
void Nektar::MultiRegions::PreconditionerDiagonal::DiagonalPreconditionerSum ( void  )
private

Diagonal preconditioner computed by summing the relevant elements of the local matrix system.

Definition at line 96 of file PreconditionerDiagonal.cpp.

References m_diagonals, Nektar::MultiRegions::Preconditioner::m_linsys, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and Vmath::Sdiv().

Referenced by v_BuildPreconditioner().

{
boost::shared_ptr<MultiRegions::ExpList> expList =
((m_linsys.lock())->GetLocMat()).lock();
int i,j,n,cnt,gid1,gid2;
NekDouble sign1,sign2,value;
int nGlobal = m_locToGloMap->GetNumGlobalCoeffs();
int nDir = m_locToGloMap->GetNumGlobalDirBndCoeffs();
int nInt = nGlobal - nDir;
// fill global matrix
Array<OneD, NekDouble> vOutput(nGlobal,0.0);
int loc_row;
int nElmt = expList->GetNumElmts();
for(n = cnt = 0; n < nElmt; ++n)
{
loc_mat = (m_linsys.lock())->GetBlock(expList->GetOffset_Elmt_Id(n));
loc_row = loc_mat->GetRows();
for(i = 0; i < loc_row; ++i)
{
gid1 = m_locToGloMap->GetLocalToGlobalMap(cnt + i) - nDir;
sign1 = m_locToGloMap->GetLocalToGlobalSign(cnt + i);
if(gid1 >= 0)
{
for(j = 0; j < loc_row; ++j)
{
gid2 = m_locToGloMap->GetLocalToGlobalMap(cnt + j)
- nDir;
sign2 = m_locToGloMap->GetLocalToGlobalSign(cnt + j);
if(gid2 == gid1)
{
// When global matrix is symmetric,
// only add the value for the upper
// triangular part in order to avoid
// entries to be entered twice
value = vOutput[gid1 + nDir]
+ sign1*sign2*(*loc_mat)(i,j);
vOutput[gid1 + nDir] = value;
}
}
}
}
cnt += loc_row;
}
// Assemble diagonal contributions across processes
m_locToGloMap->UniversalAssemble(vOutput);
m_diagonals = Array<OneD, NekDouble> (nInt);
Vmath::Sdiv(nInt, 1.0, &vOutput[nDir], 1, &m_diagonals[0], 1);
}
void Nektar::MultiRegions::PreconditionerDiagonal::StaticCondDiagonalPreconditionerSum ( void  )
private
Diagonal preconditioner defined as the inverse of the main

diagonal of the Schur complement

Definition at line 159 of file PreconditionerDiagonal.cpp.

References Nektar::MultiRegions::Preconditioner::AssembleStaticCondGlobalDiagonals(), m_diagonals, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and Vmath::Sdiv().

Referenced by v_BuildPreconditioner().

{
int nGlobalBnd = m_locToGloMap->GetNumGlobalBndCoeffs();
int nDirBnd = m_locToGloMap->GetNumGlobalDirBndCoeffs();
int rows = nGlobalBnd - nDirBnd;
Array<OneD, NekDouble> vOutput(nGlobalBnd,0.0);
// Extract diagonal contributions
Array<OneD, NekDouble> diagonals = AssembleStaticCondGlobalDiagonals();
for (unsigned int i = 0; i < rows; ++i)
{
vOutput[nDirBnd + i] = diagonals[i];
}
// Assemble diagonal contributions across processes
m_locToGloMap->UniversalAssembleBnd(vOutput);
m_diagonals = Array<OneD, NekDouble> (rows);
Vmath::Sdiv(rows, 1.0, &vOutput[nDirBnd], 1, &m_diagonals[0], 1);
}
void Nektar::MultiRegions::PreconditionerDiagonal::v_BuildPreconditioner ( )
privatevirtual
void Nektar::MultiRegions::PreconditionerDiagonal::v_DoPreconditioner ( const Array< OneD, NekDouble > &  pInput,
Array< OneD, NekDouble > &  pOutput 
)
privatevirtual

Definition at line 184 of file PreconditionerDiagonal.cpp.

References Nektar::MultiRegions::eIterativeFull, m_diagonals, Nektar::MultiRegions::Preconditioner::m_locToGloMap, and Vmath::Vmul().

{
GlobalSysSolnType solvertype =
m_locToGloMap->GetGlobalSysSolnType();
int nGlobal = solvertype == eIterativeFull ?
m_locToGloMap->GetNumGlobalCoeffs() :
m_locToGloMap->GetNumGlobalBndCoeffs();
int nDir = m_locToGloMap->GetNumGlobalDirBndCoeffs();
int nNonDir = nGlobal-nDir;
Vmath::Vmul(nNonDir, &pInput[0], 1, &m_diagonals[0], 1, &pOutput[0], 1);
}
void Nektar::MultiRegions::PreconditionerDiagonal::v_InitObject ( )
privatevirtual

Definition at line 69 of file PreconditionerDiagonal.cpp.

{
}

Member Data Documentation

string Nektar::MultiRegions::PreconditionerDiagonal::className
static
Initial value:
"Diagonal",
"Diagonal Preconditioning")

Name of class.

Registers the class with the Factory.

Definition at line 65 of file PreconditionerDiagonal.h.

std::string Nektar::MultiRegions::PreconditionerDiagonal::def
staticprivate

Definition at line 96 of file PreconditionerDiagonal.h.

std::string Nektar::MultiRegions::PreconditionerDiagonal::lookupIds[]
staticprivate

Definition at line 95 of file PreconditionerDiagonal.h.

Array<OneD, NekDouble> Nektar::MultiRegions::PreconditionerDiagonal::m_diagonals
protected
PreconditionerType Nektar::MultiRegions::PreconditionerDiagonal::m_preconType
protected

Definition at line 79 of file PreconditionerDiagonal.h.