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  {
61  x.second.begin(), x.second.begin() + stdExpansion.GetTotPoints());
62  hash_combine(m_varcoeff_hashes[i], (int)x.first);
63  i++;
64  }
65 }
LibUtilities::PointsType m_nodalPointsType
Definition: StdMatrixKey.h:183
Array< OneD, const LibUtilities::BasisSharedPtr > m_base
Definition: StdMatrixKey.h:179
LibUtilities::ShapeType m_shapeType
Definition: StdMatrixKey.h:178
std::vector< std::size_t > m_varcoeff_hashes
Definition: StdMatrixKey.h:188
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 67 of file StdMatrixKey.cpp.

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

◆ StdMatrixKey() [3/4]

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

Definition at line 76 of file StdMatrixKey.cpp.

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

◆ ~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:265

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::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 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  m[coeff] = GetVarCoeff(coeff);
164  return m;
165  }
const Array< OneD, const NekDouble > & GetVarCoeff(const StdRegions::VarCoeffType &coeff) const
Definition: StdMatrixKey.h:150
std::map< StdRegions::VarCoeffType, Array< OneD, NekDouble > > VarCoeffMap
Definition: StdRegions.hpp:240

References GetVarCoeff().

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

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

◆ operator==

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

Definition at line 198 of file StdMatrixKey.cpp.

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

◆ 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 179 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 181 of file StdMatrixKey.h.

Referenced by GetNcoeffs().

◆ m_nodalPointsType

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

Definition at line 183 of file StdMatrixKey.h.

Referenced by GetNodalPointsType().

◆ m_shapeType

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

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

Referenced by GetVarCoeffHashes(), and StdMatrixKey().

◆ m_varcoeffs

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

Definition at line 186 of file StdMatrixKey.h.

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