Nektar++
Classes | Public Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
Nektar::StdRegions::StdMatrixKey Class Reference

#include <StdMatrixKey.h>

Inheritance diagram for Nektar::StdRegions::StdMatrixKey:
[legend]

Classes

struct  opLess
 Used to lookup the create function in NekManager. More...
 

Public Member Functions

 StdMatrixKey (const StdRegions::MatrixType matrixType, const LibUtilities::ShapeType shapeType, const StdRegions::StdExpansion &stdExpansion, const ConstFactorMap &factorMap=NullConstFactorMap, const VarCoeffMap &varCoeffMap=NullVarCoeffMap, LibUtilities::PointsType nodalType=LibUtilities::eNoPointsType)
 
 StdMatrixKey (const StdMatrixKey &rhs, const StdRegions::MatrixType matrixType)
 
 StdMatrixKey (const StdMatrixKey &rhs)
 
virtual ~StdMatrixKey ()
 
MatrixType GetMatrixType () const
 
LibUtilities::ShapeType GetShapeType () const
 
LibUtilities::PointsType GetNodalPointsType () const
 
int GetNcoeffs () const
 
const Array< OneD, const LibUtilities::BasisSharedPtr > & GetBase () const
 
std::vector< std::size_t > GetVarCoeffHashes () const
 
const LibUtilities::BasisSharedPtr GetBasis (int dir) const
 
int GetNConstFactors () const
 
NekDouble GetConstFactor (const ConstFactorType &factor) const
 
bool ConstFactorExists (const ConstFactorType &factor) const
 
const ConstFactorMapGetConstFactors () const
 
int GetNVarCoeff () const
 
const Array< OneD, const NekDouble > & GetVarCoeff (const StdRegions::VarCoeffType &coeff) const
 
const VarCoeffMap GetVarCoeffAsMap (const VarCoeffType &coeff) const
 
const VarCoeffMapGetVarCoeffs () const
 
bool HasVarCoeff (const StdRegions::VarCoeffType &coeff) const
 

Protected Attributes

LibUtilities::ShapeType m_shapeType
 
Array< OneD, const LibUtilities::BasisSharedPtrm_base
 
unsigned int m_ncoeffs
 
MatrixType m_matrixType
 
LibUtilities::PointsType m_nodalPointsType
 
ConstFactorMap m_factors
 
VarCoeffMap m_varcoeffs
 
std::vector< std::size_t > m_varcoeff_hashes
 

Private Member Functions

 StdMatrixKey ()
 

Friends

bool operator< (const StdMatrixKey &lhs, const StdMatrixKey &rhs)
 Used for finding value given the key in NekManager. More...
 
bool operator== (const StdMatrixKey &lhs, const StdMatrixKey &rhs)
 
bool opLess::operator() (const StdMatrixKey &lhs, const StdMatrixKey &rhs) const
 

Detailed Description

Definition at line 50 of file StdMatrixKey.h.

Constructor & Destructor Documentation

◆ StdMatrixKey() [1/4]

Nektar::StdRegions::StdMatrixKey::StdMatrixKey ( const StdRegions::MatrixType  matrixType,
const LibUtilities::ShapeType  shapeType,
const StdRegions::StdExpansion stdExpansion,
const ConstFactorMap factorMap = NullConstFactorMap,
const VarCoeffMap varCoeffMap = NullVarCoeffMap,
LibUtilities::PointsType  nodalType = LibUtilities::eNoPointsType 
)

Definition at line 45 of file StdMatrixKey.cpp.

51  : m_shapeType(shapeType), m_base(stdExpansion.GetBase()),
52  m_ncoeffs(stdExpansion.GetNcoeffs()), m_matrixType(matrixType),
53  m_nodalPointsType(nodalType), m_factors(factorMap),
54  m_varcoeffs(varCoeffMap), m_varcoeff_hashes(varCoeffMap.size())
55 {
56  // Create hash
57  int i = 0;
58  for (auto &x : varCoeffMap)
59  {
60  m_varcoeff_hashes[i] = hash_range(x.second.GetValue().begin(),
61  x.second.GetValue().begin() +
62  stdExpansion.GetTotPoints());
63  hash_combine(m_varcoeff_hashes[i], (int)x.first);
64  i++;
65  }
66 }
LibUtilities::PointsType m_nodalPointsType
Definition: StdMatrixKey.h:187
Array< OneD, const LibUtilities::BasisSharedPtr > m_base
Definition: StdMatrixKey.h:183
LibUtilities::ShapeType m_shapeType
Definition: StdMatrixKey.h:182
std::vector< std::size_t > m_varcoeff_hashes
Definition: StdMatrixKey.h:192
std::size_t hash_range(Iter first, Iter last)
Definition: HashUtils.hpp:68
void hash_combine(std::size_t &seed)
Definition: HashUtils.hpp:46

