Nektar++
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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...
 
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:191
PointsKey m_pointsKey
Points specification.
Definition: Basis.h:192
int m_nummodes
Expansion order.
Definition: Basis.h:190

◆ 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:191
PointsKey m_pointsKey
Points specification.
Definition: Basis.h:192
int m_nummodes
Expansion order.
Definition: Basis.h:190

◆ ~BasisKey()

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

Destructor.

Definition at line 78 of file Basis.h.

79  {
80  }

◆ BasisKey() [3/3]

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

Definition at line 195 of file Basis.h.

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

196  {
198  "Default Constructor BasisKey should never be called");
199  }
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:192

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:130
Lagrange Polynomials using the Gauss points .
Definition: BasisType.h:55
BasisType m_basistype
Expansion type.
Definition: Basis.h:191
1D Gauss-Gauss-Legendre quadrature points
Definition: PointsType.h:48
int GetNumModes() const
Returns the order of the basis.
Definition: Basis.h:83
PointsType GetPointsType() const
Return type of quadrature.
Definition: Basis.h:153
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:130
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:83
PointsType GetPointsType() const
Return type of quadrature.
Definition: Basis.h:153
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 89 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().

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 = m_nummodes*(m_nummodes+1)*(2*m_nummodes+1)/6;
107  break;
108  case eOrtho_A:
109  case eModified_A:
110  case eFourier:
111  case eGLL_Lagrange:
112  case eGauss_Lagrange:
113  case eLegendre:
114  case eChebyshev:
115  case eMonomial:
116  case eFourierSingleMode:
117  case eFourierHalfModeRe:
118  case eFourierHalfModeIm:
119  value = m_nummodes;
120  break;
121 
122  default:
123  NEKERROR(ErrorUtil::efatal,"Unknown basis being used");
124  }
125  return value;
126  }
#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:191
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:190
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 135 of file Basis.h.

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

Referenced by export_Basis().

136  {
137  return m_pointsKey.GetTotNumPoints();
138  }
PointsKey m_pointsKey
Points specification.
Definition: Basis.h:192
unsigned int GetTotNumPoints() const
Definition: Points.h:180

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

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

166  {
167  return ((x.m_nummodes == m_nummodes)
168  &&(x.m_basistype == m_basistype));
169  }
BasisType m_basistype
Expansion type.
Definition: Basis.h:191
int m_nummodes
Expansion order.
Definition: Basis.h:190

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

References m_pointsKey.

160  {
161  return (x.m_pointsKey == m_pointsKey);
162  }
PointsKey m_pointsKey
Points specification.
Definition: Basis.h:192

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

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