specfem::shape_function¶
-
namespace shape_function¶
The shape_function namespace contains functions for computing shape functions and their derivatives.
specfem::shape_function::shape_function¶
2D Overload¶
-
template<typename T>
std::vector<T> specfem::shape_function::shape_function(const T xi, const T gamma, const int ngnod)¶ Calculate shape functions for a 2D element given natural coordinates \( (\xi, \gamma) \).
Returns a vector containing the values of the shape functions \( N_a(\xi, \gamma) \) at the specified integration point, where \( a = 1 \dots \text{ngnod} \).
- Template Parameters:
T – type of the shape function values (float, double)
- Parameters:
xi – \( \xi \) coordinate of the point.
gamma – \( \gamma \) coordinate of the point.
ngnod – Total number of control nodes per element.
- Returns:
std::vector<T> shape function values \( N_a(\xi, \gamma) \).
3D Overload¶
-
template<typename T>
std::vector<T> specfem::shape_function::shape_function(const T xi, const T eta, const T zeta, const int ngnod)¶ Calculate shape functions for a 3D element given natural coordinates \( (\xi, \eta, \zeta) \).
Returns a vector containing the values of the shape functions \( N_a(\xi, \eta, \zeta) \) at the specified integration point, where \( a = 1 \dots \text{ngnod} \).
- Template Parameters:
T – type of the shape function values (float, double)
- Parameters:
xi – \( \xi \) coordinate of the point.
eta – \( \eta \) coordinate of the point.
zeta – \( \zeta \) coordinate of the point.
ngnod – Total number of control nodes per element.
- Returns:
std::vector<T> shape function values \( N_a(\xi, \eta, \zeta) \).
specfem::shape_function::shape_function_derivatives¶
2D Overload¶
-
template<typename T>
std::vector<std::vector<T>> specfem::shape_function::shape_function_derivatives(const T xi, const T gamma, const int ngnod)¶ Calculate shape function derivatives for a 2D element given natural coordinates \( (\xi, \gamma) \).
Returns a matrix of derivatives:
\[\begin{split} \frac{\partial \mathbf{N}}{\partial \boldsymbol{\xi}} = \begin{pmatrix} \frac{\partial N_1}{\partial \xi} & \dots & \frac{\partial N_{\text{ngnod}}}{\partial \xi} \\ \frac{\partial N_1}{\partial \gamma} & \dots & \frac{\partial N_{\text{ngnod}}}{\partial \gamma} \end{pmatrix} \end{split}\]- Template Parameters:
T – type of the shape function values (float, double)
- Parameters:
xi – \( \xi \) coordinate of the point.
gamma – \( \gamma \) coordinate of the point.
ngnod – Total number of control nodes per element.
- Returns:
std::vector<std::vector<T>> Matrix of shape function derivatives (size: \( 2 \times \text{ngnod} \)).
3D Overload¶
-
template<typename T>
std::vector<std::vector<T>> specfem::shape_function::shape_function_derivatives(const T xi, const T eta, const T zeta, const int ngnod)¶ Calculate shape function derivatives for a 3D element given natural coordinates \( (\xi, \eta, \zeta) \).
Returns a matrix of derivatives:
\[\begin{split} \frac{\partial \mathbf{N}}{\partial \boldsymbol{\xi}} = \begin{pmatrix} \frac{\partial N_1}{\partial \xi} & \dots & \frac{\partial N_{\text{ngnod}}}{\partial \xi} \\ \frac{\partial N_1}{\partial \eta} & \dots & \frac{\partial N_{\text{ngnod}}}{\partial \eta} \\ \frac{\partial N_1}{\partial \zeta} & \dots & \frac{\partial N_{\text{ngnod}}}{\partial \zeta} \end{pmatrix} \end{split}\]- Template Parameters:
T – type of the shape function values (float, double)
- Parameters:
xi – \( \xi \) coordinate of the point.
eta – \( \eta \) coordinate of the point.
zeta – \( \zeta \) coordinate of the point.
ngnod – Total number of control nodes per element.
- Returns:
std::vector<std::vector<T>> Matrix of shape function derivatives (size: \( 3 \times \text{ngnod} \)).