References Nektar::StdRegions::StdExpansion::GetTotPoints(), Nektar::hash_combine(), Nektar::hash_range(), and m_varcoeff_hashes.

◆ StdMatrixKey() [2/4]

Nektar::StdRegions::StdMatrixKey::StdMatrixKey ( const StdMatrixKey rhs,
const StdRegions::MatrixType  matrixType 
)

Definition at line 68 of file StdMatrixKey.cpp.

70  : m_shapeType(rhs.m_shapeType), m_base(rhs.m_base),
71  m_ncoeffs(rhs.m_ncoeffs), m_matrixType(matrixType),
72  m_nodalPointsType(rhs.m_nodalPointsType), m_factors(rhs.m_factors),
73  m_varcoeffs(rhs.m_varcoeffs), m_varcoeff_hashes(rhs.m_varcoeff_hashes)
74 {
75 }

◆ StdMatrixKey() [3/4]

Nektar::StdRegions::StdMatrixKey::StdMatrixKey ( const StdMatrixKey rhs)

Definition at line 77 of file StdMatrixKey.cpp.

78  : m_shapeType(rhs.m_shapeType), m_base(rhs.m_base),
79  m_ncoeffs(rhs.m_ncoeffs), m_matrixType(rhs.m_matrixType),
80  m_nodalPointsType(rhs.m_nodalPointsType), m_factors(rhs.m_factors),
81  m_varcoeffs(rhs.m_varcoeffs), m_varcoeff_hashes(rhs.m_varcoeff_hashes)
82 {
83 }

◆ ~StdMatrixKey()

virtual Nektar::StdRegions::StdMatrixKey::~StdMatrixKey ( )
inlinevirtual

Definition at line 66 of file StdMatrixKey.h.

67  {
68  }

◆ StdMatrixKey() [4/4]

Nektar::StdRegions::StdMatrixKey::StdMatrixKey ( )
private

Member Function Documentation

◆ ConstFactorExists()

bool Nektar::StdRegions::StdMatrixKey::ConstFactorExists ( const ConstFactorType factor) const
inline

◆ GetBase()

const Array<OneD, const LibUtilities::BasisSharedPtr>& Nektar::StdRegions::StdMatrixKey::GetBase ( ) const
inline

Definition at line 105 of file StdMatrixKey.h.

107  {
108  return m_base;
109  }

References m_base.

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

◆ GetBasis()

const LibUtilities::BasisSharedPtr Nektar::StdRegions::StdMatrixKey::GetBasis ( int  dir) const
inline

Definition at line 116 of file StdMatrixKey.h.

117  {
118  return (m_base[dir]);
119  }

References m_base.

Referenced by export_StdMatrixKey().

◆ GetConstFactor()

NekDouble Nektar::StdRegions::StdMatrixKey::GetConstFactor ( const ConstFactorType factor) const
inline

Definition at line 126 of file StdMatrixKey.h.

127  {
128  auto x = m_factors.find(factor);
129  ASSERTL1(x != m_factors.end(),
130  "Constant factor not defined: " +
131  std::string(StdRegions::ConstFactorTypeMap[factor]));
132  return x->second;
133  }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:249
const char *const ConstFactorTypeMap[]
Definition: StdRegions.hpp:382

References ASSERTL1, Nektar::StdRegions::ConstFactorTypeMap, and m_factors.

