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 47 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 43 of file GlobalMatrixKey.cpp.

49 m_locToGloMap(locToGloMap)
50{
51}
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 53 of file GlobalMatrixKey.cpp.

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

◆ GlobalMatrixKey() [3/4]

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

Copy constructor.

Definition at line 61 of file GlobalMatrixKey.cpp.

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

◆ ~GlobalMatrixKey()

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

Destructor.

Definition at line 68 of file GlobalMatrixKey.cpp.

69{
70}

◆ 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 144 of file GlobalMatrixKey.h.

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

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 138 of file GlobalMatrixKey.h.

139{
140 return m_constFactors.size();
141}

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 123 of file GlobalMatrixKey.h.

124{
125 return m_shapeType;
126}

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 162 of file GlobalMatrixKey.h.

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

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 128 of file GlobalMatrixKey.h.

129{
130 if (m_locToGloMap.lock().get() == 0) // NullAssemblyMapSharedPtr)
131 {
132 return false;
133 }
134
135 return true;
136}

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 72 of file GlobalMatrixKey.cpp.

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

Member Data Documentation

◆ m_constFactors

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

Definition at line 102 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 106 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 96 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 100 of file GlobalMatrixKey.h.

Referenced by GetShapeType().

◆ m_varCoeffs

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

Definition at line 103 of file GlobalMatrixKey.h.

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