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

Describes the specification for a Basis. More...

#include <Basis.h>

Classes

struct  opLess
 

Public Member Functions

 BasisKey (const BasisType btype, const int nummodes, const PointsKey pkey)
 Constructor. More...
 
 BasisKey (const BasisKey &B)
 Copy constructor. More...
 
 ~BasisKey ()
 Destructor. More...
 
BasisKeyoperator= (const BasisKey &)=default
 Assignment operator. More...
 
int GetNumModes () const
 Returns the order of the basis. More...
 
int GetTotNumModes () const
 
int GetNumPoints () const
 Return points order at which basis is defined. More...
 
int GetTotNumPoints () const
 
BasisType GetBasisType () const
 Return type of expansion basis. More...
 
PointsKey GetPointsKey () const
 Return distribution of points. More...
 
PointsType GetPointsType () const
 Return type of quadrature. More...
 
bool SamePoints (const BasisKey &x) const
 Determine if quadrature of expansion x matches this. More...
 
bool SameExp (const BasisKey &x) const
 Determine if basis expansion x matches this. More...
 
bool ExactIprodInt () const
 Determine if basis has exact integration for inner product. More...
 
bool Collocation () const
 Determine if basis has collocation properties. More...
 

Protected Attributes

unsigned int m_nummodes
 Expansion order. More...
 
BasisType m_basistype
 Expansion type. More...
 
PointsKey m_pointsKey
 Points specification. More...
 

Private Member Functions

 BasisKey ()
 

Friends

bool operator== (const BasisKey &x, const BasisKey &y)
 Overloaded Operators. More...
 
bool operator== (const BasisKey *x, const BasisKey &y)
 
bool operator== (const BasisKey &x, const BasisKey *y)
 
bool operator!= (const BasisKey &x, const BasisKey &y)
 
bool operator!= (const BasisKey *x, const BasisKey &y)
 
bool operator!= (const BasisKey &x, const BasisKey *y)
 
bool operator< (const BasisKey &lhs, const BasisKey &rhs)
 
bool opLess::operator() (const BasisKey &lhs, const BasisKey &rhs) const
 

Detailed Description

Describes the specification for a Basis.

Definition at line 49 of file Basis.h.

Constructor & Destructor Documentation

◆ BasisKey() [1/3]

Nektar::LibUtilities::BasisKey::BasisKey ( const BasisType  btype,
const int  nummodes,
const PointsKey  pkey 
)
inline

Constructor.

Definition at line 62 of file Basis.h.

63  : m_nummodes(nummodes), m_basistype(btype), m_pointsKey(pkey)
64  {
65  }
unsigned int m_nummodes
Expansion order.
Definition: Basis.h:196
PointsKey m_pointsKey
Points specification.
Definition: Basis.h:198
BasisType m_basistype
Expansion type.
Definition: Basis.h:197

◆ BasisKey() [2/3]

Nektar::LibUtilities::BasisKey::BasisKey ( const BasisKey B)
inline

Copy constructor.

Definition at line 68 of file Basis.h.

69  : m_nummodes(B.m_nummodes), m_basistype(B.m_basistype),
70  m_pointsKey(B.m_pointsKey)
71  {
72  }

◆ ~BasisKey()

Nektar::LibUtilities::BasisKey::~BasisKey ( )
inline

Destructor.

Definition at line 75 of file Basis.h.

76  {
77  }

◆ BasisKey() [3/3]

Nektar::LibUtilities::BasisKey::BasisKey ( )
inlineprivate

Definition at line 201 of file Basis.h.

202  {
204  "Default Constructor BasisKey should never be called");
205  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:209
static const PointsKey NullPointsKey(0, eNoPointsType)

References Nektar::ErrorUtil::efatal, and NEKERROR.

Member Function Documentation

◆ Collocation()

bool Nektar::LibUtilities::BasisKey::Collocation ( ) const

Determine if basis has collocation properties.

Determine if basis has collocation property, i.e. GLL_Lagrange with Lobatto integration of appropriate order, Gauss_Lagrange with Gauss integration of appropriate order.

Definition at line 888 of file Foundations/Basis.cpp.

889 {
890  return ((m_basistype == eGLL_Lagrange &&
892  GetNumModes() == GetNumPoints()) ||
895  GetNumModes() == GetNumPoints()));
896 }
int GetNumPoints() const
Return points order at which basis is defined.
Definition: Basis.h:130
int GetNumModes() const
Returns the order of the basis.
Definition: Basis.h:83
PointsType GetPointsType() const
Return type of quadrature.
Definition: Basis.h:153
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:53
@ eGaussGaussLegendre
1D Gauss-Gauss-Legendre quadrature points
Definition: PointsType.h:48
@ eGauss_Lagrange
Lagrange Polynomials using the Gauss points.
Definition: BasisType.h:59
@ eGLL_Lagrange
Lagrange for SEM basis .
Definition: BasisType.h:58

References Nektar::LibUtilities::eGauss_Lagrange, Nektar::LibUtilities::eGaussGaussLegendre, Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eGLL_Lagrange, GetNumModes(), GetNumPoints(), GetPointsType(), and m_basistype.