Referenced by Nektar::LocalRegions::Expansion2D::CreateMatrix(), Nektar::LocalRegions::Expansion3D::CreateMatrix(), Nektar::LocalRegions::SegExp::CreateMatrix(), Nektar::StdRegions::StdExpansion::HelmholtzMatrixOp_MatFree_GenericImpl(), Nektar::StdRegions::StdExpansion::LaplacianMatrixOp_MatFree(), Nektar::StdRegions::StdExpansion::LinearAdvectionDiffusionReactionMatrixOp_MatFree(), Nektar::StdRegions::StdHexExp::v_GenMatrix(), Nektar::StdRegions::StdPrismExp::v_GenMatrix(), Nektar::StdRegions::StdQuadExp::v_GenMatrix(), Nektar::StdRegions::StdSegExp::v_GenMatrix(), Nektar::StdRegions::StdTetExp::v_GenMatrix(), Nektar::StdRegions::StdTriExp::v_GenMatrix(), Nektar::LocalRegions::Expansion1D::v_GenMatrix(), Nektar::LocalRegions::Expansion2D::v_GenMatrix(), Nektar::LocalRegions::Expansion3D::v_GenMatrix(), Nektar::StdRegions::StdSegExp::v_HelmholtzMatrixOp(), Nektar::LocalRegions::SegExp::v_HelmholtzMatrixOp(), Nektar::StdRegions::StdExpansion2D::v_HelmholtzMatrixOp_MatFree(), Nektar::StdRegions::StdExpansion3D::v_HelmholtzMatrixOp_MatFree(), Nektar::StdRegions::StdHexExp::v_SVVLaplacianFilter(), Nektar::StdRegions::StdPrismExp::v_SVVLaplacianFilter(), Nektar::StdRegions::StdPyrExp::v_SVVLaplacianFilter(), Nektar::StdRegions::StdQuadExp::v_SVVLaplacianFilter(), Nektar::StdRegions::StdSegExp::v_SVVLaplacianFilter(), Nektar::StdRegions::StdTetExp::v_SVVLaplacianFilter(), and Nektar::StdRegions::StdTriExp::v_SVVLaplacianFilter().

◆ GetConstFactors()

const ConstFactorMap& Nektar::StdRegions::StdMatrixKey::GetConstFactors ( ) const
inline

◆ GetMatrixType()

MatrixType Nektar::StdRegions::StdMatrixKey::GetMatrixType ( ) const
inline

Definition at line 85 of file StdMatrixKey.h.

86  {
87  return m_matrixType;
88  }

References m_matrixType.

Referenced by Nektar::StdRegions::StdExpansion::CreateGeneralMatrix(), Nektar::LocalRegions::Expansion2D::CreateMatrix(), Nektar::LocalRegions::Expansion3D::CreateMatrix(), Nektar::LocalRegions::SegExp::CreateMatrix(), Nektar::LocalRegions::Expansion::CreateStaticCondMatrix(), export_StdMatrixKey(), Nektar::StdRegions::StdExpansion::GeneralMatrixOp(), Nektar::StdRegions::StdExpansion::GeneralMatrixOp_MatFree(), Nektar::LocalRegions::MatrixKey::opLess::operator()(), Nektar::StdRegions::operator<<(), Nektar::StdRegions::StdHexExp::v_GenMatrix(), Nektar::StdRegions::StdNodalPrismExp::v_GenMatrix(), Nektar::StdRegions::StdNodalTetExp::v_GenMatrix(), Nektar::StdRegions::StdNodalTriExp::v_GenMatrix(), Nektar::StdRegions::StdPointExp::v_GenMatrix(), Nektar::StdRegions::StdPrismExp::v_GenMatrix(), Nektar::StdRegions::StdQuadExp::v_GenMatrix(), Nektar::StdRegions::StdSegExp::v_GenMatrix(), Nektar::StdRegions::StdTetExp::v_GenMatrix(), Nektar::StdRegions::StdTriExp::v_GenMatrix(), Nektar::LocalRegions::Expansion1D::v_GenMatrix(), Nektar::LocalRegions::Expansion2D::v_GenMatrix(), Nektar::LocalRegions::Expansion3D::v_GenMatrix(), Nektar::LocalRegions::HexExp::v_GenMatrix(), Nektar::LocalRegions::NodalTriExp::v_GenMatrix(), Nektar::LocalRegions::PrismExp::v_GenMatrix(), Nektar::LocalRegions::PyrExp::v_GenMatrix(), Nektar::LocalRegions::QuadExp::v_GenMatrix(), Nektar::LocalRegions::SegExp::v_GenMatrix(), Nektar::LocalRegions::TetExp::v_GenMatrix(), and Nektar::LocalRegions::TriExp::v_GenMatrix().

◆ GetNcoeffs()

int Nektar::StdRegions::StdMatrixKey::GetNcoeffs ( void  ) const
inline

Definition at line 100 of file StdMatrixKey.h.

101  {
102  return m_ncoeffs;
103  }

References m_ncoeffs.

Referenced by export_StdMatrixKey(), and Nektar::StdRegions::operator<<().

◆ GetNConstFactors()

int Nektar::StdRegions::StdMatrixKey::GetNConstFactors ( ) const
inline

Definition at line 121 of file StdMatrixKey.h.

122  {
123  return m_factors.size();
124  }

References m_factors.

