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

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 61 of file Basis.h.

62  :
63  m_nummodes(nummodes),
64  m_basistype(btype),
65  m_pointsKey(pkey)
66  {
67  }
BasisType m_basistype
Expansion type.
Definition: Basis.h:194
PointsKey m_pointsKey
Points specification.
Definition: Basis.h:195
int m_nummodes
Expansion order.
Definition: Basis.h:193

◆ BasisKey() [2/3]

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

Copy constructor.

Definition at line 70 of file Basis.h.

70  :
71  m_nummodes(B.m_nummodes),
72  m_basistype(B.m_basistype),
73  m_pointsKey(B.m_pointsKey)
74  {
75  }
BasisType m_basistype
Expansion type.
Definition: Basis.h:194
PointsKey m_pointsKey
Points specification.
Definition: Basis.h:195
int m_nummodes
Expansion order.
Definition: Basis.h:193

◆ ~BasisKey()

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

Destructor.

Definition at line 78 of file Basis.h.

References operator=().

79  {
80  }

◆ BasisKey() [3/3]

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

Definition at line 198 of file Basis.h.

References Nektar::ErrorUtil::efatal, Nektar::LibUtilities::eNoBasisType, NEKERROR, Nektar::LibUtilities::NullBasisKey(), and Nektar::LibUtilities::NullPointsKey().

199  {
201  "Default Constructor BasisKey should never be called");
202  }
static const PointsKey NullPointsKey(0, eNoPointsType)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
PointsKey m_pointsKey
Points specification.
Definition: Basis.h:195

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 860 of file Foundations/Basis.cpp.

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

Referenced by export_Basis(), and SameExp().

861  {
862  return ((m_basistype == eGLL_Lagrange &&
864  GetNumModes() == GetNumPoints()) ||
867  GetNumModes() == GetNumPoints()));
868  }
int GetNumPoints() const
Return points order at which basis is defined.
Definition: Basis.h:133
Lagrange Polynomials using the Gauss points .
Definition: BasisType.h:55
BasisType m_basistype
Expansion type.
Definition: Basis.h:194
1D Gauss-Gauss-Legendre quadrature points
Definition: PointsType.h:48
int GetNumModes() const
Returns the order of the basis.
Definition: Basis.h:86
PointsType GetPointsType() const
Return type of quadrature.
Definition: Basis.h:156
Lagrange for SEM basis .
Definition: BasisType.h:54
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:51

◆ 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 833 of file Foundations/Basis.cpp.

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

Referenced by SameExp().

834  {
835  bool returnval = false;
836 
837  switch(GetPointsType())
838  {
839  case eGaussGaussLegendre:
846  returnval = (GetNumPoints() >= GetNumModes());
847  break;
848 
849  default:
850  break;
851  }
852 
853  return returnval;
854  }
int GetNumPoints() const
Return points order at which basis is defined.
Definition: Basis.h:133
1D Gauss-Radau-Kronrod-Legendre quadrature points, pinned at x=-1
Definition: PointsType.h:61
1D Gauss-Radau-Legendre quadrature points, pinned at x=1
Definition: PointsType.h:50
1D Gauss-Kronrod-Legendre quadrature points
Definition: PointsType.h:60
1D Gauss-Gauss-Legendre quadrature points
Definition: PointsType.h:48
1D Lobatto Kronrod quadrature points
Definition: PointsType.h:63
int GetNumModes() const
Returns the order of the basis.
Definition: Basis.h:86
PointsType GetPointsType() const
Return type of quadrature.
Definition: Basis.h:156
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:51
1D Gauss-Radau-Legendre quadrature points, pinned at x=-1
Definition: PointsType.h:49

◆ 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 92 of file Basis.h.

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::eLegendre, Nektar::LibUtilities::eModified_A, Nektar::LibUtilities::eModified_B, Nektar::LibUtilities::eModified_C, Nektar::LibUtilities::eModifiedPyr_C, Nektar::LibUtilities::eMonomial, 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().

