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...
 
 ~GlobalLinSysKey () override
 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 49 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 54 of file GlobalLinSysKey.cpp.

59 : GlobalMatrixKey(matrixType, locToGloMap, factors, varCoeffs),
61 m_varFactors_hashes(varFactors.size())
62{
63 // Create hash
64 int i = 0;
65 for (VarFactorsMap::const_iterator x = varFactors.begin();
66 x != varFactors.end(); ++x)
67 {
69 x->second.begin(), x->second.begin() + x->second.size());
71 i++;
72 }
73
74 // Check AssemblyMapSharedPtr == Null
75 if (locToGloMap != NullAssemblyMapSharedPtr)
76 {
77 m_solnType = locToGloMap->GetGlobalSysSolnType();
78 }
79}
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.
@ eNoSolnType
No Solution type specified.
static AssemblyMapSharedPtr NullAssemblyMapSharedPtr
Definition: AssemblyMap.h:51
StdRegions::ConstFactorMap factors
std::size_t hash_range(Iter first, Iter last)
Definition: HashUtils.hpp:64
void hash_combine(std::size_t &seed)
Definition: HashUtils.hpp:44

References Nektar::hash_combine(), Nektar::hash_range(), m_solnType, m_varFactors_hashes, and Nektar::MultiRegions::NullAssemblyMapSharedPtr.

◆ 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.

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

◆ ~GlobalLinSysKey()

Nektar::MultiRegions::GlobalLinSysKey::~GlobalLinSysKey ( )
override

Destructor.

Definition at line 94 of file GlobalLinSysKey.cpp.

95{
96}

Member Function Documentation

◆ GetGlobalSysSolnType()

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

◆ GetNVarFactors()

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

Definition at line 100 of file GlobalLinSysKey.h.

101{
102 return m_varFactors.size();
103}

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 113 of file GlobalLinSysKey.h.

114{
115 return m_varFactors;
116}

References m_varFactors.

◆ GetVarFactors() [2/2]

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

Definition at line 105 of file GlobalLinSysKey.h.

107{
108 ASSERTL1(m_varFactors.count(factor) > 0, "factor not found");
109 VarFactorsMap::const_iterator found = m_varFactors.find(factor);
110 return (*found).second;
111}
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242

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 106 of file GlobalLinSysKey.cpp.

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

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 84 of file GlobalLinSysKey.h.

Referenced by GetGlobalSysSolnType(), and GlobalLinSysKey().

◆ m_varFactors

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

Definition at line 85 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 86 of file GlobalLinSysKey.h.

Referenced by GlobalLinSysKey().