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

A global linear system. More...

#include <GlobalLinSysIterativeStaticCond.h>

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

Public Types

typedef NekSparseDiagBlkMatrix
< StorageSmvBsr< NekDouble > > 
DNekSmvBsrDiagBlkMat
typedef boost::shared_ptr
< DNekSmvBsrDiagBlkMat
DNekSmvBsrDiagBlkMatSharedPtr

Public Member Functions

 GlobalLinSysIterativeStaticCond (const GlobalLinSysKey &mkey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &locToGloMap)
 Constructor for full direct matrix solve.
 GlobalLinSysIterativeStaticCond (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, const PreconditionerSharedPtr pPrecon)
 Constructor for full direct matrix solve.
virtual ~GlobalLinSysIterativeStaticCond ()
- Public Member Functions inherited from Nektar::MultiRegions::GlobalLinSysIterative
 GlobalLinSysIterative (const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
 Constructor for full direct matrix solve.
virtual ~GlobalLinSysIterative ()
- 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 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
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 > &locToGloMap)
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)
- Protected Member Functions inherited from Nektar::MultiRegions::GlobalLinSysIterative
void DoAconjugateProjection (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir)
 A-conjugate projection technique.
void DoConjugateGradient (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir)
 Actual iterative solve.
void Set_Rhs_Magnitude (const NekVector< NekDouble > &pIn)
virtual void v_UniqueMap ()=0
- 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 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 void v_AssembleSchurComplement (boost::shared_ptr< AssemblyMap > pLoctoGloMap)
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

virtual void v_InitObject ()
void v_AssembleSchurComplement (const boost::shared_ptr< AssemblyMap > locToGloMap)
 Assemble the Schur complement matrix.
void PrepareLocalSchurComplement ()
 Prepares local representation of Schur complement stored as a sparse block-diagonal matrix.
virtual void v_DoMatrixMultiply (const Array< OneD, NekDouble > &pInput, Array< OneD, NekDouble > &pOutput)
 Perform a Shur-complement matrix multiply operation.
virtual void v_UniqueMap ()

Private Attributes

DNekScalBlkMatSharedPtr m_S1Blk
std::vector< double > m_storage
 Dense storage for block Schur complement matrix.
std::vector< const double * > m_denseBlocks
 Vector of pointers to local matrix data.
Array< OneD, unsigned int > m_rows
 Ranks of local matrices.
Array< OneD, NekDoublem_scale
 Scaling factors for local matrices.
DNekSmvBsrDiagBlkMatSharedPtr m_sparseSchurCompl
 Sparse representation of Schur complement matrix at this level.

Static Private Attributes

static std::string storagedef
 Utility strings.
static std::string storagelookupIds []

Additional Inherited Members

- Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSysIterative
Array< OneD, int > m_map
 Global to universal unique map.
NekDouble m_tolerance
 Tolerance of iterative solver.
NekDouble m_rhs_magnitude
 dot product of rhs to normalise stopping criterion
PreconditionerSharedPtr m_precon
MultiRegions::PreconditionerType m_precontype
int m_totalIterations
bool m_useProjection
 Whether to apply projection technique.
bool m_root
 Provide verbose output and root if parallel.
bool m_verbose
boost::circular_buffer< Array
< OneD, NekDouble > > 
m_prevLinSol
 Storage for solutions to previous linear problems.
int m_numPrevSols
 Total counter of previous solutions.
- 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.

Solves a linear system iteratively using single- or multi-level static condensation.

Definition at line 72 of file GlobalLinSysIterativeStaticCond.h.

Member Typedef Documentation

Definition at line 77 of file GlobalLinSysIterativeStaticCond.h.

Definition at line 79 of file GlobalLinSysIterativeStaticCond.h.