93  {
94  int value = 0;
95 
96  switch(m_basistype)
97  {
98  case eOrtho_B:
99  case eModified_B:
100  value = m_nummodes*(m_nummodes+1)/2;
101  break;
102 
103  case eModified_C:
104  case eOrtho_C:
105  value = m_nummodes*(m_nummodes+1)*(m_nummodes+2)/6;
106  break;
107  case eModifiedPyr_C:
108  case eOrthoPyr_C:
109  value = m_nummodes*(m_nummodes+1)*(2*m_nummodes+1)/6;
110  break;
111  case eOrtho_A:
112  case eModified_A:
113  case eFourier:
114  case eGLL_Lagrange:
115  case eGauss_Lagrange:
116  case eLegendre:
117  case eChebyshev:
118  case eMonomial:
119  case eFourierSingleMode:
120  case eFourierHalfModeRe:
121  case eFourierHalfModeIm:
122  value = m_nummodes;
123  break;
124 
125  default:
126  NEKERROR(ErrorUtil::efatal,"Unknown basis being used");
127  }
128  return value;
129  }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Definition: ErrorUtil.hpp:209
Principle Modified Functions .
Definition: BasisType.h:50
Principle Modified Functions .
Definition: BasisType.h:52
Principle Modified Functions .
Definition: BasisType.h:48
Lagrange Polynomials using the Gauss points .
Definition: BasisType.h:55
Fourier Expansion .
Definition: BasisType.h:53
Chebyshev Polynomials .
Definition: BasisType.h:57
BasisType m_basistype
Expansion type.
Definition: Basis.h:194
Principle Orthogonal Functions .
Definition: BasisType.h:46
Fourier Modified expansions with just the real part of the first mode .
Definition: BasisType.h:60
Principle Modified Functions .
Definition: BasisType.h:49
int m_nummodes
Expansion order.
Definition: Basis.h:193
Principle Orthogonal Functions .
Definition: BasisType.h:47
Principle Orthogonal Functions .
Definition: BasisType.h:45
Fourier Modified expansions with just the imaginary part of the first mode .
Definition: BasisType.h:61
Principle Orthogonal Functions .
Definition: BasisType.h:51
Fourier ModifiedExpansion with just the first mode .
Definition: BasisType.h:59
Legendre Polynomials . Same as Ortho_A.
Definition: BasisType.h:56
Lagrange for SEM basis .
Definition: BasisType.h:54
Monomial polynomials .
Definition: BasisType.h:58

◆ GetTotNumPoints()

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

Definition at line 138 of file Basis.h.

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

Referenced by export_Basis().

139  {
140  return m_pointsKey.GetTotNumPoints();
141  }
PointsKey m_pointsKey
Points specification.
Definition: Basis.h:195
unsigned int GetTotNumPoints() const
Definition: Points.h:180

◆ operator=()

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

Assignment operator.

Referenced by ~BasisKey().

◆ SameExp()

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

Determine if basis expansion x matches this.

Definition at line 168 of file Basis.h.

References Collocation(), ExactIprodInt(), Nektar::lhs, LIB_UTILITIES_EXPORT, m_basistype, m_nummodes, operator!=, Nektar::LibUtilities::BasisKey::opLess::operator()(), operator<, operator==, and Nektar::rhs.

169  {
170  return ((x.m_nummodes == m_nummodes)
171  &&(x.m_basistype == m_basistype));
172  }
BasisType m_basistype
Expansion type.
Definition: Basis.h:194
int m_nummodes
Expansion order.
Definition: Basis.h:193

◆ SamePoints()

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

Determine if quadrature of expansion x matches this.

Definition at line 162 of file Basis.h.

References m_pointsKey.

163  {
164  return (x.m_pointsKey == m_pointsKey);
165  }
PointsKey m_pointsKey
Points specification.
Definition: Basis.h:195

Friends And Related Function Documentation

◆ operator!= [1/3]

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

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

Referenced by SameExp().

892  {
893  return (!(x == y));
894  }

◆ operator!= [2/3]

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

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

898  {
899  return (!(*x == y));
900  }

◆ operator!= [3/3]

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

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

904  {
905  return (!(x == *y));
906  }

◆ operator<

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

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

Referenced by Nektar::LibUtilities::Basis::Basis(), and SameExp().

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

◆ operator== [1/3]

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

Overloaded Operators.

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

Referenced by SameExp().

872  {
873  return (x.GetPointsKey() == y.GetPointsKey() &&
874  x.m_basistype == y.m_basistype &&
875  x.GetNumModes() == y.GetNumModes());
876  }

◆ operator== [2/3]

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

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

880  {
881  return (*x == y);
882  }

◆ operator== [3/3]

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

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

886  {
887  return (x == *y);
888  }

◆ 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

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

Expansion order.

Definition at line 193 of file Basis.h.

Referenced by GetNumModes(), GetTotNumModes(), Nektar::LibUtilities::operator<(), and SameExp().

◆ m_pointsKey

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

Points specification.

Definition at line 195 of file Basis.h.

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