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 | Protected Attributes | List of all members
Nektar::MultiRegions::GlobalLinSysPETScStaticCond Class Reference

A global linear system. More...

#include <GlobalLinSysPETScStaticCond.h>

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

Public Member Functions

 GlobalLinSysPETScStaticCond (const GlobalLinSysKey &mkey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &locToGloMap)
 Constructor for full direct matrix solve. More...
 
 GlobalLinSysPETScStaticCond (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=PreconditionerSharedPtr())
 Constructor for full direct matrix solve. More...
 
virtual ~GlobalLinSysPETScStaticCond ()
 
- Public Member Functions inherited from Nektar::MultiRegions::GlobalLinSysPETSc
 GlobalLinSysPETSc (const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExp, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
 Constructor for full direct matrix solve. More...
 
virtual ~GlobalLinSysPETSc ()
 Clean up PETSc objects. More...
 
virtual void v_SolveLinearSystem (const int pNumRows, const Array< OneD, const NekDouble > &pInput, Array< OneD, NekDouble > &pOutput, const AssemblyMapSharedPtr &locToGloMap, const int pNumDir)
 Solve linear system using PETSc. More...
 
- 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. More...
 
virtual ~GlobalLinSys ()
 
const GlobalLinSysKeyGetKey (void) const
 Returns the key associated with the system. More...
 
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. More...
 
boost::shared_ptr< GlobalLinSysGetSharedThisPtr ()
 Returns a shared pointer to the current object. More...
 
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. More...
 
- 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. More...
 
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. More...
 

Static Public Attributes

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

Protected Member Functions

virtual void v_InitObject ()
 
virtual void v_AssembleSchurComplement (boost::shared_ptr< AssemblyMap > locToGloMap)
 Assemble the Schur complement matrix. More...
 
virtual void v_DoMatrixMultiply (const Array< OneD, const NekDouble > &input, Array< OneD, NekDouble > &output)
 Apply matrix-vector multiplication using local approach and the assembly map. More...
 
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. More...
 
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
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)
 
- Protected Member Functions inherited from Nektar::MultiRegions::GlobalLinSysPETSc
void SetUpScatter ()
 Set up PETSc local (equivalent to Nektar++ global) and global (equivalent to universal) scatter maps. More...
 
void SetUpMatVec (int nGlobal, int nDir)
 Construct PETSc matrix and vector handles. More...
 
void SetUpSolver (NekDouble tolerance)
 Set up KSP solver object. More...
 
void CalculateReordering (const Array< OneD, const int > &glo2uniMap, const Array< OneD, const int > &glo2unique, const AssemblyMapSharedPtr &pLocToGloMap)
 Calculate a reordering of universal IDs for PETSc. More...
 
- 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. More...
 
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. More...
 
PreconditionerSharedPtr CreatePrecon (AssemblyMapSharedPtr asmMap)
 Create a preconditioner object from the parameters defined in the supplied assembly map. More...
 
- Protected Member Functions inherited from Nektar::MultiRegions::GlobalLinSysStaticCond
virtual int v_GetNumBlocks ()
 Get the number of blocks in this system. More...
 
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. More...
 
virtual void v_Initialise (const boost::shared_ptr< AssemblyMap > &locToGloMap)
 Initialise this object. More...
 
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. More...
 
void ConstructNextLevelCondensedSystem (const boost::shared_ptr< AssemblyMap > &locToGloMap)
 

Protected Attributes

DNekScalBlkMatSharedPtr m_S1Blk
 
- Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSysPETSc
Mat m_matrix
 PETSc matrix object. More...
 
Vec m_x
 PETSc vector objects used for local storage. More...
 
Vec m_b
 
Vec m_locVec
 
KSP m_ksp
 KSP object that represents solver system. More...
 
PC m_pc
 PCShell for preconditioner. More...
 
PETScMatMult m_matMult
 Enumerator to select matrix multiplication type. More...
 
std::vector< int > m_reorderedMap
 Reordering that takes universal IDs to a unique row in the PETSc matrix. More...
 
