Nektar++
|
Represents a basis of a given type. More...
#include <Basis.h>
Public Member Functions | |
virtual | ~Basis () |
Destructor. More... | |
int | GetNumModes () const |
Return order of basis from the basis specification. More... | |
int | GetTotNumModes () const |
Return total number of modes from the basis specification. More... | |
int | GetNumPoints () const |
Return the number of points from the basis specification. More... | |
int | GetTotNumPoints () const |
Return total number of points from the basis specification. More... | |
BasisType | GetBasisType () const |
Return the type of expansion basis. More... | |
PointsKey | GetPointsKey () const |
Return the points specification for the basis. More... | |
PointsType | GetPointsType () const |
Return the type of quadrature. More... | |
const Array< OneD, const NekDouble > & | GetZ () const |
const Array< OneD, const NekDouble > & | GetW () const |
void | GetZW (Array< OneD, const NekDouble > &z, Array< OneD, const NekDouble > &w) const |
const Array< OneD, const NekDouble > & | GetBaryWeights () const |
const std::shared_ptr< NekMatrix< NekDouble > > & | GetD (Direction dir=xDir) const |
const std::shared_ptr< NekMatrix< NekDouble > > | GetI (const Array< OneD, const NekDouble > &x) |
const std::shared_ptr< NekMatrix< NekDouble > > | GetI (const BasisKey &bkey) |
bool | ExactIprodInt () const |
Determine if basis has exact integration for inner product. More... | |
bool | Collocation () const |
Determine if basis has collocation properties. More... | |
const Array< OneD, const NekDouble > & | GetBdata () const |
Return basis definition array m_bdata. More... | |
const Array< OneD, const NekDouble > & | GetDbdata () const |
Return basis definition array m_dbdata. More... | |
const BasisKey | GetBasisKey () const |
Returns the specification for the Basis. More... | |
void | Initialize () |
Static Public Member Functions | |
static std::shared_ptr< Basis > | Create (const BasisKey &bkey) |
Returns a new instance of a Basis with given BasisKey. More... | |
Protected Attributes | |
BasisKey | m_basisKey |
Basis specification. More... | |
PointsSharedPtr | m_points |
Set of points. More... | |
Array< OneD, NekDouble > | m_bdata |
Basis definition. More... | |
Array< OneD, NekDouble > | m_dbdata |
Derivative Basis definition. More... | |
NekManager< BasisKey, NekMatrix< NekDouble >, BasisKey::opLess > | m_InterpManager |
Private Member Functions | |
Basis (const BasisKey &bkey) | |
Private constructor with BasisKey. More... | |
Basis ()=delete | |
Private default constructor. More... | |
std::shared_ptr< NekMatrix< NekDouble > > | CalculateInterpMatrix (const BasisKey &tbasis0) |
Calculate the interpolation Matrix for coefficient from one base (m_basisKey) to another (tbasis0) More... | |
void | GenBasis () |
Generate appropriate basis and their derivatives. More... | |
Static Private Attributes | |
static bool | initBasisManager |
|
inlinevirtual |
|
private |
Private constructor with BasisKey.
Definition at line 90 of file Foundations/Basis.cpp.
References CalculateInterpMatrix(), and m_InterpManager.
|
privatedelete |
Private default constructor.
Referenced by Create().
|
private |
Calculate the interpolation Matrix for coefficient from one base (m_basisKey) to another (tbasis0)
Definition at line 120 of file Foundations/Basis.cpp.
References Nektar::LibUtilities::BasisManager(), Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::BasisKey::GetBasisType(), Nektar::LibUtilities::BasisKey::GetNumModes(), and m_basisKey.
Referenced by Basis().
|
inline |
Determine if basis has collocation properties.
Definition at line 295 of file Basis.h.
References Nektar::LibUtilities::BasisKey::Collocation(), and m_basisKey.
Returns a new instance of a Basis with given BasisKey.
Definition at line 99 of file Foundations/Basis.cpp.
References Basis().
|
inline |
Determine if basis has exact integration for inner product.
Definition at line 289 of file Basis.h.
References Nektar::LibUtilities::BasisKey::ExactIprodInt(), and m_basisKey.
|
private |
Generate appropriate basis and their derivatives.
The following expansions are generated depending on the enum type defined in m_basisKey.m_basistype:
NOTE: This definition does not follow the order in the Karniadakis & Sherwin book since this leads to a more compact hierarchical pattern for implementation purposes. The order of these modes dictates the ordering of the expansion coefficients.
In the following m_numModes = P
eModified_A:
m_bdata[i + j*m_numpoints] = \( \phi^a_i(z_j) = \left \{ \begin{array}{ll} \left ( \frac{1-z_j}{2}\right ) & i = 0 \\ \\ \left ( \frac{1+z_j}{2}\right ) & i = 1 \\ \\ \left ( \frac{1-z_j}{2}\right )\left ( \frac{1+z_j}{2}\right ) P^{1,1}_{i-2}(z_j) & 2\leq i < P\\ \end{array} \right . \)
eModified_B:
m_bdata[n(i,j) + k*m_numpoints] = \( \phi^b_{ij}(z_k) = \left \{ \begin{array}{lll} \phi^a_j(z_k) & i = 0, & 0\leq j < P \\ \\ \left ( \frac{1-z_k}{2}\right )^{i} & 1 \leq i < P,& j = 0 \\ \\ \left ( \frac{1-z_k}{2}\right )^{i} \left ( \frac{1+z_k}{2}\right ) P^{2i-1,1}_{j-1}(z_k) & 1 \leq i < P,\ & 1\leq j < P-i\ \\ \end{array} \right . , \)
where \( n(i,j) \) is a consecutive ordering of the triangular indices \( 0 \leq i, i+j < P \) where j runs fastest.
eModified_C:
m_bdata[n(i,j,k) + l*m_numpoints] = \( \phi^c_{ij,k}(z_l) = \phi^b_{i+j,k}(z_l) = \left \{ \begin{array}{llll} \phi^b_{j,k}(z_l) & i = 0, & 0\leq j < P & 0\leq k < P-j\\ \\ \left ( \frac{1-z_l}{2}\right )^{i+j} & 1\leq i < P,\ & 0\leq j < P-i,\ & k = 0 \\ \\ \left ( \frac{1-z_l}{2}\right )^{i+j} \left ( \frac{1+z_l}{2}\right ) P^{2i+2j-1,1}_{k-1}(z_k) & 1\leq i < P,& 0\leq j < P-i& 1\leq k < P-i-j \\ \\ \end{array} \right . , \)
where \( n(i,j,k) \) is a consecutive ordering of the triangular indices \( 0 \leq i, i+j, i+j+k < P \) where k runs fastest, then j and finally i.
Orthogonal basis A
\(\tilde \psi_p^a (\eta_1) = L_p(\eta_1) = P_p^{0,0}(\eta_1)\)
Orthogonal basis B
\(\tilde \psi_{pq}^b(\eta_2) = \left ( {1 - \eta_2} \over 2 \right)^p P_q^{2p+1,0}(\eta_2)\) \
Orthogonal basis C
\(\tilde \psi_{pqr}^c = \left ( {1 - \eta_3} \over 2 \right)^{p+q} P_r^{2p+2q+2, 0}(\eta_3)\) \ \
Orthogonal basis C for Pyramid expansion (which is richer than tets)
\(\tilde \psi_{pqr}^c = \left ( {1 - \eta_3} \over 2\right)^{pq} P_r^{2pq+2, 0}(\eta_3)\) \( \mbox{where }pq = max(p+q,0) \)
This orthogonal expansion has modes that are always in the Cartesian space, however the equivalent ModifiedPyr_C has vertex modes that do not lie in this space. If one chooses \(pq = max(p+q-1,0)\) then the expansion will space the same space as the vertices but the order of the expanion in 'r' is reduced by one.
1) Eta_z values are the changing the fastest, then r, q, and finally p. 2) r index increases by the stride of numPoints.
Definition at line 216 of file Foundations/Basis.cpp.
References ASSERTL0, Nektar::LibUtilities::BasisManager(), Blas::Dgemm(), Nektar::LibUtilities::eChebyshev, Nektar::ErrorUtil::efatal, Nektar::LibUtilities::eFourier, Nektar::LibUtilities::eFourierHalfModeIm, Nektar::LibUtilities::eFourierHalfModeRe, Nektar::LibUtilities::eFourierSingleMode, Nektar::LibUtilities::eGauss_Lagrange, Nektar::LibUtilities::eGaussGaussLegendre, Nektar::LibUtilities::eGaussLobattoLegendre, 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, GetBasisType(), Nektar::LibUtilities::BasisKey::GetNumModes(), GetNumModes(), GetNumPoints(), Nektar::LibUtilities::BasisKey::GetPointsKey(), Polylib::hgj(), Polylib::hglj(), Polylib::jacobfd(), m_basisKey, m_bdata, m_dbdata, m_points, NEKERROR, Nektar::LibUtilities::P, CellMLToNektar.cellml_metadata::p, Nektar::LibUtilities::PointsManager(), Nektar::UnitTests::q(), tinysimd::sqrt(), Vmath::Vcopy(), Nektar::UnitTests::w(), and Nektar::UnitTests::z().
Referenced by Initialize().
|
inline |
Returns the specification for the Basis.
Definition at line 313 of file Basis.h.
References m_basisKey.
Referenced by Nektar::MultiRegions::ExpListHomogeneous2D::GenHomogeneous2DBlockMatrix().
|
inline |
Return the type of expansion basis.
Definition at line 231 of file Basis.h.
References Nektar::LibUtilities::BasisKey::GetBasisType(), and m_basisKey.
Referenced by GenBasis().
|
inline |
Definition at line 281 of file Basis.h.
References ASSERTL0, Nektar::LibUtilities::PointsKey::GetPointsDim(), Nektar::LibUtilities::BasisKey::GetPointsKey(), and m_InterpManager.
|
inline |
Return order of basis from the basis specification.
Definition at line 207 of file Basis.h.
References Nektar::LibUtilities::BasisKey::GetNumModes(), and m_basisKey.
Referenced by GenBasis(), Initialize(), and main().
|
inline |
Return the number of points from the basis specification.
Definition at line 219 of file Basis.h.
References Nektar::LibUtilities::BasisKey::GetNumPoints(), and m_basisKey.
Referenced by GenBasis().
|
inline |
Return the points specification for the basis.
Definition at line 237 of file Basis.h.
References Nektar::LibUtilities::BasisKey::GetPointsKey(), and m_basisKey.
|
inline |
Return the type of quadrature.
Definition at line 243 of file Basis.h.
References Nektar::LibUtilities::BasisKey::GetPointsType(), and m_basisKey.
|
inline |
Return total number of modes from the basis specification.
Definition at line 213 of file Basis.h.
References Nektar::LibUtilities::BasisKey::GetTotNumModes(), and m_basisKey.
|
inline |
Return total number of points from the basis specification.
Definition at line 225 of file Basis.h.
References Nektar::LibUtilities::BasisKey::GetTotNumPoints(), and m_basisKey.
Referenced by Initialize().
|
inline |
Definition at line 258 of file Basis.h.
References m_points, Nektar::UnitTests::w(), and Nektar::UnitTests::z().
void Nektar::LibUtilities::Basis::Initialize | ( | ) |
Definition at line 107 of file Foundations/Basis.cpp.
References ASSERTL0, GenBasis(), GetNumModes(), and GetTotNumPoints().
|
staticprivate |
|
protected |
Basis specification.
Definition at line 321 of file Basis.h.
Referenced by CalculateInterpMatrix(), Collocation(), ExactIprodInt(), GenBasis(), GetBasisKey(), GetBasisType(), GetNumModes(), GetNumPoints(), GetPointsKey(), GetPointsType(), GetTotNumModes(), and GetTotNumPoints().
Derivative Basis definition.
Definition at line 324 of file Basis.h.
Referenced by GenBasis(), and GetDbdata().
|
protected |
|
protected |
Set of points.
Definition at line 322 of file Basis.h.
Referenced by GenBasis(), GetBaryWeights(), GetD(), GetI(), GetW(), GetZ(), and GetZW().