Template Class element
Defined in File element.hxx
Inheritance Relationships
Base Type
public TCompetence< element< TCompetence... > >
Class Documentation
-
template<template<typename> class ...TCompetence>
class element : public TCompetence<element<TCompetence...>> Class for the elements of the mesh handle.
The element without specified template parameters provides default implementations for basic functionality as accessing the refinement level or the centroid. With this implementation, the functionality is calculated each time the function is called. Use the competences defined in competences.hxx as template parameter to cache the functionality instead of recalculating in every function call. To add functionality to the element, you can also simply write your own competence class and give it as a template parameter. You can access the functions implemented in your competence via the element.
The inheritance pattern is inspired by the T8Type class (which also uses the CRTP). We decided to use this structure 1.) to be able to add new functionality easily and 2.) for the cached options to keep the number of class member variables of the default to a minimum to save memory. The choice between calculate and cache is a tradeoff between runtime and memory usage.
- Template Parameters:
TCompetence – The competences you want to add to the default functionality of the element.
Public Functions
-
inline element(mesh<SelfType> *mesh, t8_locidx_t tree_id, t8_locidx_t element_id)
Constructor for an element of a mesh.
- Parameters:
mesh – [in] Pointer to the mesh the element should belong to.
tree_id – [in] The tree id of the element in the forest defining the mesh.
element_id – [in] The element id of the element in the forest defining the mesh.
-
inline t8_element_level get_level() const
Getter for the refinement level of the mesh element.
For this easily accessible variable, it makes no sense to provide a cached version.
- Returns:
Refinement level of the mesh element.
-
inline t8_element_shape_t get_shape() const
Getter for the element’s shape.
- Returns:
The shape of the element.
-
inline std::vector<t8_3D_point> get_vertex_coordinates() const
Getter for the vertex coordinates of the mesh element.
This function uses or sets the cached version defined in TCompetence if available and calculates if not.
- Returns:
Vector with one coordinate array for each vertex of the element.
-
inline t8_3D_point get_centroid() const
Getter for the center of mass of the mesh element.
This function uses the cached version defined in TCompetence if available and calculates if not.
- Returns:
Coordinates of the center.
-
inline t8_locidx_t get_local_tree_id() const
Getter for the tree id of the mesh element.
- Returns:
The element’s local tree id.
-
inline t8_locidx_t get_local_element_id() const
Getter for the local element id of the mesh element.
- Returns:
The local element id of the mesh element.
Public Static Functions
-
static inline constexpr bool has_vertex_cache()
Function that checks if a cache for the vertex coordinates exists.
- Returns:
true if a cache for the vertex coordinates exists, false otherwise.
-
static inline constexpr bool has_centroid_cache()
Function that checks if a cache for the centroid exists.
- Returns:
true if a cache for the centroid exists, false otherwise.