Constructor & Destructor Documentation

Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::GlobalLinSysIterativeStaticCond ( 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 109 of file GlobalLinSysIterativeStaticCond.cpp.

References ASSERTL1, Nektar::MultiRegions::eIterativeMultiLevelStaticCond, Nektar::MultiRegions::eIterativeStaticCond, and Nektar::MultiRegions::GlobalLinSysKey::GetGlobalSysSolnType().

: GlobalLinSys (pKey, pExpList, pLocToGloMap),
GlobalLinSysIterative (pKey, pExpList, pLocToGloMap),
GlobalLinSysStaticCond(pKey, pExpList, pLocToGloMap)
{
ASSERTL1((pKey.GetGlobalSysSolnType()==eIterativeStaticCond)||
(pKey.GetGlobalSysSolnType()==eIterativeMultiLevelStaticCond),
"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::GlobalLinSysIterativeStaticCond::GlobalLinSysIterativeStaticCond ( 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,
const PreconditionerSharedPtr  pPrecon 
)
Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::~GlobalLinSysIterativeStaticCond ( )
virtual

Definition at line 204 of file GlobalLinSysIterativeStaticCond.cpp.

{
}

Member Function Documentation

static GlobalLinSysSharedPtr Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::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 82 of file GlobalLinSysIterativeStaticCond.h.

{
AllocateSharedPtr(pLinSysKey, pExpList, pLocToGloMap);
p->InitObject();
return p;
}
void Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::PrepareLocalSchurComplement ( )
private

Prepares local representation of Schur complement stored as a sparse block-diagonal matrix.

Populates sparse block-diagonal schur complement matrix from the block matrices stored in #m_blkMatrices.

Definition at line 329 of file GlobalLinSysIterativeStaticCond.cpp.

References ASSERTL1, Nektar::MultiRegions::eContiguous, Nektar::eFULL, Nektar::MultiRegions::eNonContiguous, Nektar::MultiRegions::eSparse, m_denseBlocks, Nektar::MultiRegions::GlobalLinSys::m_expList, m_rows, m_scale, Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl, m_sparseSchurCompl, m_storage, and Nektar::MultiRegions::GlobalLinSys::v_DropStaticCondBlock().

Referenced by v_AssembleSchurComplement().

{
LocalMatrixStorageStrategy storageStrategy =
m_expList.lock()->GetSession()->
GetSolverInfoAsEnum<LocalMatrixStorageStrategy>(
"LocalMatrixStorageStrategy");
switch(storageStrategy)
{
{
size_t storageSize = 0;
int nBlk = m_schurCompl->GetNumberOfBlockRows();
m_scale = Array<OneD, NekDouble> (nBlk, 1.0);
m_rows = Array<OneD, unsigned int> (nBlk, 0U);
// Determine storage requirements for dense blocks.
for (int i = 0; i < nBlk; ++i)
{
m_rows[i] = m_schurCompl->GetBlock(i,i)->GetRows();
m_scale[i] = m_schurCompl->GetBlock(i,i)->Scale();
storageSize += m_rows[i] * m_rows[i];
}
// Assemble dense storage blocks.
m_denseBlocks.resize(nBlk);
double *ptr = 0;
if (MultiRegions::eContiguous == storageStrategy)
{
m_storage.resize (storageSize);
ptr = &m_storage[0];
}
for (unsigned int n = 0; n < nBlk; ++n)
{
loc_mat = m_schurCompl->GetBlock(n,n);
if (MultiRegions::eContiguous == storageStrategy)
{
int loc_lda = loc_mat->GetRows();
int blockSize = loc_lda * loc_lda;
m_denseBlocks[n] = ptr;
for(int i = 0; i < loc_lda; ++i)
{
for(int j = 0; j < loc_lda; ++j)
{
ptr[j*loc_lda+i] = (*loc_mat)(i,j);
}
}
ptr += blockSize;
m_expList.lock()->GetOffset_Elmt_Id(n));
}
else
{
m_denseBlocks[n] = loc_mat->GetRawPtr();
}
}
break;
}
{
int loc_lda;
int blockSize = 0;
// First run through to split the set of local matrices into
// partitions of fixed block size, and count number of local
// matrices that belong to each partition.
std::vector<std::pair<int,int> > partitions;
for(int n = 0; n < m_schurCompl->GetNumberOfBlockRows(); ++n)
{
loc_mat = m_schurCompl->GetBlock(n,n);
loc_lda = loc_mat->GetRows();
ASSERTL1(loc_lda >= 0,
boost::lexical_cast<std::string>(n) + "-th "
"matrix block in Schur complement has "
"rank 0!");
if (blockSize == loc_lda)
{
partitions[partitions.size()-1].first++;
}
else
{
blockSize = loc_lda;
partitions.push_back(make_pair(1,loc_lda));
}
}
MatrixStorage matStorage = eFULL;
// Create a vector of sparse storage holders
sparseStorage (partitions.size());
for (int part = 0, n = 0; part < partitions.size(); ++part)
{
BCOMatType partMat;
for(int k = 0; k < partitions[part].first; ++k, ++n)
{
loc_mat = m_schurCompl->GetBlock(n,n);
loc_lda = loc_mat->GetRows();
ASSERTL1(loc_lda == partitions[part].second,
boost::lexical_cast<std::string>(n) + "-th"
" matrix block in Schur complement has "
"unexpected rank");
partMat[make_pair(k,k)] = BCOEntryType(
loc_lda*loc_lda, loc_mat->GetRawPtr());
m_expList.lock()->GetOffset_Elmt_Id(n));
}
sparseStorage[part] =
partitions[part].first, partitions[part].first,
partitions[part].second, partMat, matStorage );
}
// Create block diagonal matrix
AllocateSharedPtr(sparseStorage);
break;
}
default:
ErrorUtil::NekError("Solver info property \
LocalMatrixStorageStrategy takes values \
Contiguous, Non-contiguous and Sparse");
}
}
void Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_AssembleSchurComplement ( const boost::shared_ptr< AssemblyMap locToGloMap)
private