◆ GetNodalPointsType()

LibUtilities::PointsType Nektar::StdRegions::StdMatrixKey::GetNodalPointsType ( ) const
inline

◆ GetNVarCoeff()

int Nektar::StdRegions::StdMatrixKey::GetNVarCoeff ( ) const
inline

◆ GetShapeType()

LibUtilities::ShapeType Nektar::StdRegions::StdMatrixKey::GetShapeType ( ) const
inline

◆ GetVarCoeff()

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

◆ GetVarCoeffAsMap()

const VarCoeffMap Nektar::StdRegions::StdMatrixKey::GetVarCoeffAsMap ( const VarCoeffType coeff) const
inline

Definition at line 160 of file StdMatrixKey.h.

161  {
162  VarCoeffMap m;
163  auto x = m_varcoeffs.find(coeff);
164  ASSERTL1(x != m_varcoeffs.end(),
165  "Variable coefficient not defined: " +
166  std::string(StdRegions::VarCoeffTypeMap[coeff]));
167  m[coeff] = x->second;
168  return m;
169  }
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
Definition: StdRegions.hpp:343

References ASSERTL1, m_varcoeffs, and Nektar::StdRegions::VarCoeffTypeMap.

Referenced by Nektar::LocalRegions::Expansion2D::v_GenMatrix().

◆ GetVarCoeffHashes()

std::vector<std::size_t> Nektar::StdRegions::StdMatrixKey::GetVarCoeffHashes ( ) const
inline

Definition at line 111 of file StdMatrixKey.h.

112  {
113  return m_varcoeff_hashes;
114  }

References m_varcoeff_hashes.

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

◆ GetVarCoeffs()

const VarCoeffMap& Nektar::StdRegions::StdMatrixKey::GetVarCoeffs ( ) const
inline

◆ HasVarCoeff()

bool Nektar::StdRegions::StdMatrixKey::HasVarCoeff ( const StdRegions::VarCoeffType coeff) const
inline

Friends And Related Function Documentation

◆ operator<

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

Used for finding value given the key in NekManager.

Definition at line 91 of file StdMatrixKey.cpp.

92 {
93  if (lhs.m_matrixType < rhs.m_matrixType)
94  {
95  return true;
96  }
97 
98  if (lhs.m_matrixType > rhs.m_matrixType)
99  {
100  return false;
101  }
102 
103  if (lhs.m_ncoeffs < rhs.m_ncoeffs) // probably do not need this check since
104  // checking the m_base below?
105  {
106  return true;
107  }
108 
109  if (lhs.m_ncoeffs > rhs.m_ncoeffs)
110  {
111  return false;
112  }
113 
114  if (LibUtilities::ShapeTypeDimMap[lhs.m_shapeType] <
115  LibUtilities::ShapeTypeDimMap[rhs.m_shapeType])
116  {
117  return true;
118  }
119 
120  if (LibUtilities::ShapeTypeDimMap[lhs.m_shapeType] >
121  LibUtilities::ShapeTypeDimMap[rhs.m_shapeType])
122  {
123  return false;
124  }
125 
126  for (unsigned int i = 0; i < LibUtilities::ShapeTypeDimMap[lhs.m_shapeType];
127  ++i)
128  {
129  if (lhs.m_base[i].get() < rhs.m_base[i].get())
130  {
131  return true;
132  }
133 
134  if (lhs.m_base[i].get() > rhs.m_base[i].get())
135  {
136  return false;
137  }
138  }
139 
140  if (lhs.m_factors.size() < rhs.m_factors.size())
141  {
142  return true;
143  }
144  else if (lhs.m_factors.size() > rhs.m_factors.size())
145  {
146  return false;
147  }
148  else
149  {
150  for (auto x = lhs.m_factors.begin(), y = rhs.m_factors.begin();
151  x != lhs.m_factors.end(); ++x, ++y)
152  {
153  if (x->second < y->second)
154  {
155  return true;
156  }
157  if (x->second > y->second)
158  {
159  return false;
160  }
161  }
162  }
163 
164  if (lhs.m_varcoeffs.size() < rhs.m_varcoeffs.size())
165  {
166  return true;
167  }
168 
169  if (lhs.m_varcoeffs.size() > rhs.m_varcoeffs.size())
170  {
171  return false;
172  }
173 
174  for (unsigned int i = 0; i < lhs.m_varcoeff_hashes.size(); ++i)
175  {
176  if (lhs.m_varcoeff_hashes[i] < rhs.m_varcoeff_hashes[i])
177  {
178  return true;
179  }
180  if (lhs.m_varcoeff_hashes[i] > rhs.m_varcoeff_hashes[i])
181  {
182  return false;
183  }
184  }
185 
186  if (lhs.m_nodalPointsType < rhs.m_nodalPointsType)
187  {
188  return true;
189  }
190 
191  if (lhs.m_nodalPointsType > rhs.m_nodalPointsType)
192  {
193  return false;
194  }
195 
196  return false;
197 }
constexpr unsigned int ShapeTypeDimMap[SIZE_ShapeType]
Definition: ShapeType.hpp:85

