Nektar++
Public Member Functions | Protected Attributes | Friends | List of all members
Nektar::MultiRegions::GlobalLinSysKey Class Reference

Describe a linear system. More...

#include <GlobalLinSysKey.h>

Inheritance diagram for Nektar::MultiRegions::GlobalLinSysKey:
[legend]

Public Member Functions

 GlobalLinSysKey (const StdRegions::MatrixType matrixType, const AssemblyMapSharedPtr &locToGloMap=NullAssemblyMapSharedPtr, const StdRegions::ConstFactorMap &factors=StdRegions::NullConstFactorMap, const StdRegions::VarCoeffMap &varCoeffs=StdRegions::NullVarCoeffMap, const VarFactorsMap &varFactos=NullVarFactorsMap)
 
 GlobalLinSysKey (const GlobalLinSysKey &key)
 Copy constructor. More...
 
virtual ~GlobalLinSysKey ()
 Destructor. More...
 
GlobalSysSolnType GetGlobalSysSolnType () const
 Return the associated solution type. More...
 
int GetNVarFactors () const
 
const Array< OneD, const NekDouble > & GetVarFactors (const StdRegions::ConstFactorType &coeff) const
 
const VarFactorsMapGetVarFactors () const
 
- Public Member Functions inherited from Nektar::MultiRegions::GlobalMatrixKey
 GlobalMatrixKey (const StdRegions::MatrixType matrixType, const AssemblyMapSharedPtr &locToGloMap=NullAssemblyMapSharedPtr, const StdRegions::ConstFactorMap &factors=StdRegions::NullConstFactorMap, const StdRegions::VarCoeffMap &varCoeffs=StdRegions::NullVarCoeffMap)
 
 GlobalMatrixKey (const GlobalMatrixKey &key, const LibUtilities::ShapeType shapeType)
 Copy constructor with change in expansion type. More...
 
 GlobalMatrixKey (const GlobalMatrixKey &key)
 Copy constructor. More...
 
virtual ~GlobalMatrixKey ()
 Destructor. More...
 
StdRegions::MatrixType GetMatrixType () const
 Return the matrix type. More...
 
LibUtilities::ShapeType GetShapeType () const
 Return the expansion type associated with key. More...
 
bool LocToGloMapIsDefined () const
 Returns true if a local to global map is defined. More...
 
int GetNConstFactors () const
 Returns the number of constants defined for this matrix. More...
 
NekDouble GetConstFactor (const StdRegions::ConstFactorType &factor) const
 Returns the requested constant. More...
 
const StdRegions::ConstFactorMapGetConstFactors () const
 Returns all the constants. More...
 
int GetNVarCoeffs () const
 
const Array< OneD, const NekDouble > & GetVarCoeff (const StdRegions::VarCoeffType &coeff) const
 
const StdRegions::VarCoeffMapGetVarCoeffs () const
 

Protected Attributes

GlobalSysSolnType m_solnType
 Store the solution type associated with the linear system. This may be none, full matrix, static condensation or multi-level static condensation. More...
 
VarFactorsMap m_varFactors
 
std::vector< std::size_t > m_varFactors_hashes
 
- Protected Attributes inherited from Nektar::MultiRegions::GlobalMatrixKey
StdRegions::MatrixType m_matrixType
 Stores the matrix type based on the enum StdRegions::MatrixType. More...
 
LibUtilities::ShapeType m_shapeType
 Stores the expansion/shape type that the matrix is to be based on. More...
 
StdRegions::ConstFactorMap m_constFactors
 
StdRegions::VarCoeffMap m_varCoeffs
 
std::weak_ptr< AssemblyMapm_locToGloMap
 Pointer to the local to global mapping. More...
 

Friends

bool operator< (const GlobalLinSysKey &lhs, const GlobalLinSysKey &rhs)
 Less-than operator for GlobalLinSysKey comparison. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Nektar::MultiRegions::GlobalMatrixKey
 GlobalMatrixKey ()
 Default constructor. More...
 

Detailed Description

Describe a linear system.

This class represents a global linear system and is in essence a wrapper around a global matrix key, augmenting it with a specific solution type from GlobalSysSolnType. Each constructor accepts a MatrixType, describing the matrix to be constructed, a AssemblyMap, defining the mapping from the local elemental expansions to a global system, and a GlobalSysSolnType, defining the type of solution (e.g. full matrix, static condenstation). Some constructors include additional parameters for customising the global operator matrix.

Definition at line 50 of file GlobalLinSysKey.h.

Constructor & Destructor Documentation

◆ GlobalLinSysKey() [1/2]

Nektar::MultiRegions::GlobalLinSysKey::GlobalLinSysKey ( const StdRegions::MatrixType  matrixType,
const AssemblyMapSharedPtr locToGloMap = NullAssemblyMapSharedPtr,
const StdRegions::ConstFactorMap factors = StdRegions::NullConstFactorMap,
const StdRegions::VarCoeffMap varCoeffs = StdRegions::NullVarCoeffMap,
const VarFactorsMap varFactos = NullVarFactorsMap 
)

Definition at line 58 of file GlobalLinSysKey.cpp.

