t8  UNKNOWN
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
Functions
t8_forest_geometrical.h File Reference

We define the geometrical queries for a forest of trees in this file. More...

#include <sc_statistics.h>
#include <t8_cmesh.h>

Go to the source code of this file.

Functions

void t8_forest_element_coordinate (t8_forest_t forest, t8_locidx_t ltree_id, const t8_element_t *element, int corner_number, double *coordinates)
 Compute the coordinates of a given vertex of an element if a geometry for this tree is registered in the forest's cmesh. More...
 
void t8_forest_element_from_ref_coords_ext (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *ref_coords, const size_t num_coords, double *coords_out, const double *stretch_factors)
 Compute the coordinates of a point inside an element inside a tree. More...
 
void t8_forest_element_from_ref_coords (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *ref_coords, const size_t num_coords, double *coords_out)
 Compute the coordinates of a point inside an element inside a tree. More...
 
void t8_forest_element_centroid (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, double *coordinates)
 Compute the coordinates of the centroid of an element if a geometry for this tree is registered in the forest's cmesh. More...
 
double t8_forest_element_diam (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element)
 Compute the diameter of an element if a geometry for this tree is registered in the forest's cmesh. More...
 
double t8_forest_element_volume (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element)
 Compute the volume of an element if a geometry for this tree is registered in the forest's cmesh. More...
 
double t8_forest_element_face_area (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, int face)
 Compute the area of an element's face if a geometry for this tree is registered in the forest's cmesh. More...
 
void t8_forest_element_face_centroid (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, int face, double centroid[3])
 Compute the vertex coordinates of the centroid of an element's face if a geometry for this tree is registered in the forest's cmesh. More...
 
void t8_forest_element_face_normal (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, int face, double normal[3])
 Compute the normal vector of an element's face if a geometry for this tree is registered in the forest's cmesh. More...
 

Detailed Description

We define the geometrical queries for a forest of trees in this file.

Function Documentation

◆ t8_forest_element_centroid()

void t8_forest_element_centroid ( t8_forest_t  forest,
t8_locidx_t  ltreeid,
const t8_element_t element,
double *  coordinates 
)

Compute the coordinates of the centroid of an element if a geometry for this tree is registered in the forest's cmesh.

The centroid can be seen as the midpoint of an element and thus can for example be used to compute level-set values or the distance between two elements.

Parameters
[in]forestThe forest.
[in]ltree_idThe forest local id of the tree in which the element is.
[in]elementThe element.
[out]coordinatesOn input an allocated array to store 3 doubles, on output the x, y and z coordinates of the centroid.

◆ t8_forest_element_coordinate()

void t8_forest_element_coordinate ( t8_forest_t  forest,
t8_locidx_t  ltree_id,
const t8_element_t element,
int  corner_number,
double *  coordinates 
)

Compute the coordinates of a given vertex of an element if a geometry for this tree is registered in the forest's cmesh.

Parameters
[in]forestThe forest.
[in]ltree_idThe forest local id of the tree in which the element is.
[in]elementThe element.
[in]corner_numberThe corner number, in Z-order, of the vertex which should be computed.
[out]coordinatesOn input an allocated array to store 3 doubles, on output the x, y and z coordinates of the vertex.

◆ t8_forest_element_diam()

double t8_forest_element_diam ( t8_forest_t  forest,
t8_locidx_t  ltreeid,
const t8_element_t element 
)

Compute the diameter of an element if a geometry for this tree is registered in the forest's cmesh.

This is only an approximation.

Parameters
[in]forestThe forest.
[in]ltree_idThe forest local id of the tree in which the element is.
[in]elementThe element.
Returns
The diameter of the element.
Note
For lines the value is exact while for other element types it is only an approximation.

◆ t8_forest_element_face_area()

double t8_forest_element_face_area ( t8_forest_t  forest,
t8_locidx_t  ltreeid,
const t8_element_t element,
int  face 
)