Assemble the Schur complement matrix.

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.

Definition at line 232 of file GlobalLinSysIterativeStaticCond.cpp.

References Nektar::convertCooToBco(), Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), Nektar::eFULL, Nektar::MultiRegions::eIterativeMultiLevelStaticCond, Nektar::MultiRegions::GlobalLinSysKey::GetGlobalSysSolnType(), Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), Nektar::MultiRegions::GetPreconFactory(), Nektar::MultiRegions::GlobalLinSys::GetSharedThisPtr(), Nektar::MultiRegions::GlobalLinSys::m_expList, Nektar::MultiRegions::GlobalLinSys::m_linSysKey, Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap, Nektar::MultiRegions::GlobalLinSysIterative::m_precon, Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl, m_sparseSchurCompl, Nektar::MultiRegions::PreconditionerTypeMap, PrepareLocalSchurComplement(), and v_UniqueMap().

{
int i,j,n,cnt,gid1,gid2;
NekDouble sign1,sign2;
bool doGlobalOp = m_expList.lock()->GetGlobalOptParam()->
DoGlobalMatOp(m_linSysKey.GetMatrixType());
// Set up unique map
// Build precon again if we in multi-level static condensation (a
// bit of a hack)
{
= m_locToGloMap->GetPreconType();
std::string PreconType
m_precon->BuildPreconditioner();
}
if (!doGlobalOp)
{
return;
}
int nBndDofs = pLocToGloMap->GetNumGlobalBndCoeffs();
int NumDirBCs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
unsigned int rows = nBndDofs - NumDirBCs;
unsigned int cols = nBndDofs - NumDirBCs;
// COO sparse storage to assist in assembly
COOMatType gmat_coo;
// Get the matrix storage structure
// (whether to store only one triangular part, if symmetric)
MatrixStorage matStorage = eFULL;
// assemble globally
int loc_lda;
for(n = cnt = 0; n < m_schurCompl->GetNumberOfBlockRows(); ++n)
{
loc_mat = m_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)
{
gmat_coo[std::make_pair(gid1,gid2)] +=
sign1*sign2*(*loc_mat)(i,j);
}
}
}
}
cnt += loc_lda;
}
sparseStorage (1);
BCOMatType partMat;
convertCooToBco(rows, cols, 1, gmat_coo, partMat);
sparseStorage[0] =
AllocateSharedPtr(rows, cols, 1, partMat, matStorage );
// Create block diagonal matrix
AllocateSharedPtr(sparseStorage);
}
void Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_BasisInvTransform ( Array< OneD, NekDouble > &  pInOut)
protectedvirtual

Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.

Definition at line 546 of file GlobalLinSysIterativeStaticCond.cpp.

References Nektar::MultiRegions::GlobalLinSysIterative::m_precon.

{
m_precon->DoTransformFromLowEnergy(pInOut);
}
void Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_BasisTransform ( Array< OneD, NekDouble > &  pInOut,
int  offset 
)
protectedvirtual

Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.

Definition at line 539 of file GlobalLinSysIterativeStaticCond.cpp.

References Nektar::MultiRegions::GlobalLinSysIterative::m_precon.

{
m_precon->DoTransformToLowEnergy(pInOut, offset);
}
void Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_DoMatrixMultiply ( const Array< OneD, NekDouble > &  pInput,
Array< OneD, NekDouble > &  pOutput 
)
privatevirtual

