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

Describes a matrix with ordering defined by a local to global map. More...

#include <GlobalMatrixKey.h>

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

Public Member Functions

 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 Member Functions

 GlobalMatrixKey ()
 Default constructor. More...
 

Protected Attributes

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 GlobalMatrixKey &lhs, const GlobalMatrixKey &rhs)
 Provides ordering of GlobalMatrixKey objects. More...
 

Detailed Description

Describes a matrix with ordering defined by a local to global map.

Definition at line 45 of file GlobalMatrixKey.h.

Constructor & Destructor Documentation

◆ GlobalMatrixKey() [1/4]

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

Definition at line 41 of file GlobalMatrixKey.cpp.

47 m_locToGloMap(locToGloMap)
48{
49}
std::weak_ptr< AssemblyMap > m_locToGloMap
Pointer to the local to global mapping.
LibUtilities::ShapeType m_shapeType
Stores the expansion/shape type that the matrix is to be based on.
StdRegions::ConstFactorMap m_constFactors
StdRegions::MatrixType m_matrixType
Stores the matrix type based on the enum StdRegions::MatrixType.
StdRegions::ConstFactorMap factors

◆ GlobalMatrixKey() [2/4]

Nektar::MultiRegions::GlobalMatrixKey::GlobalMatrixKey ( const GlobalMatrixKey key,
const LibUtilities::ShapeType  shapeType 
)

Copy constructor with change in expansion type.

Definition at line 51 of file GlobalMatrixKey.cpp.

53 : m_matrixType(key.m_matrixType), m_shapeType(shapeType),
54 m_constFactors(key.m_constFactors), m_varCoeffs(key.m_varCoeffs),
55 m_locToGloMap(key.m_locToGloMap)
56{
57}

◆ GlobalMatrixKey() [3/4]

Nektar::MultiRegions::GlobalMatrixKey::GlobalMatrixKey ( const GlobalMatrixKey key)

Copy constructor.

Definition at line 59 of file GlobalMatrixKey.cpp.

60 : m_matrixType(key.m_matrixType), m_shapeType(key.m_shapeType),
61 m_constFactors(key.m_constFactors), m_varCoeffs(key.m_varCoeffs),
62 m_locToGloMap(key.m_locToGloMap)
63{
64}

◆ ~GlobalMatrixKey()

Nektar::MultiRegions::GlobalMatrixKey::~GlobalMatrixKey ( )
virtual

Destructor.

Definition at line 66 of file GlobalMatrixKey.cpp.

67{
68}

◆ GlobalMatrixKey() [4/4]

Nektar::MultiRegions::GlobalMatrixKey::GlobalMatrixKey ( )
protected

Default constructor.

Member Function Documentation

◆ GetConstFactor()

NekDouble Nektar::MultiRegions::GlobalMatrixKey::GetConstFactor ( const StdRegions::ConstFactorType factor) const
inline

Returns the requested constant.

@Todo error checking

Definition at line 142 of file GlobalMatrixKey.h.

144{
145 auto found = m_constFactors.find(factor);
146 return (*found).second;
147}

References m_constFactors.

◆ GetConstFactors()

const StdRegions::ConstFactorMap & Nektar::MultiRegions::GlobalMatrixKey::GetConstFactors ( ) const
inline

◆ GetMatrixType()

StdRegions::MatrixType Nektar::MultiRegions::GlobalMatrixKey::GetMatrixType ( ) const
inline

◆ GetNConstFactors()

int Nektar::MultiRegions::GlobalMatrixKey::GetNConstFactors ( ) const
inline

Returns the number of constants defined for this matrix.

Definition at line 136 of file GlobalMatrixKey.h.

137{
138 return m_constFactors.size();
139}

References m_constFactors.

Referenced by Nektar::MultiRegions::operator<<().

◆ GetNVarCoeffs()

int Nektar::MultiRegions::GlobalMatrixKey::GetNVarCoeffs ( ) const
inline

◆ GetShapeType()

LibUtilities::ShapeType Nektar::MultiRegions::GlobalMatrixKey::GetShapeType ( void  ) const
inline

Return the expansion type associated with key.

Definition at line 121 of file GlobalMatrixKey.h.

122{
123 return m_shapeType;
124}

References m_shapeType.

Referenced by Nektar::MultiRegions::ExpList::GenBlockMatrix(), and Nektar::MultiRegions::operator<<().

◆ GetVarCoeff()

const Array< OneD, const NekDouble > & Nektar::MultiRegions::GlobalMatrixKey::GetVarCoeff ( const StdRegions::VarCoeffType coeff) const
inline

Definition at line 160 of file GlobalMatrixKey.h.

162{
163 auto found = m_varCoeffs.find(coeff);
164 return (*found).second.GetValue();
165}

References m_varCoeffs.

◆ GetVarCoeffs()