VecScatter m_ctx
 PETSc scatter context that takes us between Nektar++ global ordering and PETSc vector ordering. More...
 
int m_nLocal
 Number of unique degrees of freedom on this process. More...
 
PreconditionerSharedPtr m_precon
 
- Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSys
const GlobalLinSysKey m_linSysKey
 Key associated with this linear system. More...
 
const boost::weak_ptr< ExpListm_expList
 Local Matrix System. More...
 
const std::map< int,
RobinBCInfoSharedPtr
m_robinBCInfo
 Robin boundary info. More...
 
bool m_verbose
 
- Protected Attributes inherited from Nektar::MultiRegions::GlobalLinSysStaticCond
GlobalLinSysStaticCondSharedPtr m_recursiveSchurCompl
 Schur complement for Direct Static Condensation. More...
 
DNekScalBlkMatSharedPtr m_schurCompl
 Block Schur complement matrix. More...
 
DNekScalBlkMatSharedPtr m_BinvD
 Block $ BD^{-1} $ matrix. More...
 
DNekScalBlkMatSharedPtr m_C
 Block $ C $ matrix. More...
 
DNekScalBlkMatSharedPtr m_invD
 Block $ D^{-1} $ matrix. More...
 
boost::shared_ptr< AssemblyMapm_locToGloMap
 Local to global map. More...
 
Array< OneD, NekDoublem_wsp
 Workspace array for matrix multiplication. More...
 

Detailed Description

A global linear system.

Definition at line 55 of file GlobalLinSysPETScStaticCond.h.

Constructor & Destructor Documentation

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

References ASSERTL1, Nektar::MultiRegions::ePETScMultiLevelStaticCond, Nektar::MultiRegions::ePETScStaticCond, and Nektar::MultiRegions::GlobalLinSysKey::GetGlobalSysSolnType().