Compute the area of an element's face if a geometry for this tree is registered in the forest's cmesh.

Currently implemented for 2D elements only. This is only an approximation.

Parameters
[in]forestThe forest.
[in]ltree_idThe forest local id of the tree in which the element is.
[in]elementThe element.
[in]faceA face of element.
Returns
The area of face. forest must be committed when calling this function.

◆ t8_forest_element_face_centroid()

void t8_forest_element_face_centroid ( t8_forest_t  forest,
t8_locidx_t  ltreeid,
const t8_element_t element,
int  face,
double  centroid[3] 
)

Compute the vertex coordinates of the centroid of an element's face if a geometry for this tree is registered in the forest's cmesh.

Parameters
[in]forestThe forest.
[in]ltree_idThe forest local id of the tree in which the element is.
[in]elementThe element.
[in]faceA face of element.
[out]normalOn output the centroid of face. forest must be committed when calling this function.

◆ t8_forest_element_face_normal()

void t8_forest_element_face_normal ( t8_forest_t  forest,
t8_locidx_t  ltreeid,
const t8_element_t element,
int  face,
double  normal[3] 
)

Compute the normal vector of an element's face if a geometry for this tree is registered in the forest's cmesh.

Currently implemented for 2D elements only.

Parameters
[in]forestThe forest.
[in]ltree_idThe forest local id of the tree in which the element is.
[in]elementThe element.
[in]faceA face of element.
[out]normalOn output the normal vector of element at face. forest must be committed when calling this function.

◆ t8_forest_element_from_ref_coords()

void t8_forest_element_from_ref_coords ( t8_forest_t  forest,
t8_locidx_t  ltreeid,
const t8_element_t element,
const double *  ref_coords,
const size_t  num_coords,
double *  coords_out 
)

Compute the coordinates of a point inside an element inside a tree.

The point is given in reference coordinates inside the element and gets converted to reference coordinates inside the tree. After that, the point is converted to global coordinates inside the domain.

Parameters
[in]forestThe forest.
[in]ltreeidThe forest local id of the tree in which the element is.
[in]elementThe element.
[in]ref_coordsThe reference coordinates of the point inside the element.
[in]num_coordsThe number of coordinate sets in ref_coord (dimension x double).
[out]coords_outOn input an allocated array to store 3 doubles, on output the x, y and z coordinates of the point inside the domain.

◆ t8_forest_element_from_ref_coords_ext()

void t8_forest_element_from_ref_coords_ext ( t8_forest_t  forest,
t8_locidx_t  ltreeid,
const t8_element_t element,
const double *  ref_coords,
const size_t  num_coords,
double *  coords_out,
const double *  stretch_factors 
)

Compute the coordinates of a point inside an element inside a tree.

The point is given in reference coordinates inside the element and gets converted to reference coordinates inside the tree. After that, the point is converted to global coordinates inside the domain. If needed, the element is stretched by the given stretch factors (the resulting mesh is then no longer non-overlapping).

Parameters
[in]forestThe forest.
[in]ltreeidThe forest local id of the tree in which the element is.
[in]elementThe element.
[in]ref_coordsThe reference coordinates of the point inside the element.
[in]num_coordsThe number of coordinate sets in ref_coord (dimension x double).
[out]coords_outOn input an allocated array to store 3 doubles, on output the x, y and z coordinates of the point inside the domain.
[in]stretch_factorsIf provided, elements are stretched according to the stretch factors of the tree.

◆ t8_forest_element_volume()

double t8_forest_element_volume ( t8_forest_t  forest,
t8_locidx_t  ltreeid,
const t8_element_t element 
)

Compute the volume of an element if a geometry for this tree is registered in the forest's cmesh.

This is only an approximation.

Parameters
[in]forestThe forest.
[in]ltree_idThe forest local id of the tree in which the element is.
[in]elementThe element.
Returns
The diameter of the element.
Note
This function assumes d-linear interpolation for the tree vertex coordinates. forest must be committed when calling this function.