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 size_t nummodes, const PointsKey pkey)
 Constructor. More...
 
 BasisKey (const BasisKey &B)=default
 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

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

Private Member Functions

 BasisKey ()=delete
 

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

Constructor & Destructor Documentation

◆ BasisKey() [1/3]

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

Constructor.

Definition at line 57 of file Basis.h.

58 : m_nummodes(nummodes), m_basistype(btype), m_pointsKey(pkey)
59 {
60 }
PointsKey m_pointsKey
Points specification.
Definition: Basis.h:187
size_t m_nummodes
Expansion order.
Definition: Basis.h:185
BasisType m_basistype
Expansion type.
Definition: Basis.h:186

◆ BasisKey() [2/3]

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

Copy constructor.

◆ ~BasisKey()

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

Destructor.

Definition at line 66 of file Basis.h.

67 {
68 }

◆ BasisKey() [3/3]

Nektar::LibUtilities::BasisKey::BasisKey ( )
privatedelete

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

892{
893 return ((m_basistype == eGLL_Lagrange &&
895 GetNumModes() == GetNumPoints()) ||
898 GetNumModes() == GetNumPoints()));
899}
int GetNumPoints() const
Return points order at which basis is defined.
Definition: Basis.h:120
int GetNumModes() const
Returns the order of the basis.
Definition: Basis.h:74
PointsType GetPointsType() const
Return type of quadrature.
Definition: Basis.h:143
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:51
@ eGaussGaussLegendre
1D Gauss-Gauss-Legendre quadrature points
Definition: PointsType.h:46
@ eGauss_Lagrange
Lagrange Polynomials using the Gauss points.
Definition: BasisType.h:57
@ eGLL_Lagrange
Lagrange for SEM basis .
Definition: BasisType.h:56

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().

◆ ExactIprodInt()

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

Determine if basis has exact integration for inner product.

Determine if polynomial basis can be exactly integrated with itself.

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

865{
866 bool returnval = false;
867
868 switch (GetPointsType())
869 {
874 case eGaussKronrodLegendre:
877 returnval = (GetNumPoints() >= GetNumModes());
878 break;
879
880 default:
881 break;
882 }
883
884 return returnval;
885}
@ eGaussRadauMLegendre
1D Gauss-Radau-Legendre quadrature points, pinned at x=-1
Definition: PointsType.h:47
@ eGaussRadauKronrodMLegendre
1D Gauss-Radau-Kronrod-Legendre quadrature points, pinned at x=-1
Definition: PointsType.h:67
@ eGaussLobattoKronrodLegendre
1D Lobatto Kronrod quadrature points
Definition: PointsType.h:72
@ eGaussRadauPLegendre
1D Gauss-Radau-Legendre quadrature points, pinned at x=1
Definition: PointsType.h:49

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

81 {
82 size_t value = 0;
83
84 switch (m_basistype)
85 {
86 case eOrtho_B:
87 case eModified_B:
88 value = m_nummodes * (m_nummodes + 1) / 2;
89 break;
90 case eModified_C:
91 case eOrtho_C:
92 value = m_nummodes * (m_nummodes + 1) * (m_nummodes + 2) / 6;
93 break;
94 case eModifiedPyr_C:
95 case eOrthoPyr_C:
96 value =
97 m_nummodes * (m_nummodes + 1) * (2 * m_nummodes + 1) / 6;
98 break;
99 case eOrtho_A:
100 case eModified_A:
101 case eFourier:
102 case eGLL_Lagrange:
103 case eGauss_Lagrange:
104 case eLegendre:
105 case eChebyshev:
106 case eMonomial:
110 value = m_nummodes;
111 break;
112
113 default:
114 NEKERROR(ErrorUtil::efatal, "Unknown basis being used");
115 }
116 return value;
117 }
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mode...
Definition: ErrorUtil.hpp:202
@ eModified_B
Principle Modified Functions .
Definition: BasisType.h:49
@ eOrtho_A
Principle Orthogonal Functions .
Definition: BasisType.h:42
@ eModified_C
Principle Modified Functions .
Definition: BasisType.h:50
@ eFourierSingleMode
Fourier ModifiedExpansion with just the first mode .
Definition: BasisType.h:64
@ eChebyshev
Chebyshev Polynomials.
Definition: BasisType.h:61
@ eOrtho_C
Principle Orthogonal Functions .
Definition: BasisType.h:46
@ eModifiedPyr_C
Principle Modified Functions.
Definition: BasisType.h:53
@ eOrtho_B
Principle Orthogonal Functions .
Definition: BasisType.h:44
@ eModified_A
Principle Modified Functions .
Definition: BasisType.h:48
@ eFourierHalfModeIm
Fourier Modified expansions with just the imaginary part of the first mode .
Definition: BasisType.h:68
@ eFourierHalfModeRe
Fourier Modified expansions with just the real part of the first mode .
Definition: BasisType.h:66
@ eOrthoPyr_C
Principle Orthogonal Functions .
Definition: BasisType.h:51
@ eFourier
Fourier Expansion .
Definition: BasisType.h:55

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 Nektar::LibUtilities::Basis::GetTotNumModes().

◆ GetTotNumPoints()

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

Definition at line 125 of file Basis.h.

126 {
128 }
size_t GetTotNumPoints() const
Definition: Points.h:158

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

Referenced by 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 155 of file Basis.h.

156 {
157 return ((x.m_nummodes == m_nummodes) && (x.m_basistype == m_basistype));
158 }

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

150 {
151 return (x.m_pointsKey == m_pointsKey);
152 }

References m_pointsKey.

Friends And Related Function Documentation

◆ operator!= [1/3]

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

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

923{
924 return (!(x == y));
925}

◆ operator!= [2/3]

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

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

935{
936 return (!(x == *y));
937}

◆ operator!= [3/3]

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

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

929{
930 return (!(*x == y));
931}

◆ operator<

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

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

45{
46 PointsKey lhsPointsKey = lhs.GetPointsKey();
47 PointsKey rhsPointsKey = rhs.GetPointsKey();
48
49 if (lhsPointsKey < rhsPointsKey)
50 {
51 return true;
52 }
53 if (lhsPointsKey != rhsPointsKey)
54 {
55 return false;
56 }
57
58 if (lhs.m_nummodes < rhs.m_nummodes)
59 {
60 return true;
61 }
62 if (lhs.m_nummodes > rhs.m_nummodes)
63 {
64 return false;
65 }
66
67 return (lhs.m_basistype < rhs.m_basistype);
68}

◆ operator== [1/3]

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

Overloaded Operators.

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

903{
904 return (x.GetPointsKey() == y.GetPointsKey() &&
905 x.m_basistype == y.m_basistype &&
906 x.GetNumModes() == y.GetNumModes());
907}

◆ operator== [2/3]

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

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

917{
918 return (x == *y);
919}

◆ operator== [3/3]

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

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

911{
912 return (*x == y);
913}

◆ 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

size_t Nektar::LibUtilities::BasisKey::m_nummodes
protected

Expansion order.

Definition at line 185 of file Basis.h.

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

◆ m_pointsKey

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

Points specification.

Definition at line 187 of file Basis.h.

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