93  : GlobalLinSys (pKey, pExpList, pLocToGloMap),
94  GlobalLinSysPETSc (pKey, pExpList, pLocToGloMap),
95  GlobalLinSysStaticCond(pKey, pExpList, pLocToGloMap)
96  {
97  ASSERTL1((pKey.GetGlobalSysSolnType()==ePETScStaticCond)||
98  (pKey.GetGlobalSysSolnType()==ePETScMultiLevelStaticCond),
99  "This constructor is only valid when using static "
100  "condensation");
101  ASSERTL1(pKey.GetGlobalSysSolnType()
102  == pLocToGloMap->GetGlobalSysSolnType(),
103  "The local to global map is not set up for the requested "
104  "solution type");
105  }
GlobalLinSysPETSc(const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExp, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
Constructor for full direct matrix solve.
GlobalLinSys(const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
Constructor for full direct matrix solve.
GlobalLinSysStaticCond(const GlobalLinSysKey &mkey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &locToGloMap)
Constructor for full direct matrix solve.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:218
Nektar::MultiRegions::GlobalLinSysPETScStaticCond::GlobalLinSysPETScStaticCond ( 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 = PreconditionerSharedPtr() 
)

Constructor for full direct matrix solve.

Definition at line 110 of file GlobalLinSysPETScStaticCond.cpp.

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

119  : GlobalLinSys (pKey, pExpList, pLocToGloMap),
120  GlobalLinSysPETSc (pKey, pExpList, pLocToGloMap),
121  GlobalLinSysStaticCond(pKey, pExpList, pLocToGloMap)
122  {
123  m_schurCompl = pSchurCompl;
124  m_BinvD = pBinvD;
125  m_C = pC;
126  m_invD = pInvD;
127  m_precon = pPrecon;
128  }
DNekScalBlkMatSharedPtr m_schurCompl
Block Schur complement matrix.
DNekScalBlkMatSharedPtr m_C
Block matrix.
DNekScalBlkMatSharedPtr m_invD
Block matrix.
GlobalLinSysPETSc(const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExp, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
Constructor for full direct matrix solve.
GlobalLinSys(const GlobalLinSysKey &pKey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
Constructor for full direct matrix solve.
GlobalLinSysStaticCond(const GlobalLinSysKey &mkey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &locToGloMap)
Constructor for full direct matrix solve.
DNekScalBlkMatSharedPtr m_BinvD
Block matrix.
Nektar::MultiRegions::GlobalLinSysPETScStaticCond::~GlobalLinSysPETScStaticCond ( )
virtual

Definition at line 133 of file GlobalLinSysPETScStaticCond.cpp.

134  {
135 
136  }

Member Function Documentation

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

64  {
65  GlobalLinSysSharedPtr p = MemoryManager<
66  GlobalLinSysPETScStaticCond>::AllocateSharedPtr(
67  pLinSysKey, pExpList, pLocToGloMap);
68  p->InitObject();
69  return p;
70  }
GlobalLinSysPETScStaticCond(const GlobalLinSysKey &mkey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &locToGloMap)
Constructor for full direct matrix solve.
boost::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:52
void Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_AssembleSchurComplement ( boost::shared_ptr< AssemblyMap locToGloMap)
protectedvirtual

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.

Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.

Definition at line 187 of file GlobalLinSysPETScStaticCond.cpp.

References Nektar::MultiRegions::GlobalLinSysPETSc::CalculateReordering(), Nektar::MultiRegions::GlobalLinSys::CreatePrecon(), Nektar::MultiRegions::ePETScMatMultShell, Nektar::MultiRegions::ePETScMultiLevelStaticCond, Nektar::MultiRegions::GlobalLinSysKey::GetGlobalSysSolnType(), Nektar::MultiRegions::GlobalLinSysStaticCond::m_BinvD, Nektar::MultiRegions::GlobalLinSysStaticCond::m_C, Nektar::MultiRegions::GlobalLinSysStaticCond::m_invD, Nektar::MultiRegions::GlobalLinSys::m_linSysKey, Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap, Nektar::MultiRegions::GlobalLinSysPETSc::m_matMult, Nektar::MultiRegions::GlobalLinSysPETSc::m_matrix, Nektar::MultiRegions::GlobalLinSysPETSc::m_precon, Nektar::MultiRegions::GlobalLinSysPETSc::m_reorderedMap, Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl, Nektar::MultiRegions::GlobalLinSysPETSc::SetUpMatVec(), Nektar::MultiRegions::GlobalLinSysPETSc::SetUpScatter(), and Nektar::MultiRegions::GlobalLinSysPETSc::SetUpSolver().

189  {
190  int i, j, n, cnt, gid1, gid2, loc_lda;
191  NekDouble sign1, sign2, value;
192 
193  const int nDirDofs = pLocToGloMap->GetNumGlobalDirBndCoeffs();
194 
199  DNekScalMatSharedPtr loc_mat;
200 
201  // Build precon again if we in multi-level static condensation (a
202  // bit of a hack)
205  {
207  m_precon->BuildPreconditioner();
208  }
209 
210  // CALCULATE REORDERING MAPPING
211  CalculateReordering(pLocToGloMap->GetGlobalToUniversalBndMap(),
212  pLocToGloMap->GetGlobalToUniversalBndMapUnique(),
213  pLocToGloMap);
214 
215  // SET UP VECTORS AND MATRIX
216  SetUpMatVec(pLocToGloMap->GetNumGlobalBndCoeffs(), nDirDofs);
217 
218  // SET UP SCATTER OBJECTS
219  SetUpScatter();
220 
221  // CONSTRUCT KSP OBJECT
222  SetUpSolver(pLocToGloMap->GetIterativeTolerance());
223 
224  // If we are using the matrix multiplication shell don't try to
225  // populate the matrix.
227  {
228  return;
229  }
230 
231  // POPULATE MATRIX
232  for(n = cnt = 0; n < m_schurCompl->GetNumberOfBlockRows(); ++n)
233  {
234  loc_mat = m_schurCompl->GetBlock(n,n);
235  loc_lda = loc_mat->GetRows();
236 
237  for(i = 0; i < loc_lda; ++i)
238  {
239  gid1 = pLocToGloMap->GetLocalToGlobalBndMap(cnt + i)-nDirDofs;
240  sign1 = pLocToGloMap->GetLocalToGlobalBndSign(cnt + i);
241  if(gid1 >= 0)
242  {
243  int gid1ro = m_reorderedMap[gid1];
244  for(j = 0; j < loc_lda; ++j)
245  {
246  gid2 = pLocToGloMap->GetLocalToGlobalBndMap(cnt + j)
247  - nDirDofs;
248  sign2 = pLocToGloMap->GetLocalToGlobalBndSign(cnt + j);
249  if(gid2 >= 0)
250  {
251  int gid2ro = m_reorderedMap[gid2];
252  value = sign1*sign2*(*loc_mat)(i,j);
253  MatSetValue(
254  m_matrix, gid1ro, gid2ro, value, ADD_VALUES);
255  }
256  }
257  }
258  }
259  cnt += loc_lda;
260  }
261 
262  // ASSEMBLE MATRIX
263  MatAssemblyBegin(m_matrix, MAT_FINAL_ASSEMBLY);
264  MatAssemblyEnd (m_matrix, MAT_FINAL_ASSEMBLY);
265  }
GlobalSysSolnType GetGlobalSysSolnType() const
Return the associated solution type.
DNekScalBlkMatSharedPtr m_schurCompl
Block Schur complement matrix.
DNekScalBlkMatSharedPtr m_C
Block matrix.
void CalculateReordering(const Array< OneD, const int > &glo2uniMap, const Array< OneD, const int > &glo2unique, const AssemblyMapSharedPtr &pLocToGloMap)
Calculate a reordering of universal IDs for PETSc.
void SetUpSolver(NekDouble tolerance)
Set up KSP solver object.
DNekScalBlkMatSharedPtr m_invD
Block matrix.
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
boost::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:74
double NekDouble
void SetUpScatter()
Set up PETSc local (equivalent to Nektar++ global) and global (equivalent to universal) scatter maps...
const GlobalLinSysKey m_linSysKey
Key associated with this linear system.
Definition: GlobalLinSys.h:127
void SetUpMatVec(int nGlobal, int nDir)
Construct PETSc matrix and vector handles.
boost::shared_ptr< AssemblyMap > m_locToGloMap
Local to global map.
std::vector< int > m_reorderedMap
Reordering that takes universal IDs to a unique row in the PETSc matrix.
DNekScalBlkMatSharedPtr m_BinvD
Block matrix.
PETScMatMult m_matMult
Enumerator to select matrix multiplication type.
PreconditionerSharedPtr CreatePrecon(AssemblyMapSharedPtr asmMap)
Create a preconditioner object from the parameters defined in the supplied assembly map...
void Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_BasisInvTransform ( Array< OneD, NekDouble > &  pInOut)
protectedvirtual

Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.

Definition at line 314 of file GlobalLinSysPETScStaticCond.cpp.

References Nektar::MultiRegions::GlobalLinSysPETSc::m_precon.

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

Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.

Definition at line 307 of file GlobalLinSysPETScStaticCond.cpp.

References Nektar::MultiRegions::GlobalLinSysPETSc::m_precon.

310  {
311  m_precon->DoTransformToLowEnergy(pInOut, offset);
312  }
void Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_DoMatrixMultiply ( const Array< OneD, const NekDouble > &  input,
Array< OneD, NekDouble > &  output 
)
protectedvirtual

Apply matrix-vector multiplication using local approach and the assembly map.

Parameters
inputVector input.
outputResult of multiplication.
Todo:
This can possibly be made faster by using the sparse block-matrix multiplication code from the iterative elastic systems.

Implements Nektar::MultiRegions::GlobalLinSysPETSc.

Definition at line 331 of file GlobalLinSysPETScStaticCond.cpp.

References Nektar::NekVector< DataType >::GetPtr(), and Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap.

334  {
335  int nLocBndDofs = m_locToGloMap->GetNumLocalBndCoeffs();
336  int nDirDofs = m_locToGloMap->GetNumGlobalDirBndCoeffs();
337 
338  NekVector<NekDouble> in(nLocBndDofs), out(nLocBndDofs);
339  m_locToGloMap->GlobalToLocalBnd(input, in.GetPtr(), nDirDofs);
340  out = (*m_schurCompl) * in;
341  m_locToGloMap->AssembleBnd(out.GetPtr(), output, nDirDofs);
342  }
boost::shared_ptr< AssemblyMap > m_locToGloMap
Local to global map.
DNekScalBlkMatSharedPtr Nektar::MultiRegions::GlobalLinSysPETScStaticCond::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 268 of file GlobalLinSysPETScStaticCond.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap, m_S1Blk, and Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl.

269  {
270  DNekScalBlkMatSharedPtr schurComplBlock;
271  int scLevel = m_locToGloMap->GetStaticCondLevel();
272  DNekScalBlkMatSharedPtr sc = scLevel == 0 ? m_S1Blk : m_schurCompl;
273  DNekScalMatSharedPtr localMat = sc->GetBlock(n,n);
274  unsigned int nbdry = localMat->GetRows();
275  unsigned int nblks = 1;
276  unsigned int esize[1] = {nbdry};
277 
278  schurComplBlock = MemoryManager<DNekScalBlkMat>
279  ::AllocateSharedPtr(nblks, nblks, esize, esize);
280  schurComplBlock->SetBlock(0, 0, localMat);
281 
282  return schurComplBlock;
283  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
DNekScalBlkMatSharedPtr m_schurCompl
Block Schur complement matrix.
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
boost::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:74
boost::shared_ptr< AssemblyMap > m_locToGloMap
Local to global map.
void Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_InitObject ( )
protectedvirtual

Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.

Definition at line 138 of file GlobalLinSysPETScStaticCond.cpp.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::MultiRegions::GlobalLinSys::CreatePrecon(), Nektar::eDIAGONAL, Nektar::StdRegions::eHybridDGHelmBndLam, Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType(), Nektar::MultiRegions::GlobalLinSys::Initialise(), Nektar::MultiRegions::GlobalLinSys::m_expList, Nektar::MultiRegions::GlobalLinSys::m_linSysKey, Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap, Nektar::MultiRegions::GlobalLinSysPETSc::m_precon, m_S1Blk, Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl, and Nektar::MultiRegions::GlobalLinSysStaticCond::SetupTopLevel().

139  {
141 
142  // Allocate memory for top-level structure
144 
145  // Setup Block Matrix systems
146  int n, n_exp = m_expList.lock()->GetNumElmts();
147 
148  MatrixStorage blkmatStorage = eDIAGONAL;
149  const Array<OneD,const unsigned int>& nbdry_size
150  = m_locToGloMap->GetNumLocalBndCoeffsPerPatch();
151 
153  ::AllocateSharedPtr(nbdry_size, nbdry_size, blkmatStorage);
154 
155  // Preserve original matrix in m_S1Blk
156  for (n = 0; n < n_exp; ++n)
157  {
158  DNekScalMatSharedPtr mat = m_schurCompl->GetBlock(n, n);
159  m_S1Blk->SetBlock(n, n, mat);
160  }
161 
162  // Build preconditioner
163  m_precon->BuildPreconditioner();
164 
165  // Do transform of Schur complement matrix
166  for (n = 0; n < n_exp; ++n)
167  {
168  if (m_linSysKey.GetMatrixType() !=
170  {
171  DNekScalMatSharedPtr mat = m_S1Blk->GetBlock(n, n);
172  DNekScalMatSharedPtr t = m_precon->TransformedSchurCompl(
173  m_expList.lock()->GetOffset_Elmt_Id(n), mat);
174  m_schurCompl->SetBlock(n, n, t);
175  }
176  }
177 
178  // Construct this level
180  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
DNekScalBlkMatSharedPtr m_schurCompl
Block Schur complement matrix.
void Initialise(const boost::shared_ptr< AssemblyMap > &pLocToGloMap)
Definition: GlobalLinSys.h:216
boost::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
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...
StdRegions::MatrixType GetMatrixType() const
Return the matrix type.
const GlobalLinSysKey m_linSysKey
Key associated with this linear system.
Definition: GlobalLinSys.h:127
boost::shared_ptr< AssemblyMap > m_locToGloMap
Local to global map.
PreconditionerSharedPtr CreatePrecon(AssemblyMapSharedPtr asmMap)
Create a preconditioner object from the parameters defined in the supplied assembly map...
const boost::weak_ptr< ExpList > m_expList
Local Matrix System.
Definition: GlobalLinSys.h:129
DNekScalBlkMatSharedPtr Nektar::MultiRegions::GlobalLinSysPETScStaticCond::v_PreSolve ( int  scLevel,
NekVector< NekDouble > &  F_GlobBnd 
)
protectedvirtual

Reimplemented from Nektar::MultiRegions::GlobalLinSysStaticCond.

Definition at line 285 of file GlobalLinSysPETScStaticCond.cpp.

References Nektar::MultiRegions::GlobalLinSys::CreatePrecon(), Nektar::MultiRegions::GlobalLinSysStaticCond::m_locToGloMap, Nektar::MultiRegions::GlobalLinSysPETSc::m_precon, m_S1Blk, and Nektar::MultiRegions::GlobalLinSysStaticCond::m_schurCompl.

288  {
289  if (scLevel == 0)
290  {
291  // When matrices are supplied to the constructor at the top
292  // level, the preconditioner is never set up.
293  if (!m_precon)
294  {
296  m_precon->BuildPreconditioner();
297  }
298 
299  return m_S1Blk;
300  }
301  else
302  {
303  return m_schurCompl;
304  }
305  }
DNekScalBlkMatSharedPtr m_schurCompl
Block Schur complement matrix.
boost::shared_ptr< AssemblyMap > m_locToGloMap
Local to global map.
PreconditionerSharedPtr CreatePrecon(AssemblyMapSharedPtr asmMap)
Create a preconditioner object from the parameters defined in the supplied assembly map...
GlobalLinSysStaticCondSharedPtr Nektar::MultiRegions::GlobalLinSysPETScStaticCond::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 344 of file GlobalLinSysPETScStaticCond.cpp.

References Nektar::MultiRegions::GlobalLinSysPETSc::m_precon.

352  {
353  GlobalLinSysPETScStaticCondSharedPtr sys = MemoryManager<
354  GlobalLinSysPETScStaticCond>::AllocateSharedPtr(
355  mkey, pExpList, pSchurCompl, pBinvD, pC, pInvD, l2gMap,
356  m_precon);
357  sys->Initialise(l2gMap);
358  return sys;
359  }
boost::shared_ptr< GlobalLinSysPETScStaticCond > GlobalLinSysPETScStaticCondSharedPtr
GlobalLinSysPETScStaticCond(const GlobalLinSysKey &mkey, const boost::weak_ptr< ExpList > &pExpList, const boost::shared_ptr< AssemblyMap > &locToGloMap)
Constructor for full direct matrix solve.

Member Data Documentation

string Nektar::MultiRegions::GlobalLinSysPETScStaticCond::className
static
Initial value:
"PETScStaticCond",
"PETSc static condensation.")

Name of class.

Registers the class with the Factory.

Definition at line 73 of file GlobalLinSysPETScStaticCond.h.

string Nektar::MultiRegions::GlobalLinSysPETScStaticCond::className2
static
Initial value:
"PETScMultiLevelStaticCond",
"PETSc multi-level static condensation.")

Definition at line 74 of file GlobalLinSysPETScStaticCond.h.

DNekScalBlkMatSharedPtr Nektar::MultiRegions::GlobalLinSysPETScStaticCond::m_S1Blk
protected

Definition at line 97 of file GlobalLinSysPETScStaticCond.h.

Referenced by v_GetStaticCondBlock(), v_InitObject(), and v_PreSolve().