Perform a Shur-complement matrix multiply operation.

Definition at line 474 of file GlobalLinSysIterativeStaticCond.cpp.

References Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), m_denseBlocks, Nektar::MultiRegions::GlobalLinSys::m_expList, Nektar::MultiRegions::GlobalLinSys::m_linSysKey, Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap, m_rows, m_scale, m_sparseSchurCompl, and Nektar::MultiRegions::GlobalLinSysStaticCond::m_wsp.

{
int nLocal = m_locToGloMap->GetNumLocalBndCoeffs();
int nDir = m_locToGloMap->GetNumGlobalDirBndCoeffs();
bool doGlobalOp = m_expList.lock()->GetGlobalOptParam()->
DoGlobalMatOp(m_linSysKey.GetMatrixType());
if(doGlobalOp)
{
// Do matrix multiply globally
Array<OneD, NekDouble> in = pInput + nDir;
Array<OneD, NekDouble> out = pOutput + nDir;
m_sparseSchurCompl->Multiply(in,out);
m_locToGloMap->UniversalAssembleBnd(pOutput, nDir);
}
{
// Do matrix multiply locally using block-diagonal sparse matrix
Array<OneD, NekDouble> tmp = m_wsp + nLocal;
m_locToGloMap->GlobalToLocalBnd(pInput, m_wsp);
m_sparseSchurCompl->Multiply(m_wsp,tmp);
m_locToGloMap->AssembleBnd(tmp, pOutput);
}
else
{
// Do matrix multiply locally, using direct BLAS calls
m_locToGloMap->GlobalToLocalBnd(pInput, m_wsp);
int i, cnt;
Array<OneD, NekDouble> tmpout = m_wsp + nLocal;
for (i = cnt = 0; i < m_denseBlocks.size(); cnt += m_rows[i], ++i)
{
const int rows = m_rows[i];
Blas::Dgemv('N', rows, rows,
m_scale[i], m_denseBlocks[i], rows,
m_wsp.get()+cnt, 1,
0.0, tmpout.get()+cnt, 1);
}
m_locToGloMap->AssembleBnd(tmpout, pOutput);
}
}
DNekScalBlkMatSharedPtr Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_GetStaticCondBlock ( unsigned int  n)
protectedvirtual

Retrieves a the static condensation block matrices from n-th expansion using the matrix key provided by the m_linSysKey.

Parameters
nNumber of the expansion
Returns
2x2 Block matrix holding the static condensation matrices for the n-th expansion.

Reimplemented from Nektar::MultiRegions::GlobalLinSys.

Definition at line 210 of file GlobalLinSysIterativeStaticCond.cpp.

References Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap, m_S1Blk, and Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl.

{
DNekScalBlkMatSharedPtr schurComplBlock;
int scLevel = m_locToGloMap->GetStaticCondLevel();
DNekScalMatSharedPtr localMat = sc->GetBlock(n,n);
unsigned int nbdry = localMat->GetRows();
unsigned int nblks = 1;
unsigned int esize[1] = {nbdry};
::AllocateSharedPtr(nblks, nblks, esize, esize);
schurComplBlock->SetBlock(0, 0, localMat);
return schurComplBlock;
}
void Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_InitObject ( )
privatevirtual

Definition at line 152 of file GlobalLinSysIterativeStaticCond.cpp.

References Nektar::LibUtilities::NekFactory< tKey, tBase, >::CreateInstance(), Nektar::eDIAGONAL, Nektar::StdRegions::eHybridDGHelmBndLam, Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), Nektar::MultiRegions::GetPreconFactory(), Nektar::MultiRegions::GlobalLinSys::GetSharedThisPtr(), Nektar::MultiRegions::GlobalLinSys::Initialise(), Nektar::MultiRegions::GlobalLinSys::m_expList, Nektar::MultiRegions::GlobalLinSys::m_linSysKey, Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap, Nektar::MultiRegions::GlobalLinSysIterative::m_precon, m_S1Blk, Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl, Nektar::MultiRegions::PreconditionerTypeMap, and Nektar::MultiRegions::GlobalLinSysStaticCond::SetupTopLevel().

