Loading...
Searching...
No Matches
CoordinateElement< T > Class Template Reference

`#include <CoordinateElement.h>`

## Public Types

template<typename X>
using | mdspan2_t = md::mdspan<X, md::dextents<std::size_t, 2>>
| mdspan typedef

## Public Member Functions

| CoordinateElement (std::shared_ptr< const basix::FiniteElement< T > > element)
| Create a coordinate element from a Basix element.
| CoordinateElement (mesh::CellType celltype, int degree, basix::element::lagrange_variant type=basix::element::lagrange_variant::unset)
| Create a Lagrange coordinate element.
virtual | ~CoordinateElement ()=default
| Destructor.
mesh::CellType | cell_shape () const
| Cell shape.
int | degree () const
| The polynomial degree of the element.
int | dim () const
| The dimension of the coordinate element space.
basix::element::lagrange_variant | variant () const
| Variant of the element.
std::uint64_t | hash () const
| Element hash.
std::array< std::size_t, 4 > | tabulate_shape (std::size_t nd, std::size_t num_points) const
| Shape of array to fill when calling tabulate.
void | tabulate (int nd, std::span< const T > X, std::array< std::size_t, 2 > shape, std::span< T > basis) const
| Evaluate basis values and derivatives at set of points.
void | permute_subentity_closure (std::span< std::int32_t > d, std::uint32_t cell_info, mesh::CellType entity_type, int entity_index) const
| Given the closure DOFs \(\tilde{d}\) of a cell sub-entity in reference ordering, this function computes the permuted degrees-of-freedom.
ElementDofLayout | create_dof_layout () const
| Compute and return the dof layout.
void | pull_back_nonaffine (mdspan2_t< T > X, mdspan2_t< const T > x, mdspan2_t< const T > cell_geometry, double tol=1.0e-6, int maxit=15) const
| Compute reference coordinates X for physical coordinates x for a non-affine map.
void | permute (std::span< std::int32_t > dofs, std::uint32_t cell_perm) const
| Permute a list of DOF numbers on a cell.
void | permute_inv (std::span< std::int32_t > dofs, std::uint32_t cell_perm) const
| Reverses a DOF permutation.
bool | needs_dof_permutations () const
| Indicates whether the geometry DOF numbers on each cell need permuting.
bool | is_affine () const noexcept

## Static Public Member Functions

template<typename U, typename V, typename W>
static void | compute_jacobian (const U &dphi, const V &cell_geometry, W &&J)
template<typename U, typename V>
static void | compute_jacobian_inverse (const U &J, V &&K)
| Compute the inverse of the Jacobian.
template<typename U>
static double | compute_jacobian_determinant (const U &J, std::span< typename U::value_type > w)
| Compute the determinant of the Jacobian.
template<typename U, typename V, typename W>
static void | push_forward (U &&x, const V &cell_geometry, const W &phi)
| Compute physical coordinates x for points X in the reference configuration.
template<typename U, typename V, typename W>
static void | pull_back_affine (U &&X, const V &K, std::array< T, 3 > x0, const W &x)
| Compute reference coordinates X for physical coordinates x for an affine map. For the affine case, x = J X + x0, and this function computes X = K(x -x0) where K = J^{-1}.

## Detailed Description

template<std::floating_point T>
class dolfinx::fem::CoordinateElement< T >

A CoordinateElement manages coordinate mappings for isoparametric cells.

Todo
  A dof layout on a reference cell needs to be defined.

Template Parameters

  T | Floating point (real) type for the geometry and for the element basis.

## Constructor & Destructor Documentation

## CoordinateElement() [1/2]

template<std::floating_point T>

CoordinateElement | ( | std::shared_ptr< const basix::FiniteElement< T > > | element | ) |

explicit

Create a coordinate element from a Basix element.

Parameters

  [in] | element | Basix finite element

## CoordinateElement() [2/2]

template<std::floating_point T>

CoordinateElement | ( | mesh::CellType | celltype,
|  | int | degree,
|  | basix::element::lagrange_variant | type = basix::element::lagrange_variant::unset )

Create a Lagrange coordinate element.

Parameters

  [in] | celltype | Cell shape.
  [in] | degree | Polynomial degree of the map.
  [in] | type | Type of Lagrange element (see Basix documentation for possible types).

## Member Function Documentation

## cell_shape()

template<std::floating_point T>

mesh::CellType cell_shape | ( |  | ) | const

Cell shape.

Returns
  The cell shape

## compute_jacobian()

template<std::floating_point T>
template<typename U, typename V, typename W>

void compute_jacobian | ( | const U & | dphi,
|  | const V & | cell_geometry,
|  | W && | J )

inline static

Compute Jacobian for a cell with given geometry using the basis functions and first order derivatives.

Parameters

  [in] | dphi | Derivatives of the basis functions (shape=(tdim, num geometry nodes))
  [in] | cell_geometry | The cell nodes coordinates (shape=(num geometry nodes, gdim))
  [out] | J | The Jacobian. It must have shape=(gdim, tdim) and must initialized to zero

## compute_jacobian_determinant()

template<std::floating_point T>
template<typename U>

double compute_jacobian_determinant | ( | const U & | J,
|  | std::span< typename U::value_type > | w )

inline static

Compute the determinant of the Jacobian.

Parameters

  [in] | J | Jacobian (shape=(gdim, tdim)).
  [in] | w | Working memory, required when gdim != tdim. Size must be at least 2 * gdim * tdim.

Returns
  Determinant of J.

## compute_jacobian_inverse()

template<std::floating_point T>
template<typename U, typename V>

void compute_jacobian_inverse | ( | const U & | J,
|  | V && | K )

inline static

