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

A global linear system. More...

#include <GlobalLinSysDirectStaticCond.h>

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

Public Member Functions

 GlobalLinSysDirectStaticCond (const GlobalLinSysKey &mkey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &locToGloMap)
 Constructor for full direct matrix solve.
 GlobalLinSysDirectStaticCond (const GlobalLinSysKey &mkey, const boost::weak_ptr< ExpList > &pExpList, const DNekScalBlkMatSharedPtr pSchurCompl, const DNekScalBlkMatSharedPtr pBinvD, const DNekScalBlkMatSharedPtr pC, const DNekScalBlkMatSharedPtr pInvD, const boost::shared_ptr< AssemblyMap > &locToGloMap)
 Constructor for full direct matrix solve.
virtual ~GlobalLinSysDirectStaticCond ()
- Public Member Functions inherited from Nektar::MultiRegions::GlobalLinSysDirect
 GlobalLinSysDirect (const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExp, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
 Constructor for full direct matrix solve.
virtual ~GlobalLinSysDirect ()
- Public Member Functions inherited from Nektar::MultiRegions::GlobalLinSys
 GlobalLinSys (const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
 Constructor for full direct matrix solve.
virtual ~GlobalLinSys ()
const GlobalLinSysKeyGetKey (void) const
 Returns the key associated with the system.
const boost::weak_ptr< ExpList > & GetLocMat (void) const
void InitObject ()
void Initialise (const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
void Solve (const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &out, const AssemblyMapSharedPtr &locToGloMap, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
 Solve the linear system for given input and output vectors using a specified local to global map.
boost::shared_ptr< GlobalLinSysGetSharedThisPtr ()
 Returns a shared pointer to the current object.
int GetNumBlocks ()
DNekScalMatSharedPtr GetBlock (unsigned int n)
DNekScalBlkMatSharedPtr GetStaticCondBlock (unsigned int n)
void DropStaticCondBlock (unsigned int n)
void SolveLinearSystem (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir=0)
 Solve the linear system for given input and output vectors.
- Public Member Functions inherited from Nektar::MultiRegions::GlobalLinSysStaticCond
 GlobalLinSysStaticCond (const GlobalLinSysKey &mkey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &locToGloMap)
 Constructor for full direct matrix solve.
virtual ~GlobalLinSysStaticCond ()

Static Public Member Functions

static GlobalLinSysSharedPtr create (const GlobalLinSysKey &pLinSysKey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
 Creates an instance of this class.

Static Public Attributes

static std::string className
 Name of class.
static std::string className2

Protected Member Functions

virtual void v_AssembleSchurComplement (boost::shared_ptr< AssemblyMap > pLocToGloMap)
virtual
GlobalLinSysStaticCondSharedPtr 
v_Recurse (const GlobalLinSysKey &mkey, const boost::weak_ptr< ExpList > &pExpList, const DNekScalBlkMatSharedPtr pSchurCompl, const DNekScalBlkMatSharedPtr pBinvD, const DNekScalBlkMatSharedPtr pC, const DNekScalBlkMatSharedPtr pInvD, const boost::shared_ptr< AssemblyMap > &l2gMap)
- Protected Member Functions inherited from Nektar::MultiRegions::GlobalLinSysDirect
virtual void v_SolveLinearSystem (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir=0)
 Solve the linear system for given input and output vectors.
- Protected Member Functions inherited from Nektar::MultiRegions::GlobalLinSys
virtual DNekScalMatSharedPtr v_GetBlock (unsigned int n)
 Retrieves the block matrix from n-th expansion using the matrix key provided by the m_linSysKey.
virtual DNekScalBlkMatSharedPtr v_GetStaticCondBlock (unsigned int n)
 Retrieves a the static condensation block matrices from n-th expansion using the matrix key provided by the m_linSysKey.
virtual void v_DropStaticCondBlock (unsigned int n)
 Releases the static condensation block matrices from NekManager of n-th expansion using the matrix key provided by the m_linSysKey.
- Protected Member Functions inherited from Nektar::MultiRegions::GlobalLinSysStaticCond
virtual DNekScalBlkMatSharedPtr v_PreSolve (int scLevel, NekVector< NekDouble > &F_GlobBnd)
virtual void v_BasisTransform (Array< OneD, NekDouble > &pInOut, int offset)
virtual void v_BasisInvTransform (Array< OneD, NekDouble > &pInOut)
virtual int v_GetNumBlocks ()
 Get the number of blocks in this system.
virtual void v_Solve (const Array< OneD, const NekDouble > &in, Array< OneD, NekDouble > &out, const AssemblyMapSharedPtr &locToGloMap, const Array< OneD, const NekDouble > &dirForcing=NullNekDouble1DArray)
 Solve the linear system for given input and output vectors using a specified local to global map.
virtual void v_InitObject ()
virtual void v_Initialise (const boost::shared_ptr< AssemblyMap > &locToGloMap)
 Initialise this object.
void SetupTopLevel (const boost::shared_ptr< AssemblyMap > &locToGloMap)
 Set up the storage for the Schur complement or the top level of the multi-level Schur complement.
void ConstructNextLevelCondensedSystem (const boost::shared_ptr< AssemblyMap > &locToGloMap)

Private Member Functions

MatrixStorage DetermineMatrixStorage (const boost::shared_ptr< AssemblyMap > &locToGloMap)
 Matrix Storage type for known matrices.

Additional Inherited Members

- Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSysDirect
DNekLinSysSharedPtr m_linSys
 Basic linear system object.
- Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSysStaticCond
GlobalLinSysStaticCondSharedPtr m_recursiveSchurCompl
 Schur complement for Direct Static Condensation.
DNekScalBlkMatSharedPtr m_schurCompl
 Block Schur complement matrix.
DNekScalBlkMatSharedPtr m_BinvD
 Block $ BD^{-1} $ matrix.
DNekScalBlkMatSharedPtr m_C
 Block $ C $ matrix.
DNekScalBlkMatSharedPtr m_invD
 Block $ D^{-1} $ matrix.
boost::shared_ptr< AssemblyMapm_locToGloMap
 Local to global map.
Array< OneD, NekDoublem_wsp
 Workspace array for matrix multiplication.

Detailed Description

A global linear system.

Definition at line 54 of file GlobalLinSysDirectStaticCond.h.

Constructor & Destructor Documentation

Nektar::MultiRegions::GlobalLinSysDirectStaticCond::GlobalLinSysDirectStaticCond ( const GlobalLinSysKey pKey,
const boost::weak_ptr< ExpList > &  pExpList,
const boost::shared_ptr< AssemblyMap > &  pLocToGloMap 
)

Constructor for full direct matrix solve.

For a matrix system of the form

\[ \left[ \begin{array}{cc} \boldsymbol{A} & \boldsymbol{B}\\ \boldsymbol{C} & \boldsymbol{D} \end{array} \right] \left[ \begin{array}{c} \boldsymbol{x_1}\\ \boldsymbol{x_2} \end{array}\right] = \left[ \begin{array}{c} \boldsymbol{y_1}\\ \boldsymbol{y_2} \end{array}\right], \]

where $\boldsymbol{D}$ and $(\boldsymbol{A-BD^{-1}C})$ are invertible, store and assemble a static condensation system, according to a given local to global mapping. m_linSys is constructed by AssembleSchurComplement().

Parameters
mKeyAssociated matrix key.
pLocMatSysLocalMatrixSystem
locToGloMapLocal to global mapping.

Definition at line 83 of file GlobalLinSysDirectStaticCond.cpp.

References ASSERTL1, Nektar::MultiRegions::eDirectMultiLevelStaticCond, Nektar::MultiRegions::eDirectStaticCond, and Nektar::MultiRegions::GlobalLinSysKey::GetGlobalSysSolnType().

: GlobalLinSys (pKey, pExpList, pLocToGloMap),
GlobalLinSysDirect (pKey, pExpList, pLocToGloMap),
GlobalLinSysStaticCond(pKey, pExpList, pLocToGloMap)
{
ASSERTL1((pKey.GetGlobalSysSolnType()==eDirectStaticCond)||
(pKey.GetGlobalSysSolnType()==eDirectMultiLevelStaticCond),
"This constructor is only valid when using static "
"condensation");
ASSERTL1(pKey.GetGlobalSysSolnType()
== pLocToGloMap->GetGlobalSysSolnType(),
"The local to global map is not set up for the requested "
"solution type");
}
Nektar::MultiRegions::GlobalLinSysDirectStaticCond::GlobalLinSysDirectStaticCond ( const GlobalLinSysKey mkey,
const boost::weak_ptr< ExpList > &  pExpList,
const DNekScalBlkMatSharedPtr  pSchurCompl,
const DNekScalBlkMatSharedPtr  pBinvD,
const DNekScalBlkMatSharedPtr  pC,
const DNekScalBlkMatSharedPtr  pInvD,
const boost::shared_ptr< AssemblyMap > &  locToGloMap 
)

Constructor for full direct matrix solve.

Definition at line 105 of file GlobalLinSysDirectStaticCond.cpp.

References Nektar::MultiRegions::GlobalLinSysStaticCond::m_BinvD, Nektar::MultiRegions::GlobalLinSysStaticCond::m_C, Nektar::MultiRegions::GlobalLinSysStaticCond::m_invD, and Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl.

: GlobalLinSys (pKey, pExpList, pLocToGloMap),
GlobalLinSysDirect (pKey, pExpList, pLocToGloMap),
GlobalLinSysStaticCond(pKey, pExpList, pLocToGloMap)
{
m_schurCompl = pSchurCompl;
m_BinvD = pBinvD;
m_C = pC;
m_invD = pInvD;
}
Nektar::MultiRegions::GlobalLinSysDirectStaticCond::~GlobalLinSysDirectStaticCond ( )
virtual

Definition at line 127 of file GlobalLinSysDirectStaticCond.cpp.

{
}

Member Function Documentation

static GlobalLinSysSharedPtr Nektar::MultiRegions::GlobalLinSysDirectStaticCond::create ( const GlobalLinSysKey pLinSysKey,
const boost::weak_ptr< ExpList > &  pExpList,
const boost::shared_ptr< AssemblyMap > &  pLocToGloMap 
)
inlinestatic

Creates an instance of this class.

Definition at line 59 of file GlobalLinSysDirectStaticCond.h.

{
::AllocateSharedPtr(pLinSysKey, pExpList, pLocToGloMap);
ret->InitObject();
return ret;
}
MatrixStorage Nektar::MultiRegions::GlobalLinSysDirectStaticCond::DetermineMatrixStorage ( const boost::shared_ptr< AssemblyMap > &  locToGloMap)
private

Matrix Storage type for known matrices.

Definition at line 133 of file GlobalLinSysDirectStaticCond.cpp.

References Nektar::eFULL, Nektar::StdRegions::eHelmholtz, Nektar::StdRegions::eHybridDGHelmBndLam, Nektar::StdRegions::eLaplacian, Nektar::StdRegions::eLinearAdvectionDiffusionReaction, Nektar::StdRegions::eLinearAdvectionReaction, Nektar::StdRegions::eMass, Nektar::ePOSITIVE_DEFINITE_SYMMETRIC, Nektar::ePOSITIVE_DEFINITE_SYMMETRIC_BANDED, Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), and Nektar::MultiRegions::GlobalLinSys::m_linSysKey.

Referenced by v_AssembleSchurComplement().

{
int nBndDofs = pLocToGloMap->GetNumGlobalBndCoeffs();
int NumDirBCs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
unsigned int rows = nBndDofs - NumDirBCs;
int bwidth = pLocToGloMap->GetBndSystemBandWidth();
MatrixStorage matStorage;
{
// case for all symmetric matices
{
if( (2*(bwidth+1)) < rows)
{
}
else
{
}
}
break;
default:
{
// Current inversion techniques do not seem to
// allow banded matrices to be used as a linear
// system
matStorage = eFULL;
}
break;
}
return matStorage;
}
void Nektar::MultiRegions::GlobalLinSysDirectStaticCond::v_AssembleSchurComplement ( boost::shared_ptr< AssemblyMap pLocToGloMap)
protectedvirtual

Assemble the schur complement matrix from the block matrices stored in #m_blkMatrices and the given local to global mapping information.

Parameters
locToGloMapLocal to global mapping information.

Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.

Definition at line 181 of file GlobalLinSysDirectStaticCond.cpp.

References DetermineMatrixStorage(), ErrorUtil::efatal, Nektar::eFULL, Nektar::ePOSITIVE_DEFINITE_SYMMETRIC, Nektar::ePOSITIVE_DEFINITE_SYMMETRIC_BANDED, Nektar::eWrapper, Nektar::MultiRegions::GlobalLinSysStaticCond::m_BinvD, Nektar::MultiRegions::GlobalLinSysStaticCond::m_C, Nektar::MultiRegions::GlobalLinSysStaticCond::m_invD, Nektar::MultiRegions::GlobalLinSysDirect::m_linSys, Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl, and NEKERROR.

{
int i, j, n, cnt, gid1, gid2;
NekDouble sign1, sign2, value;
int nBndDofs = pLocToGloMap->GetNumGlobalBndCoeffs();
int NumDirBCs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
unsigned int rows = nBndDofs - NumDirBCs;
unsigned int cols = nBndDofs - NumDirBCs;
int bwidth = pLocToGloMap->GetBndSystemBandWidth();
MatrixStorage matStorage = DetermineMatrixStorage(pLocToGloMap);
switch(matStorage)
{
{
try {
::AllocateSharedPtr(rows, cols, 0.0,
matStorage,
bwidth, bwidth);
}
catch (...) {
"Insufficient memory for GlobalLinSys.");
}
break;
}
case eFULL:
{
::AllocateSharedPtr(rows, cols, 0.0, matStorage);
break;
}
default:
{
"Unknown matrix storage type of type not set up");
}
}
// fill global matrix
int loc_lda;
for(n = cnt = 0; n < SchurCompl->GetNumberOfBlockRows(); ++n)
{
loc_mat = SchurCompl->GetBlock(n,n);
loc_lda = loc_mat->GetRows();
// Set up Matrix;
for(i = 0; i < loc_lda; ++i)
{
gid1 = pLocToGloMap->GetLocalToGlobalBndMap (cnt + i)
- NumDirBCs;
sign1 = pLocToGloMap->GetLocalToGlobalBndSign(cnt + i);
if(gid1 >= 0)
{
for(j = 0; j < loc_lda; ++j)
{
gid2 = pLocToGloMap->GetLocalToGlobalBndMap(cnt+j)
- NumDirBCs;
sign2 = pLocToGloMap->GetLocalToGlobalBndSign(cnt+j);
if(gid2 >= 0)
{
// As the global matrix should be symmetric,
// only add the value for the upper triangular
// part in order to avoid entries to be entered
// twice
if((matStorage == eFULL)||(gid2 >= gid1))
{
value = Gmat->GetValue(gid1,gid2)
+ sign1*sign2*(*loc_mat)(i,j);
Gmat->SetValue(gid1,gid2,value);
}
}
}
}
}
cnt += loc_lda;
}
if(rows)
{
}
}
GlobalLinSysStaticCondSharedPtr Nektar::MultiRegions::GlobalLinSysDirectStaticCond::v_Recurse ( const GlobalLinSysKey mkey,
const boost::weak_ptr< ExpList > &  pExpList,
const DNekScalBlkMatSharedPtr  pSchurCompl,
const DNekScalBlkMatSharedPtr  pBinvD,
const DNekScalBlkMatSharedPtr  pC,
const DNekScalBlkMatSharedPtr  pInvD,
const boost::shared_ptr< AssemblyMap > &  l2gMap 
)
protectedvirtual

Implements Nektar::MultiRegions::GlobalLinSysStaticCond.

Definition at line 284 of file GlobalLinSysDirectStaticCond.cpp.

{
GlobalLinSysDirectStaticCond>::AllocateSharedPtr(
mkey, pExpList, pSchurCompl, pBinvD, pC, pInvD, l2gMap);
sys->Initialise(l2gMap);
return sys;
}

Member Data Documentation

string Nektar::MultiRegions::GlobalLinSysDirectStaticCond::className
static
Initial value:
"DirectStaticCond",
"Direct static condensation.")

Name of class.

Registers the class with the Factory.

Definition at line 72 of file GlobalLinSysDirectStaticCond.h.

string Nektar::MultiRegions::GlobalLinSysDirectStaticCond::className2
static
Initial value:
"DirectMultiLevelStaticCond",
"Direct multi-level static condensation.")

Definition at line 73 of file GlobalLinSysDirectStaticCond.h.