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

Defines t8code internal functions that are useful for geometry implementations. More...

#include <t8.h>

Go to the source code of this file.

Functions

void t8_geom_compute_linear_geometry (t8_eclass_t tree_class, const double *tree_vertices, const double *ref_coords, const size_t num_coords, double *out_coords)
 Compute the linear geometry of a tree at a given reference coordinate. More...
 
void t8_geom_compute_linear_axis_aligned_geometry (t8_eclass_t tree_class, const double *tree_vertices, const double *ref_coords, const size_t num_coords, double *out_coords)
 Compute the linear, axis-aligned geometry of a tree at a given reference coordinate. More...
 
void t8_geom_linear_interpolation (const double *coefficients, const double *corner_values, int corner_value_dim, int interpolation_dim, double *evaluated_function)
 Interpolates linearly between 2, bilinearly between 4 or trilineraly between 8 points. More...
 
void t8_geom_triangular_interpolation (const double *coefficients, const double *corner_values, int corner_value_dim, int interpolation_dim, double *evaluated_function)
 Triangular interpolation between 3 points (triangle) or 4 points (tetrahedron) using barycentric coordinates. More...
 
void t8_geom_get_face_vertices (t8_eclass_t tree_class, const double *tree_vertices, int face_index, int dim, double *face_vertices)
 Copies the vertex coordinates of a tree face in zorder into a separate array. More...
 
void t8_geom_get_edge_vertices (t8_eclass_t tree_class, const double *tree_vertices, int edge_index, int dim, double *edge_vertices)
 Copies the vertex coordinates of a tree edge in zorder into a separate array. More...
 
void t8_geom_get_ref_intersection (int edge_index, const double *ref_coords, double ref_intersection[2])
 Calculates a point of intersection in a triangular reference space. More...
 
double t8_geom_get_triangle_scaling_factor (int edge_index, const double *tree_vertices, const double *glob_intersection, const double *glob_ref_point)
 Calculates the scaling factor for edge displacement along a triangular tree face depending on the position of the global reference point. More...
 

Detailed Description

Defines t8code internal functions that are useful for geometry implementations.

Function Documentation

◆ t8_geom_compute_linear_axis_aligned_geometry()

void t8_geom_compute_linear_axis_aligned_geometry ( t8_eclass_t  tree_class,
const double *  tree_vertices,
const double *  ref_coords,
const size_t  num_coords,
double *  out_coords 
)

Compute the linear, axis-aligned geometry of a tree at a given reference coordinate.

This function is faster than t8_geom_compute_linear_geometry, but only works for axis-aligned trees of T8_ECLASS_LINE, T8_ECLASS_QUAD and T8_ECLASS_HEX.

Parameters
[in]tree_classThe eclass of the tree.
[in]tree_verticesArray with the tree vertex coordinates.
[in]ref_coordsThe reference coordinates of the point.
[in]num_coordsNumber of points to evaluate.
[out]out_coordsThe output coordinates.

◆ t8_geom_compute_linear_geometry()

void t8_geom_compute_linear_geometry ( t8_eclass_t  tree_class,
const double *  tree_vertices,
const double *  ref_coords,
const size_t  num_coords,
double *  out_coords 
)

Compute the linear geometry of a tree at a given reference coordinate.

Parameters
[in]tree_classThe eclass of the tree.
[in]tree_verticesArray with the tree vertex coordinates.
[in]ref_coordsThe reference coordinates of the point.
[in]num_coordsNumber of points to evaluate.
[out]out_coordsThe output coordinates.

◆ t8_geom_get_edge_vertices()

void t8_geom_get_edge_vertices ( t8_eclass_t  tree_class,
const double *  tree_vertices,
int  edge_index,
int  dim,
double *  edge_vertices 
)

Copies the vertex coordinates of a tree edge in zorder into a separate array.

Parameters
[in]tree_classThe eclass of the tree.
[in]tree_verticesArray with the tree vertex coordinates.
[in]edge_indexIndex of the edge, which vertices should be copied.
[in]dimThe dimension of the edge vertices.
[out]edge_verticesCoordinates of the edge vertices in zorder.

◆ t8_geom_get_face_vertices()

void t8_geom_get_face_vertices ( t8_eclass_t  tree_class,
const double *  tree_vertices,
int  face_index,
int  dim,
double *  face_vertices 
)

Copies the vertex coordinates of a tree face in zorder into a separate array.

Parameters
[in]tree_classThe eclass of the tree.
[in]tree_verticesArray with the tree vertex coordinates.
[in]face_indexIndex of the face, which vertices should be copied.
[in]dimThe dimension of the face vertices.
[out]face_verticesCoordinates of the face vertices in zorder.

◆ t8_geom_get_ref_intersection()

void t8_geom_get_ref_intersection ( int  edge_index,
const double *  ref_coords,
double  ref_intersection[2] 
)

Calculates a point of intersection in a triangular reference space.

The intersection is the extension of a straight line passing through a reference point and the opposite vertex of the edge. /|\ / | \ o -> reference point / o \ x -> intersection point / | \ /____x____\

Parameters
[in]edge_indexIndex of the edge, the intersection lies on.
[in]ref_coordsArray containing the coordinates of the reference point.
[out]ref_intersectionCoordinates of the intersection point.

◆ t8_geom_get_triangle_scaling_factor()

double t8_geom_get_triangle_scaling_factor ( int  edge_index,
const double *  tree_vertices,
const double *  glob_intersection,
const double *  glob_ref_point 
)

Calculates the scaling factor for edge displacement along a triangular tree face depending on the position of the global reference point.

Parameters
[in]edge_indexIndex of the edge, whose displacement should be scaled.
[in]tree_verticesArray with the tree vertex coordinates.
[in]glob_intersectionArray containing the coordinates of the intersection point of a line drawn from the opposite vertex through the glob_ref_point onto the edge with edge_index.
[in]glob_ref_pointArray containing the coordinates of the reference point mapped into the global space.

◆ t8_geom_linear_interpolation()

void t8_geom_linear_interpolation ( const double *  coefficients,
const double *  corner_values,
int  corner_value_dim,
int  interpolation_dim,
double *  evaluated_function 
)

Interpolates linearly between 2, bilinearly between 4 or trilineraly between 8 points.

Parameters
[in]coefficientsAn array of size at least dim giving the coefficients used for the interpolation
[in]corner_valuesAn array of size 2^dim * 3, giving for each corner (in zorder) of the unit square/cube its function values in space.
[in]corner_value_dimThe dimension of the corner_values.
[in]interpolation_dimThe dimension of the interpolation (1 for linear, 2 for bilinear, 3 for trilinear)
[out]evaluated_functionAn array of size corner_value_dim, on output the result of the interpolation.

◆ t8_geom_triangular_interpolation()

void t8_geom_triangular_interpolation ( const double *  coefficients,
const double *  corner_values,
int  corner_value_dim,
int  interpolation_dim,
double *  evaluated_function 
)

Triangular interpolation between 3 points (triangle) or 4 points (tetrahedron) using barycentric coordinates.

Parameters
[in]coefficientsAn array of size interpolation_dim giving the coefficients used for the interpolation
[in]corner_valuesAn array of size 3 * corner_value_dim for interpolation_dim == 2 or 4 * corner_value_dim for interpolation_dim == 3, giving the function values of the triangle/tetrahedron for each corner (in zorder)
[in]corner_value_dimThe dimension of the corner_values.
[in]interpolation_dimThe dimension of the interpolation (2 for triangle, 3 for tetrahedron)
[out]evaluated_functionAn array of size corner_value_dim, on output the result of the interpolation.