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

50  :
51  m_shapeType(shapeType),
52  m_base(stdExpansion.GetBase()),
53  m_ncoeffs(stdExpansion.GetNcoeffs()),
54  m_matrixType(matrixType),
55  m_nodalPointsType(nodalType),
56  m_factors(factorMap),
57  m_varcoeffs(varCoeffMap),
58  m_varcoeff_hashes(varCoeffMap.size())
59  {
60  // Create hash
61  int i = 0;
62  for (auto &x : varCoeffMap)
63  {
64  m_varcoeff_hashes[i] = hash_range(x.second.begin(), x.second.begin() + stdExpansion.GetTotPoints());
65  hash_combine(m_varcoeff_hashes[i], (int)x.first);
66  i++;
67  }
68  }
LibUtilities::PointsType m_nodalPointsType
Definition: StdMatrixKey.h:177
Array< OneD, const LibUtilities::BasisSharedPtr > m_base
Definition: StdMatrixKey.h:173
LibUtilities::ShapeType m_shapeType
Definition: StdMatrixKey.h:172
std::vector< std::size_t > m_varcoeff_hashes
Definition: StdMatrixKey.h:182
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::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 70 of file StdMatrixKey.cpp.

71  :
72  m_shapeType(rhs.m_shapeType),
73  m_base(rhs.m_base),
74  m_ncoeffs(rhs.m_ncoeffs),
75  m_matrixType(matrixType),
76  m_nodalPointsType(rhs.m_nodalPointsType),
77  m_factors(rhs.m_factors),
78  m_varcoeffs(rhs.m_varcoeffs),
79  m_varcoeff_hashes(rhs.m_varcoeff_hashes)
80  {
81  }

◆ StdMatrixKey() [3/4]

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

Definition at line 83 of file StdMatrixKey.cpp.

83  :
84  m_shapeType(rhs.m_shapeType),
85  m_base(rhs.m_base),
86  m_ncoeffs(rhs.m_ncoeffs),
87  m_matrixType(rhs.m_matrixType),
88  m_nodalPointsType(rhs.m_nodalPointsType),
89  m_factors(rhs.m_factors),
90  m_varcoeffs(rhs.m_varcoeffs),
91  m_varcoeff_hashes(rhs.m_varcoeff_hashes)
92  {
93  }

◆ ~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 101 of file StdMatrixKey.h.

102  {
103  return m_base;
104  }

References m_base.

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

◆ GetBasis()

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

Definition at line 111 of file StdMatrixKey.h.

112  {
113  return(m_base[dir]);
114  }

References m_base.

Referenced by export_StdMatrixKey().

◆ GetConstFactor()

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

Definition at line 121 of file StdMatrixKey.h.

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

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

Referenced by Nektar::LocalRegions::HexExp::CreateMatrix(), Nektar::LocalRegions::NodalTriExp::CreateMatrix(), Nektar::LocalRegions::PrismExp::CreateMatrix(), Nektar::LocalRegions::PyrExp::CreateMatrix(), Nektar::LocalRegions::QuadExp::CreateMatrix(), Nektar::LocalRegions::SegExp::CreateMatrix(), Nektar::LocalRegions::TetExp::CreateMatrix(), Nektar::LocalRegions::TriExp::CreateMatrix(), Nektar::StdRegions::StdExpansion::HelmholtzMatrixOp_MatFree_GenericImpl(), Nektar::StdRegions::StdExpansion::LaplacianMatrixOp_MatFree(), Nektar::StdRegions::StdExpansion::LinearAdvectionDiffusionReactionMatrixOp_MatFree(), 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 81 of file StdMatrixKey.h.

82  {
83  return m_matrixType;
84  }

References m_matrixType.

Referenced by Nektar::StdRegions::StdExpansion::CreateGeneralMatrix(), Nektar::LocalRegions::HexExp::CreateMatrix(), Nektar::LocalRegions::NodalTriExp::CreateMatrix(), Nektar::LocalRegions::PrismExp::CreateMatrix(), Nektar::LocalRegions::PyrExp::CreateMatrix(), Nektar::LocalRegions::QuadExp::CreateMatrix(), Nektar::LocalRegions::SegExp::CreateMatrix(), Nektar::LocalRegions::TetExp::CreateMatrix(), Nektar::LocalRegions::TriExp::CreateMatrix(), Nektar::LocalRegions::HexExp::CreateStaticCondMatrix(), Nektar::LocalRegions::NodalTriExp::CreateStaticCondMatrix(), Nektar::LocalRegions::PrismExp::CreateStaticCondMatrix(), Nektar::LocalRegions::PyrExp::CreateStaticCondMatrix(), Nektar::LocalRegions::QuadExp::CreateStaticCondMatrix(), Nektar::LocalRegions::SegExp::CreateStaticCondMatrix(), Nektar::LocalRegions::TetExp::CreateStaticCondMatrix(), Nektar::LocalRegions::TriExp::CreateStaticCondMatrix(), export_StdMatrixKey(), Nektar::StdRegions::StdExpansion::GeneralMatrixOp(), Nektar::StdRegions::StdExpansion::GeneralMatrixOp_MatFree(), Nektar::LocalRegions::MatrixKey::opLess::operator()(), Nektar::StdRegions::operator<<(), 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::TetExp::v_GenMatrix(), Nektar::LocalRegions::TriExp::v_GenMatrix(), and Nektar::LocalRegions::SegExp::v_GenMatrix().

◆ GetNcoeffs()

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

Definition at line 96 of file StdMatrixKey.h.

97  {
98  return m_ncoeffs;
99  }

References m_ncoeffs.

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

◆ GetNConstFactors()

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

Definition at line 116 of file StdMatrixKey.h.

117  {
118  return m_factors.size();
119  }

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 154 of file StdMatrixKey.h.

155  {
156  VarCoeffMap m;
157  m[coeff] = GetVarCoeff(coeff);
158  return m;
159  }
const Array< OneD, const NekDouble > & GetVarCoeff(const StdRegions::VarCoeffType &coeff) const
Definition: StdMatrixKey.h:145
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:272

References GetVarCoeff().

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

◆ GetVarCoeffHashes()

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

Definition at line 106 of file StdMatrixKey.h.

107  {
108  return m_varcoeff_hashes;
109  }

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 101 of file StdMatrixKey.cpp.

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

◆ operator==

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

Definition at line 207 of file StdMatrixKey.cpp.

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

◆ 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 173 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 175 of file StdMatrixKey.h.

Referenced by GetNcoeffs().

◆ m_nodalPointsType

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

Definition at line 177 of file StdMatrixKey.h.

Referenced by GetNodalPointsType().

◆ m_shapeType

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

Definition at line 172 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 182 of file StdMatrixKey.h.

Referenced by GetVarCoeffHashes(), and StdMatrixKey().

◆ m_varcoeffs

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

Definition at line 180 of file StdMatrixKey.h.

Referenced by GetNVarCoeff(), GetVarCoeff(), GetVarCoeffs(), and HasVarCoeff().