{
= m_locToGloMap->GetPreconType();
std::string PreconType
// Allocate memory for top-level structure
// Setup Block Matrix systems
int n, n_exp = m_expList.lock()->GetNumElmts();
MatrixStorage blkmatStorage = eDIAGONAL;
const Array<OneD,const unsigned int>& nbdry_size
= m_locToGloMap->GetNumLocalBndCoeffsPerPatch();
::AllocateSharedPtr(nbdry_size, nbdry_size , blkmatStorage);
// Preserve original matrix in m_S1Blk
for (n = 0; n < n_exp; ++n)
{
DNekScalMatSharedPtr mat = m_schurCompl->GetBlock(n, n);
m_S1Blk->SetBlock(n, n, mat);
}
// Build preconditioner
m_precon->BuildPreconditioner();
// Do transform of Schur complement matrix
for (n = 0; n < n_exp; ++n)
{
{
DNekScalMatSharedPtr mat = m_S1Blk->GetBlock(n, n);
DNekScalMatSharedPtr t = m_precon->TransformedSchurCompl(
m_expList.lock()->GetOffset_Elmt_Id(n), mat);
m_schurCompl->SetBlock(n, n, t);
}
}
// Construct this level
}
DNekScalBlkMatSharedPtr Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_PreSolve ( int  scLevel,
NekVector< NekDouble > &  F_GlobBnd 
)
protectedvirtual
GlobalLinSysStaticCondSharedPtr Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::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 > &  locToGloMap 
)
protectedvirtual

Implements Nektar::MultiRegions::GlobalLinSysStaticCond.

Definition at line 552 of file GlobalLinSysIterativeStaticCond.cpp.

References Nektar::MultiRegions::GlobalLinSysIterative::m_precon.

{
GlobalLinSysIterativeStaticCond>::AllocateSharedPtr(
mkey, pExpList, pSchurCompl, pBinvD, pC, pInvD, l2gMap,
sys->Initialise(l2gMap);
return sys;
}
void Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::v_UniqueMap ( )
privatevirtual

Member Data Documentation

string Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::className
static
Initial value:
"IterativeStaticCond",
"Iterative static condensation.")

Name of class.

Registers the class with the Factory.

Definition at line 95 of file GlobalLinSysIterativeStaticCond.h.

string Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::className2
static
Initial value:
"IterativeMultiLevelStaticCond",
"Iterative multi-level static condensation.")

Definition at line 96 of file GlobalLinSysIterativeStaticCond.h.

std::vector<const double*> Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::m_denseBlocks
private

Vector of pointers to local matrix data.

Definition at line 142 of file GlobalLinSysIterativeStaticCond.h.

Referenced by PrepareLocalSchurComplement(), and v_DoMatrixMultiply().

Array<OneD, unsigned int> Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::m_rows
private

Ranks of local matrices.

Definition at line 144 of file GlobalLinSysIterativeStaticCond.h.

Referenced by PrepareLocalSchurComplement(), and v_DoMatrixMultiply().

DNekScalBlkMatSharedPtr Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::m_S1Blk
private
Array<OneD, NekDouble> Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::m_scale
private

Scaling factors for local matrices.

Definition at line 146 of file GlobalLinSysIterativeStaticCond.h.

Referenced by PrepareLocalSchurComplement(), and v_DoMatrixMultiply().

DNekSmvBsrDiagBlkMatSharedPtr Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::m_sparseSchurCompl
private

Sparse representation of Schur complement matrix at this level.

Definition at line 148 of file GlobalLinSysIterativeStaticCond.h.

Referenced by PrepareLocalSchurComplement(), v_AssembleSchurComplement(), and v_DoMatrixMultiply().

std::vector<double> Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::m_storage
private

Dense storage for block Schur complement matrix.

Definition at line 140 of file GlobalLinSysIterativeStaticCond.h.

Referenced by PrepareLocalSchurComplement().

std::string Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::storagedef
staticprivate
Initial value:
"LocalMatrixStorageStrategy",
"Sparse")

Utility strings.

Definition at line 150 of file GlobalLinSysIterativeStaticCond.h.

std::string Nektar::MultiRegions::GlobalLinSysIterativeStaticCond::storagelookupIds
staticprivate
Initial value:
{
"LocalMatrixStorageStrategy",
"Contiguous",
"LocalMatrixStorageStrategy",
"Non-contiguous",
"LocalMatrixStorageStrategy",
"Sparse",
}

Definition at line 151 of file GlobalLinSysIterativeStaticCond.h.