Class t8_lagrange_element

Class Documentation

class t8_lagrange_element

A single coarse mesh cell with Lagrange geometry.

This class is essentially a wrapper around a cmesh. By having a single element instead of a mesh, understanding and testing is made easier. Several topological utilities are provided, some specific to the Lagrange geometry, some valid for all the geometries in t8code.

Public Functions

t8_lagrange_element(t8_eclass_t eclass, uint32_t degree, std::vector<double> &nodes)

Construct a new t8_lagrange_element object.

Parameters:
  • eclass[in] Element class (line, quad, etc.)

  • degree[in] Polynomial degree (1, 2, …)

  • nodes[in] x,y,z coordinates of the nodes, adhering to the numbering convention.

inline ~t8_lagrange_element()

Destroy the t8_lagrange_element object.

The cmesh wrapped by this class is also destroyed.

t8_eclass_t get_type() const

Get the type of the element.

Returns:

Element class of the element.

std::vector<t8_eclass_t> face_classes() const

Element classes of the faces of this element.

Returns:

Element classes of the faces, enumerated according to the face ordering conventions of t8code.

std::vector<double> get_node_coords(uint32_t node) const

Coordinates of the specified node.

Parameters:

node[in] Node label. Node numbering starts at 0.

Returns:

x,y,z coordinates of the node.

std::vector<std::vector<double>> get_node_coords(std::vector<uint32_t> &nodes) const

Coordinates of the specified nodes.

Parameters:

nodes[in] Node labels. Node numbering starts at 0.

Returns:

x,y,z coordinates of the nodes.

std::vector<std::vector<uint32_t>> get_face_nodes() const

Node labels on the faces of the element.

Returns:

Node labels on each face of the element.

std::vector<t8_lagrange_element> decompose() const

Decompose the element into its faces.

t8_lagrange_element()-s of codimension 1 are created. The original element is not modified and the decomposition is not recursive. The faces can further be decomposed by calling this method on them.

Returns:

Lagrange elements from the faces.

std::array<double, T8_ECLASS_MAX_DIM> evaluate(const std::array<double, T8_ECLASS_MAX_DIM> &ref_point) const

Physical coordinates of a point given in the reference domain.

Parameters:

ref_point[in] Parametric coordinates of the point to be mapped. For 2D elements, only the first two coordinates are considered. For the 1D line element, only the first.

Returns:

Coordinates in the physical space.

std::vector<std::array<double, T8_ECLASS_MAX_DIM>> sample(uint32_t n_point) const

Sample random points in the reference domain.

Parameters:

n_point[in] Number of points to generate.

Returns:

Coordinates of the points, given in x,y,z.

std::array<double, T8_ECLASS_MAX_DIM> map_on_face(t8_eclass eclass, const int face_id, const std::array<double, T8_ECLASS_MAX_DIM> &coord) const

Map this element on the face of a higher-dimensional element.

Example to map a line element onto the left face of a quad element.

  Code: mapOnFace (T8_ECLASS_QUAD, 0, std::vector<double> { 0.6 })

  o : vertices of the elements
  + : point to map
                            y ^
               x              |   face 3
o------+--o  -->             2             3
      0.6                     o ----<---- o          faces (=edges in 2D)
                              |           |          with CCW orientation
                              |           |
                      face 0  v           ^  face 1
                              + (0, 0.4)  |
                              |           |   x
                              o ---->---- o  -->
                             0             1
                                  face 2

Parameters:
  • eclass[in] Element class of the element onto which we map. d-dimensional elements can only be mapped to the faces of d+1-dimensional elements.

  • face_id[in] Face ID of the element onto which we map. Faces in an element are numbered according to the t8code conventions. The selected face must have the same type as the element from which we map. For instance, an element of type T8_ECLASS_QUAD can only be mapped onto face 4 of a T8_ECLASS_PYRAMID, since the other faces of a pyramidal element are triangles.

  • coord[in] x,y,z coordinates of the point in this element.

Returns:

x,y,z coordinates of the mapped point.

void write() const

Save the geometry into a VTK file.

Remark

Note that the geometry is exported as a linear cell for now, so the exported result is accurate for degree 1 only.