Referenced by Nektar::LibUtilities::Basis::Collocation(), and export_Basis().

◆ ExactIprodInt()

bool Nektar::LibUtilities::BasisKey::ExactIprodInt ( void  ) const

Determine if basis has exact integration for inner product.

Determine if polynomial basis can be eactly integrated with itself.

Definition at line 861 of file Foundations/Basis.cpp.

862 {
863  bool returnval = false;
864 
865  switch (GetPointsType())
866  {
867  case eGaussGaussLegendre:
871  case eGaussKronrodLegendre:
874  returnval = (GetNumPoints() >= GetNumModes());
875  break;
876 
877  default:
878  break;
879  }
880 
881  return returnval;
882 }
@ eGaussRadauMLegendre
1D Gauss-Radau-Legendre quadrature points, pinned at x=-1
Definition: PointsType.h:49
@ eGaussRadauKronrodMLegendre
1D Gauss-Radau-Kronrod-Legendre quadrature points, pinned at x=-1
Definition: PointsType.h:69
@ eGaussLobattoKronrodLegendre
1D Lobatto Kronrod quadrature points
Definition: PointsType.h:74
@ eGaussRadauPLegendre
1D Gauss-Radau-Legendre quadrature points, pinned at x=1
Definition: PointsType.h:51

References Nektar::LibUtilities::eGaussGaussLegendre, Nektar::LibUtilities::eGaussLobattoKronrodLegendre, Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::eGaussRadauKronrodMLegendre, Nektar::LibUtilities::eGaussRadauMLegendre, Nektar::LibUtilities::eGaussRadauPLegendre, GetNumModes(), GetNumPoints(), and GetPointsType().

Referenced by Nektar::LibUtilities::Basis::ExactIprodInt().

◆ GetBasisType()

BasisType Nektar::LibUtilities::BasisKey::GetBasisType ( ) const
inline

◆ GetNumModes()

int Nektar::LibUtilities::BasisKey::GetNumModes ( ) const
inline

◆ GetNumPoints()

int Nektar::LibUtilities::BasisKey::GetNumPoints ( ) const
inline

◆ GetPointsKey()

PointsKey Nektar::LibUtilities::BasisKey::GetPointsKey ( ) const
inline

◆ GetPointsType()

PointsType Nektar::LibUtilities::BasisKey::GetPointsType ( ) const
inline

◆ GetTotNumModes()

int Nektar::LibUtilities::BasisKey::GetTotNumModes ( ) const
inline
Todo:
Generalise to arbitrary polynomials

Definition at line 89 of file Basis.h.

90  {
91  int value = 0;
92 
93  switch (m_basistype)
94  {
95  case eOrtho_B:
96  case eModified_B:
97  value = m_nummodes * (m_nummodes + 1) / 2;
98  break;
99 
100  case eModified_C:
101  case eOrtho_C:
102  value = m_nummodes * (m_nummodes + 1) * (m_nummodes + 2) / 6;
103  break;
104  case eModifiedPyr_C:
105  case eOrthoPyr_C:
106  value =
107  m_nummodes * (m_nummodes + 1) * (2 * m_nummodes + 1) / 6;
108  break;
109  case eOrtho_A:
110  case eModified_A:
111  case eFourier:
112  case eGLL_Lagrange:
113  case eGauss_Lagrange:
114  case eLegendre:
115  case eChebyshev:
116  case eMonomial:
117  case eFourierSingleMode:
118  case eFourierHalfModeRe:
119  case eFourierHalfModeIm:
120  value = m_nummodes;
121  break;
122 
123  default:
124  NEKERROR(ErrorUtil::efatal, "Unknown basis being used");
125  }
126  return value;
127  }
@ eModified_B
Principle Modified Functions .
Definition: BasisType.h:51
@ eOrtho_A
Principle Orthogonal Functions .
Definition: BasisType.h:44
@ eModified_C
Principle Modified Functions .
Definition: BasisType.h:52
@ eFourierSingleMode
Fourier ModifiedExpansion with just the first mode .
Definition: BasisType.h:66
@ eChebyshev
Chebyshev Polynomials.
Definition: BasisType.h:63
@ eOrtho_C
Principle Orthogonal Functions .
Definition: BasisType.h:48
@ eModifiedPyr_C
Principle Modified Functions.
Definition: BasisType.h:55
@ eOrtho_B
Principle Orthogonal Functions .
Definition: BasisType.h:46
@ eModified_A
Principle Modified Functions .
Definition: BasisType.h:50
@ eFourierHalfModeIm
Fourier Modified expansions with just the imaginary part of the first mode .
Definition: BasisType.h:70
@ eFourierHalfModeRe
Fourier Modified expansions with just the real part of the first mode .
Definition: BasisType.h:68
@ eOrthoPyr_C
Principle Orthogonal Functions .
Definition: BasisType.h:53
@ eFourier
Fourier Expansion .
Definition: BasisType.h:57