const StdRegions::VarCoeffMap & Nektar::MultiRegions::GlobalMatrixKey::GetVarCoeffs ( ) const
inline

◆ LocToGloMapIsDefined()

bool Nektar::MultiRegions::GlobalMatrixKey::LocToGloMapIsDefined ( void  ) const
inline

Returns true if a local to global map is defined.

Definition at line 126 of file GlobalMatrixKey.h.

127{
128 if (m_locToGloMap.lock().get() == nullptr) // NullAssemblyMapSharedPtr)
129 {
130 return false;
131 }
132
133 return true;
134}

References m_locToGloMap.

Referenced by Nektar::MultiRegions::ContField::GenGlobalLinSys(), Nektar::MultiRegions::ContField::GetGlobalMatrix(), and Nektar::MultiRegions::ContField::GetGlobalMatrixNnz().

Friends And Related Function Documentation

◆ operator<

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

Provides ordering of GlobalMatrixKey objects.

Definition at line 70 of file GlobalMatrixKey.cpp.

71{
72 if (lhs.m_matrixType < rhs.m_matrixType)
73 {
74 return true;
75 }
76
77 if (lhs.m_matrixType > rhs.m_matrixType)
78 {
79 return false;
80 }
81
82 if (lhs.m_shapeType < rhs.m_shapeType)
83 {
84 return true;
85 }
86
87 if (lhs.m_shapeType > rhs.m_shapeType)
88 {
89 return false;
90 }
91
92 if (lhs.m_constFactors.size() < rhs.m_constFactors.size())
93 {
94 return true;
95 }
96 else if (lhs.m_constFactors.size() > rhs.m_constFactors.size())
97 {
98 return false;
99 }
100 else
101 {
102 StdRegions::ConstFactorMap::const_iterator x, y;
103 for (x = lhs.m_constFactors.begin(), y = rhs.m_constFactors.begin();
104 x != lhs.m_constFactors.end(); ++x, ++y)
105 {
106 if (x->second < y->second)
107 {
108 return true;
109 }
110 if (x->second > y->second)
111 {
112 return false;
113 }
114 }
115 }
116
117 if (lhs.m_varCoeffs.size() < rhs.m_varCoeffs.size())
118 {
119 return true;
120 }
121 else if (lhs.m_varCoeffs.size() > rhs.m_varCoeffs.size())
122 {
123 return false;
124 }
125 else
126 {
127 StdRegions::VarCoeffMap::const_iterator x, y;
128 for (x = lhs.m_varCoeffs.begin(), y = rhs.m_varCoeffs.begin();
129 x != lhs.m_varCoeffs.end(); ++x, ++y)
130 {
131 if (x->second.GetHash() < y->second.GetHash())
132 {
133 return true;
134 }
135 if (x->second.GetHash() > y->second.GetHash())
136 {
137 return false;
138 }
139 }
140 }
141
142 if (!rhs.m_locToGloMap.lock().get())
143 {
144 return false;
145 }
146 else if (!lhs.m_locToGloMap.lock().get() && rhs.m_locToGloMap.lock().get())
147 {
148 return true;
149 }
150 if (lhs.m_locToGloMap.lock()->GetHash() <
151 rhs.m_locToGloMap.lock()->GetHash())
152 {
153 return true;
154 }
155
156 return false;
157}

Member Data Documentation

◆ m_constFactors

StdRegions::ConstFactorMap Nektar::MultiRegions::GlobalMatrixKey::m_constFactors
protected

Definition at line 100 of file GlobalMatrixKey.h.

Referenced by GetConstFactor(), GetConstFactors(), and GetNConstFactors().

◆ m_locToGloMap

std::weak_ptr<AssemblyMap> Nektar::MultiRegions::GlobalMatrixKey::m_locToGloMap
protected

Pointer to the local to global mapping.

Definition at line 104 of file GlobalMatrixKey.h.

Referenced by LocToGloMapIsDefined().

◆ m_matrixType

StdRegions::MatrixType Nektar::MultiRegions::GlobalMatrixKey::m_matrixType
protected

Stores the matrix type based on the enum StdRegions::MatrixType.

Definition at line 94 of file GlobalMatrixKey.h.

Referenced by GetMatrixType().

◆ m_shapeType

LibUtilities::ShapeType Nektar::MultiRegions::GlobalMatrixKey::m_shapeType
protected

Stores the expansion/shape type that the matrix is to be based on.

Definition at line 98 of file GlobalMatrixKey.h.

Referenced by GetShapeType().

◆ m_varCoeffs

StdRegions::VarCoeffMap Nektar::MultiRegions::GlobalMatrixKey::m_varCoeffs
protected

Definition at line 101 of file GlobalMatrixKey.h.

Referenced by GetNVarCoeffs(), GetVarCoeff(), and GetVarCoeffs().