◆ operator==

bool operator== ( const StdMatrixKey lhs,
const StdMatrixKey rhs 
)
friend

Definition at line 199 of file StdMatrixKey.cpp.

200 {
201  if (lhs.m_matrixType != rhs.m_matrixType)
202  {
203  return false;
204  }
205 
206  if (lhs.m_ncoeffs != rhs.m_ncoeffs)
207  {
208  return false;
209  }
210 
211  for (unsigned int i = 0; i < LibUtilities::ShapeTypeDimMap[lhs.m_shapeType];
212  ++i)
213  {
214  if (lhs.m_base[i].get() != rhs.m_base[i].get())
215  {
216  return false;
217  }
218  }
219 
220  if (lhs.m_factors.size() != rhs.m_factors.size())
221  {
222  return false;
223  }
224  else
225  {
226  return lhs.m_factors.size() == rhs.m_factors.size() &&
227  std::equal(lhs.m_factors.begin(), lhs.m_factors.end(),
228  rhs.m_factors.begin());
229  }
230 
231  if (lhs.m_nodalPointsType != rhs.m_nodalPointsType)
232  {
233  return false;
234  }
235 
236  if (lhs.m_varcoeffs.size() != rhs.m_varcoeffs.size())
237  {
238  return false;
239  }
240 
241  for (unsigned int i = 0; i < lhs.m_varcoeff_hashes.size(); ++i)
242  {
243  if (lhs.m_varcoeff_hashes[i] != rhs.m_varcoeff_hashes[i])
244  {
245  return false;
246  }
247  }
248 
249  for (auto &x : lhs.m_varcoeffs)
250  {
251  auto y = rhs.m_varcoeffs.find(x.first);
252  // Check var coeff is found
253  if (y == rhs.m_varcoeffs.end())
254  {
255  return false;
256  }
257 
258  if (x.second.GetValue() != y->second.GetValue())
259  {
260  return false;
261  }
262  }
263  for (unsigned int i = 0; i < lhs.m_varcoeffs.size(); ++i)
264  {
265  if (lhs.m_varcoeff_hashes[i] != rhs.m_varcoeff_hashes[i])
266  {
267  return false;
268  }
269  }
270 
271  return true;
272 }

◆ opLess::operator()

bool opLess::operator() ( const StdMatrixKey lhs,
const StdMatrixKey rhs 
) const
friend

Member Data Documentation

◆ m_base

Array<OneD, const LibUtilities::BasisSharedPtr> Nektar::StdRegions::StdMatrixKey::m_base
protected

Definition at line 183 of file StdMatrixKey.h.

Referenced by GetBase(), and GetBasis().

◆ m_factors

ConstFactorMap Nektar::StdRegions::StdMatrixKey::m_factors
protected

◆ m_matrixType

MatrixType Nektar::StdRegions::StdMatrixKey::m_matrixType
protected

◆ m_ncoeffs

unsigned int Nektar::StdRegions::StdMatrixKey::m_ncoeffs
protected

Definition at line 185 of file StdMatrixKey.h.

Referenced by GetNcoeffs().

◆ m_nodalPointsType

LibUtilities::PointsType Nektar::StdRegions::StdMatrixKey::m_nodalPointsType
protected

Definition at line 187 of file StdMatrixKey.h.

Referenced by GetNodalPointsType().

◆ m_shapeType

LibUtilities::ShapeType Nektar::StdRegions::StdMatrixKey::m_shapeType
protected

Definition at line 182 of file StdMatrixKey.h.

Referenced by GetShapeType().

◆ m_varcoeff_hashes

std::vector<std::size_t> Nektar::StdRegions::StdMatrixKey::m_varcoeff_hashes
protected

Definition at line 192 of file StdMatrixKey.h.

Referenced by GetVarCoeffHashes(), and StdMatrixKey().

◆ m_varcoeffs

VarCoeffMap Nektar::StdRegions::StdMatrixKey::m_varcoeffs
protected