References Nektar::LibUtilities::eChebyshev, Nektar::ErrorUtil::efatal, Nektar::LibUtilities::eFourier, Nektar::LibUtilities::eFourierHalfModeIm, Nektar::LibUtilities::eFourierHalfModeRe, Nektar::LibUtilities::eFourierSingleMode, Nektar::LibUtilities::eGauss_Lagrange, Nektar::LibUtilities::eGLL_Lagrange, Nektar::LibUtilities::eModified_A, Nektar::LibUtilities::eModified_B, Nektar::LibUtilities::eModified_C, Nektar::LibUtilities::eModifiedPyr_C, Nektar::LibUtilities::eOrtho_A, Nektar::LibUtilities::eOrtho_B, Nektar::LibUtilities::eOrtho_C, Nektar::LibUtilities::eOrthoPyr_C, m_basistype, m_nummodes, and NEKERROR.

Referenced by export_Basis(), and Nektar::LibUtilities::Basis::GetTotNumModes().

◆ GetTotNumPoints()

int Nektar::LibUtilities::BasisKey::GetTotNumPoints ( ) const
inline

Definition at line 135 of file Basis.h.

136  {
137  return m_pointsKey.GetTotNumPoints();
138  }
unsigned int GetTotNumPoints() const
Definition: Points.h:177

References Nektar::LibUtilities::PointsKey::GetTotNumPoints(), and m_pointsKey.

Referenced by export_Basis(), and Nektar::LibUtilities::Basis::GetTotNumPoints().

◆ operator=()

BasisKey& Nektar::LibUtilities::BasisKey::operator= ( const BasisKey )
default

Assignment operator.

◆ SameExp()

bool Nektar::LibUtilities::BasisKey::SameExp ( const BasisKey x) const
inline

Determine if basis expansion x matches this.

Definition at line 165 of file Basis.h.

166  {
167  return ((x.m_nummodes == m_nummodes) && (x.m_basistype == m_basistype));
168  }

References m_basistype, and m_nummodes.

◆ SamePoints()

bool Nektar::LibUtilities::BasisKey::SamePoints ( const BasisKey x) const
inline

Determine if quadrature of expansion x matches this.

Definition at line 159 of file Basis.h.

160  {
161  return (x.m_pointsKey == m_pointsKey);
162  }

References m_pointsKey.

Friends And Related Function Documentation

◆ operator!= [1/3]

bool operator!= ( const BasisKey x,
const BasisKey y 
)
friend

Definition at line 919 of file Foundations/Basis.cpp.

920 {
921  return (!(x == y));
922 }

◆ operator!= [2/3]

bool operator!= ( const BasisKey x,
const BasisKey y 
)
friend

Definition at line 931 of file Foundations/Basis.cpp.

932 {
933  return (!(x == *y));
934 }

◆ operator!= [3/3]

bool operator!= ( const BasisKey x,
const BasisKey y 
)
friend

Definition at line 925 of file Foundations/Basis.cpp.

926 {
927  return (!(*x == y));
928 }

◆ operator<

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

Definition at line 50 of file Foundations/Basis.cpp.

51 {
52  PointsKey lhsPointsKey = lhs.GetPointsKey();
53  PointsKey rhsPointsKey = rhs.GetPointsKey();
54 
55  if (lhsPointsKey < rhsPointsKey)
56  {
57  return true;
58  }
59  if (lhsPointsKey != rhsPointsKey)
60  {
61  return false;
62  }
63 
64  if (lhs.m_nummodes < rhs.m_nummodes)
65  {
66  return true;
67  }
68  if (lhs.m_nummodes > rhs.m_nummodes)
69  {
70  return false;
71  }
72 
73  return (lhs.m_basistype < rhs.m_basistype);
74 }

◆ operator== [1/3]

bool operator== ( const BasisKey x,
const BasisKey y 
)
friend

Overloaded Operators.

Definition at line 899 of file Foundations/Basis.cpp.

900 {
901  return (x.GetPointsKey() == y.GetPointsKey() &&
902  x.m_basistype == y.m_basistype &&
903  x.GetNumModes() == y.GetNumModes());
904 }

◆ operator== [2/3]

bool operator== ( const BasisKey x,
const BasisKey y 
)
friend

Definition at line 913 of file Foundations/Basis.cpp.

914 {
915  return (x == *y);
916 }

◆ operator== [3/3]

bool operator== ( const BasisKey x,
const BasisKey y 
)
friend

Definition at line 907 of file Foundations/Basis.cpp.

908 {
909  return (*x == y);
910 }

◆ opLess::operator()

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

Member Data Documentation

◆ m_basistype

BasisType Nektar::LibUtilities::BasisKey::m_basistype
protected

◆ m_nummodes

unsigned int Nektar::LibUtilities::BasisKey::m_nummodes
protected

Expansion order.

Definition at line 196 of file Basis.h.

Referenced by GetNumModes(), GetTotNumModes(), and SameExp().

◆ m_pointsKey

PointsKey Nektar::LibUtilities::BasisKey::m_pointsKey
protected

Points specification.

Definition at line 198 of file Basis.h.

Referenced by GetNumPoints(), GetPointsKey(), GetPointsType(), GetTotNumPoints(), and SamePoints().