Compute the inverse of the Jacobian.

Parameters

  [in] | J | Jacobian (shape=(gdim, tdim)).
  [out] | K | Inverse Jacobian (shape=(tdim, gdim)).

## degree()

template<std::floating_point T>

int degree | ( |  | ) | const

The polynomial degree of the element.

Returns
  The degree

## dim()

template<std::floating_point T>

int dim | ( |  | ) | const

The dimension of the coordinate element space.

The number of basis function is returned. E.g., for a linear triangle cell the dimension will be 3.

Returns
  Dimension of the coordinate element space.

## hash()

template<std::floating_point T>

std::uint64_t hash | ( |  | ) | const

Element hash.

This is the Basix element hash.

## is_affine()

template<std::floating_point T>

bool is_affine | ( |  | ) | const

inline noexcept

Check is geometry map is affine

Returns
  True is geometry map is affine

## needs_dof_permutations()

template<std::floating_point T>

bool needs_dof_permutations | ( |  | ) | const

Indicates whether the geometry DOF numbers on each cell need permuting.

For higher order geometries (where there is more than one DOF on a subentity of the cell), this will be true.

## permute_subentity_closure()

template<std::floating_point T>

void permute_subentity_closure | ( | std::span< std::int32_t > | d,
|  | std::uint32_t | cell_info,
|  | mesh::CellType | entity_type,
|  | int | entity_index ) const

Given the closure DOFs \(\tilde{d}\) of a cell sub-entity in reference ordering, this function computes the permuted degrees-of-freedom.

\[ d = P \tilde{d},\]

ordered to be consistent with the entity's mesh orientation, where \(P\) is a permutation matrix. This accounts for orientation discrepancies between the entity's cell and mesh orientation. All DOFs are rotated and reflected together, unlike permute, which considered sub-entities independently.

Parameters

  [in,out] | d | Indices associated with the reference element degree-of-freedom (in). Indices associated with each physical element degree-of-freedom (out).
  [in] | cell_info | Permutation info for the cell
  [in] | entity_type | The cell type of the sub-entity
  [in] | entity_index | The local (with respect to the cell) index of the entity

## pull_back_affine()

template<std::floating_point T>
template<typename U, typename V, typename W>

void pull_back_affine | ( | U && | X,
|  | const V & | K,
|  | std::array< T, 3 > | x0,
|  | const W & | x )

inline static

Compute reference coordinates X for physical coordinates x for an affine map. For the affine case, x = J X + x0, and this function computes X = K(x -x0) where K = J^{-1}.

Parameters

  [out] | X | Reference coordinates to compute (shape=(num_points, tdim)),
  [in] | K | Inverse of the geometry Jacobian (shape=(tdim, gdim)).
  [in] | x0 | Physical coordinate of reference coordinate X0=(0, 0, 0).
  [in] | x | Physical coordinates (shape=(num_points, gdim)).

## pull_back_nonaffine()

template<std::floating_point T>

void pull_back_nonaffine | ( | mdspan2_t< T > | X,
|  | mdspan2_t< const T > | x,
|  | mdspan2_t< const T > | cell_geometry,
|  | double | tol = 1.0e-6,
|  | int | maxit = 15 ) const

Compute reference coordinates X for physical coordinates x for a non-affine map.

Parameters

  [in,out] | X | The reference coordinates to compute (shape=(num_points, tdim)).
  [in] | x | Physical coordinates (shape=(num_points, gdim)).
  [in] | cell_geometry | Cell nodes coordinates (shape=(num geometry nodes, gdim)).
  [in] | tol | Tolerance for termination of Newton method.
  [in] | maxit | Maximum number of Newton iterations

Note
  If convergence is not achieved within maxit, the function throws a runtime error.

## push_forward()

template<std::floating_point T>
template<typename U, typename V, typename W>

void push_forward | ( | U && | x,
|  | const V & | cell_geometry,
|  | const W & | phi )

inline static

Compute physical coordinates x for points X in the reference configuration.

Parameters

  [in,out] | x | The physical coordinates of the reference points X (rank 2).
  [in] | cell_geometry | Cell node physical coordinates (rank 2).
  [in] | phi | Tabulated basis functions at reference points X (rank 2).

## tabulate()

template<std::floating_point T>

void tabulate | ( | int | nd,
|  | std::span< const T > | X,
|  | std::array< std::size_t, 2 > | shape,
|  | std::span< T > | basis ) const

Evaluate basis values and derivatives at set of points.

Parameters

  [in] | nd | The order of derivatives, up to and including, to compute. Use 0 for the basis functions only.
  [in] | X | The points at which to compute the basis functions. The shape of X is (number of points, geometric dimension).
  [in] | shape | The shape of X.
  [out] | basis | The array to fill with the basis function values. The shape can be computed using tabulate_shape.

## tabulate_shape()

template<std::floating_point T>

std::array< std::size_t, 4 > tabulate_shape | ( | std::size_t | nd,
|  | std::size_t | num_points ) const

Shape of array to fill when calling tabulate.

Parameters

  [in] | nd | The order of derivatives, up to and including, to compute. Use 0 for the basis functions only
  [in] | num_points | Number of points at which to evaluate the basis functions.

Returns
  Shape of the array to be filled by tabulate, where (0) is derivative index, (1) is the point index, (2) is the basis function index and (3) is the basis function component.

The documentation for this class was generated from the following files:

- /build/fenics-dolfinx-PdyzCE/fenics-dolfinx-0.10.0.post5/cpp/dolfinx/fem/CoordinateElement.h
- /build/fenics-dolfinx-PdyzCE/fenics-dolfinx-0.10.0.post5/cpp/dolfinx/fem/CoordinateElement.cpp