t8
UNKNOWN
t8code is a C library to manage a forest of adaptive space-trees of general element classes in parallel.
|
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... | |
double | t8_geom_get_scaling_factor_of_edge_on_face_tet (int edge_index, int face_index, const double *ref_coords) |
Calculates the scaling factor for the displacement of an edge over a face of a tetrahedral element. More... | |
void | t8_geom_get_tet_face_intersection (const int face_index, const double *ref_coords, double face_intersection[3]) |
Calculates the face intersection of a ray passing trough the reference coordinates and the opposite vertex of that face for a tetrahedron. More... | |
int | t8_vertex_point_inside (const double vertex_coords[3], const double point[3], const double tolerance) |
Check if a point lies inside a vertex. More... | |
int | t8_line_point_inside (const double *p_0, const double *vec, const double *point, const double tolerance) |
Check if a point is inside a line that is defined by a starting point p_0 and a vector vec. More... | |
int | t8_triangle_point_inside (const double p_0[3], const double v[3], const double w[3], const double point[3], const double tolerance) |
Check if a point is inside of a triangle described by a point p_0 and two vectors v and w. More... | |
int | t8_plane_point_inside (const double point_on_face[3], const double face_normal[3], const double point[3]) |
Check if a point lays on the inner side of a plane of a bilinearly interpolated volume element. More... | |
Defines t8code internal functions that are useful for geometry implementations.
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.
[in] | tree_class | The eclass of the tree. |
[in] | tree_vertices | Array with the tree vertex coordinates. |
[in] | ref_coords | The reference coordinates of the point. |
[in] | num_coords | Number of points to evaluate. |
[out] | out_coords | The output coordinates. |
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.
[in] | tree_class | The eclass of the tree. |
[in] | tree_vertices | Array with the tree vertex coordinates. |
[in] | ref_coords | The reference coordinates of the point. |
[in] | num_coords | Number of points to evaluate. |
[out] | out_coords | The output coordinates. |
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.
[in] | tree_class | The eclass of the tree. |
[in] | tree_vertices | Array with the tree vertex coordinates. |
[in] | edge_index | Index of the edge, which vertices should be copied. |
[in] | dim | The dimension of the edge vertices. |
[out] | edge_vertices | Coordinates of the edge vertices in zorder. |
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.
[in] | tree_class | The eclass of the tree. |
[in] | tree_vertices | Array with the tree vertex coordinates. |
[in] | face_index | Index of the face, which vertices should be copied. |
[in] | dim | The dimension of the face vertices. |
[out] | face_vertices | Coordinates of the face vertices in zorder. |
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____\
[in] | edge_index | Index of the edge, the intersection lies on. |
[in] | ref_coords | Array containing the coordinates of the reference point. |
[out] | ref_intersection | Coordinates of the intersection point. |
double t8_geom_get_scaling_factor_of_edge_on_face_tet | ( | int | edge_index, |
int | face_index, | ||
const double * | ref_coords | ||
) |
Calculates the scaling factor for the displacement of an edge over a face of a tetrahedral element.
[in] | edge_index | Index of the edge, whose displacement should be scaled. |
[in] | face_index | Index of the face, the displacement should be scaled on. |
[in] | ref_coords | Array containing the coordinates of the reference point. |
void t8_geom_get_tet_face_intersection | ( | const int | face_index, |
const double * | ref_coords, | ||
double | face_intersection[3] | ||
) |
Calculates the face intersection of a ray passing trough the reference coordinates and the opposite vertex of that face for a tetrahedron.
The coordinates of the face intersection are reference coordinates: [0,1]^3.
[in] | face_index | Index of the face, on which the intersection should be calculated. |
[in] | ref_coords | Array containing the coordinates of the reference point. |
[out] | face_intersection | Three dimensional array containing the intersection point on the face in reference space. |
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.
[in] | edge_index | Index of the edge, whose displacement should be scaled. |
[in] | tree_vertices | Array with the tree vertex coordinates. |
[in] | glob_intersection | Array 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_point | Array containing the coordinates of the reference point mapped into the global space. |
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.
[in] | coefficients | An array of size at least dim giving the coefficients used for the interpolation |
[in] | corner_values | An 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_dim | The dimension of the corner_values. |
[in] | interpolation_dim | The dimension of the interpolation (1 for linear, 2 for bilinear, 3 for trilinear) |
[out] | evaluated_function | An array of size corner_value_dim, on output the result of the 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.
[in] | coefficients | An array of size interpolation_dim giving the coefficients used for the interpolation |
[in] | corner_values | An 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_dim | The dimension of the corner_values. |
[in] | interpolation_dim | The dimension of the interpolation (2 for triangle, 3 for tetrahedron) |
[out] | evaluated_function | An array of size corner_value_dim, on output the result of the interpolation. |
int t8_line_point_inside | ( | const double * | p_0, |
const double * | vec, | ||
const double * | point, | ||
const double | tolerance | ||
) |
Check if a point is inside a line that is defined by a starting point p_0 and a vector vec.
[in] | p_0 | Starting point of the line |
[in] | vec | Direction of the line (not normalized) |
[in] | point | The coordinates of the point to check |
[in] | tolerance | A double > 0 defining the tolerance |
int t8_plane_point_inside | ( | const double | point_on_face[3], |
const double | face_normal[3], | ||
const double | point[3] | ||
) |
Check if a point lays on the inner side of a plane of a bilinearly interpolated volume element.
the plane is described by a point and the normal of the face.
[in] | point_on_face | A point on the plane |
[in] | face_normal | The normal of the face |
[in] | point | The point to check |
int t8_triangle_point_inside | ( | const double | p_0[3], |
const double | v[3], | ||
const double | w[3], | ||
const double | point[3], | ||
const double | tolerance | ||
) |
Check if a point is inside of a triangle described by a point p_0 and two vectors v and w.
[in] | p_0 | The first vertex of a triangle |
[in] | v | The vector from p_0 to p_1 (second vertex in the triangle) |
[in] | w | The vector from p_0 to p_2 (third vertex in the triangle) |
[in] | point | The coordinates of the point to check |
[in] | tolerance | A double > 0 defining the tolerance |
int t8_vertex_point_inside | ( | const double | vertex_coords[3], |
const double | point[3], | ||
const double | tolerance | ||
) |
Check if a point lies inside a vertex.
[in] | vertex_coords | The coordinates of the vertex |
[in] | point | The coordinates of the point to check |
[in] | tolerance | A double > 0 defining the tolerance |