62  :
63  GlobalMatrixKey(matrixType, locToGloMap, factors, varCoeffs),
64  m_solnType(locToGloMap->GetGlobalSysSolnType()),
65  m_varFactors(varFactors),
66  m_varFactors_hashes(varFactors.size())
67  {
68  // Create hash
69  int i = 0;
70  for (VarFactorsMap::const_iterator x = varFactors.begin();
71  x != varFactors.end(); ++x)
72  {
73  m_varFactors_hashes[i] = boost::hash_range(x->second.begin(),
74  x->second.begin() + x->second.size());
75  boost::hash_combine(m_varFactors_hashes[i], (int)x->first);
76  i++;
77  }
78  }
GlobalSysSolnType m_solnType
Store the solution type associated with the linear system. This may be none, full matrix,...
std::vector< std::size_t > m_varFactors_hashes
GlobalMatrixKey()
Default constructor.
std::size_t hash_range(Iter first, Iter last)
Definition: HashUtils.hpp:69
void hash_combine(std::size_t &seed)
Definition: HashUtils.hpp:46

References Nektar::hash_combine(), Nektar::hash_range(), and m_varFactors_hashes.

◆ GlobalLinSysKey() [2/2]

Nektar::MultiRegions::GlobalLinSysKey::GlobalLinSysKey ( const GlobalLinSysKey key)

Copy constructor.

Parameters
keyExisting key to duplicate.

Definition at line 84 of file GlobalLinSysKey.cpp.

84  :
85  GlobalMatrixKey(key),
86  m_solnType(key.m_solnType),
87  m_varFactors(key.m_varFactors),
88  m_varFactors_hashes(key.m_varFactors_hashes)
89  {
90  }

◆ ~GlobalLinSysKey()

Nektar::MultiRegions::GlobalLinSysKey::~GlobalLinSysKey ( )
virtual

Destructor.

Definition at line 96 of file GlobalLinSysKey.cpp.

97  {
98  }

Member Function Documentation

◆ GetGlobalSysSolnType()

GlobalSysSolnType Nektar::MultiRegions::GlobalLinSysKey::GetGlobalSysSolnType ( ) const
inline

◆ GetNVarFactors()

int Nektar::MultiRegions::GlobalLinSysKey::GetNVarFactors ( ) const
inline

Definition at line 105 of file GlobalLinSysKey.h.

106  {
107  return m_varFactors.size();
108  }

References m_varFactors.

Referenced by Nektar::MultiRegions::GlobalLinSys::GetBlockMatrixKey(), and Nektar::MultiRegions::operator<<().

◆ GetVarFactors() [1/2]

const VarFactorsMap & Nektar::MultiRegions::GlobalLinSysKey::GetVarFactors ( ) const
inline

Definition at line 119 of file GlobalLinSysKey.h.

120  {
121  return m_varFactors;
122  }

References m_varFactors.

◆ GetVarFactors() [2/2]

const Array< OneD, const NekDouble > & Nektar::MultiRegions::GlobalLinSysKey::GetVarFactors ( const StdRegions::ConstFactorType coeff) const
inline

Definition at line 111 of file GlobalLinSysKey.h.

113  {
114  ASSERTL1(m_varFactors.count(factor) > 0, "factor not found");
115  VarFactorsMap::const_iterator found = m_varFactors.find(factor);
116  return (*found).second;
117  }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:250

References ASSERTL1, and m_varFactors.

Referenced by Nektar::MultiRegions::GlobalLinSys::GetBlockMatrixKey().

Friends And Related Function Documentation

◆ operator<

bool operator< ( const GlobalLinSysKey lhs,
const GlobalLinSysKey rhs 
)
friend

Less-than operator for GlobalLinSysKey comparison.

Compares two GlobalLinSysKeys by comparing their solution types and matrix keys.

Parameters
lhsFirst operand.
rhsSecond operand.
Returns
true if the first operand is considered less than the second operand.

Definition at line 109 of file GlobalLinSysKey.cpp.

110  {
111  if(lhs.m_solnType < rhs.m_solnType)
112  {
113  return true;
114  }
115 
116  if(lhs.m_solnType > rhs.m_solnType)
117  {
118  return false;
119  }
120 
121  if(lhs.m_varFactors.size() < rhs.m_varFactors.size())
122  {
123  return true;
124  }
125 
126  if(lhs.m_varFactors.size() > rhs.m_varFactors.size())
127  {
128  return false;
129  }
130 
131  for (unsigned int i = 0; i < lhs.m_varFactors_hashes.size(); ++i)
132  {
133  if(lhs.m_varFactors_hashes[i] < rhs.m_varFactors_hashes[i])
134  {
135  return true;
136  }
137  if(lhs.m_varFactors_hashes[i] > rhs.m_varFactors_hashes[i])
138  {
139  return false;
140  }
141  }
142 
143  return (*dynamic_cast<const GlobalMatrixKey*>(&lhs)
144  < *dynamic_cast<const GlobalMatrixKey*>(&rhs));
145  }

Member Data Documentation

◆ m_solnType

GlobalSysSolnType Nektar::MultiRegions::GlobalLinSysKey::m_solnType
protected

Store the solution type associated with the linear system. This may be none, full matrix, static condensation or multi-level static condensation.

Definition at line 88 of file GlobalLinSysKey.h.

Referenced by GetGlobalSysSolnType().

◆ m_varFactors

VarFactorsMap Nektar::MultiRegions::GlobalLinSysKey::m_varFactors
protected

Definition at line 89 of file GlobalLinSysKey.h.

Referenced by GetNVarFactors(), and GetVarFactors().

◆ m_varFactors_hashes

std::vector<std::size_t> Nektar::MultiRegions::GlobalLinSysKey::m_varFactors_hashes
protected

Definition at line 90 of file GlobalLinSysKey.h.

Referenced by GlobalLinSysKey().