From 35f688eded384f74a7c6b9a794a34065a2cff4ac Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 1 Aug 2023 11:18:56 +0200 Subject: [PATCH 1/9] add batch processing of element ref coords --- src/t8_element_cxx.hxx | 12 ++--- src/t8_forest/t8_forest_cxx.cxx | 2 +- .../t8_default_common_cxx.hxx | 12 ++--- .../t8_default_hex/t8_default_hex_cxx.cxx | 4 +- .../t8_default_hex/t8_default_hex_cxx.hxx | 12 ++--- .../t8_default/t8_default_hex/t8_dhex_bits.c | 27 ++++++----- .../t8_default/t8_default_hex/t8_dhex_bits.h | 11 +++-- .../t8_default_line/t8_default_line_cxx.cxx | 4 +- .../t8_default_line/t8_default_line_cxx.hxx | 12 ++--- .../t8_default_line/t8_dline_bits.c | 12 +++-- .../t8_default_line/t8_dline_bits.h | 16 +++++-- .../t8_default_prism/t8_default_prism_cxx.cxx | 4 +- .../t8_default_prism/t8_default_prism_cxx.hxx | 12 ++--- .../t8_default_prism/t8_dprism_bits.c | 9 ++-- .../t8_default_prism/t8_dprism_bits.h | 14 +++--- .../t8_default_pyramid_cxx.cxx | 6 +-- .../t8_default_pyramid_cxx.hxx | 12 ++--- .../t8_default_pyramid/t8_dpyramid_bits.c | 45 +++++++++++-------- .../t8_default_pyramid/t8_dpyramid_bits.h | 16 ++++--- .../t8_default_quad/t8_default_quad_cxx.cxx | 4 +- .../t8_default_quad/t8_default_quad_cxx.hxx | 12 ++--- .../t8_default_quad/t8_dquad_bits.c | 13 +++--- .../t8_default_quad/t8_dquad_bits.h | 11 +++-- .../t8_default_tet/t8_default_tet_cxx.cxx | 4 +- .../t8_default_tet/t8_default_tet_cxx.hxx | 12 ++--- .../t8_default/t8_default_tet/t8_dtet_bits.h | 15 ++++--- .../t8_default_tri/t8_default_tri_cxx.cxx | 4 +- .../t8_default_tri/t8_default_tri_cxx.hxx | 12 ++--- .../t8_default/t8_default_tri/t8_dtri_bits.c | 45 ++++++++++++------- .../t8_default/t8_default_tri/t8_dtri_bits.h | 20 ++++++--- .../t8_default_vertex_cxx.cxx | 5 +-- .../t8_default_vertex_cxx.hxx | 12 ++--- .../t8_default_vertex/t8_dvertex_bits.c | 6 ++- .../t8_default_vertex/t8_dvertex_bits.h | 15 ++++--- 34 files changed, 259 insertions(+), 173 deletions(-) diff --git a/src/t8_element_cxx.hxx b/src/t8_element_cxx.hxx index c8675fba0c..015b8ce284 100644 --- a/src/t8_element_cxx.hxx +++ b/src/t8_element_cxx.hxx @@ -605,17 +605,19 @@ public: double coords[]) const = 0; - /** Convert a point in the reference space of an element to a point in the + /** Convert points in the reference space of an element to points in the * reference space of the tree. * * \param [in] elem The element. - * \param [in] coords_input The coordinates of the point in the reference space of the element. - * \param [in] user_data User data. - * \param [out] out_coords The coordinates of the point in the reference space of the tree. + * \param [in] coords_input The coordinates \f$ [0,1]^\mathrm{dim} \f$ of the point + * in the reference space of the element. + * \param [in] num_coords Number of \f$ dim\f$-sized coordinates to evaluate. + * \param [out] out_coords The coordinates of the points in the + * reference space of the tree. */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const = 0; diff --git a/src/t8_forest/t8_forest_cxx.cxx b/src/t8_forest/t8_forest_cxx.cxx index b4651dd187..1ee10105ee 100644 --- a/src/t8_forest/t8_forest_cxx.cxx +++ b/src/t8_forest/t8_forest_cxx.cxx @@ -440,7 +440,7 @@ t8_forest_element_from_ref_coords (t8_forest_t forest, t8_locidx_t ltreeid, const t8_eclass_t tree_class = t8_forest_get_tree_class (forest, ltreeid); const t8_eclass_scheme_c *scheme = t8_forest_get_eclass_scheme (forest, tree_class); - scheme->t8_element_reference_coords (element, ref_coords, NULL, + scheme->t8_element_reference_coords (element, ref_coords, 1, tree_ref_coords); const t8_cmesh_t cmesh = t8_forest_get_cmesh (forest); const t8_gloidx_t gtreeid = t8_forest_global_tree_id (forest, ltreeid); diff --git a/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx b/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx index 1f8c152f08..ffc99506ab 100644 --- a/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx @@ -109,17 +109,19 @@ public: int vertex, int coords[]) const = 0; - /** Convert a point in the reference space of an element to a point in the + /** Convert points in the reference space of an element to points in the * reference space of the tree. * * \param [in] elem The element. - * \param [in] coords_input The coordinates of the point in the reference space of the element. - * \param [in] user_data User data. - * \param [out] out_coords The coordinates of the point in the reference space of the tree. + * \param [in] coords_input The coordinates \f$ [0,1]^\mathrm{dim} \f$ of the point + * in the reference space of the element. + * \param [in] num_coords Number of \f$ dim\f$-sized coordinates to evaluate. + * \param [out] out_coords The coordinates of the points in the + * reference space of the tree. */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const = 0; diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx index 96bb5ba1c3..2af3549d01 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx @@ -664,13 +664,13 @@ t8_default_scheme_hex_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); t8_dhex_compute_reference_coords ((const t8_dhex_t *) elem, ref_coords, - out_coords); + num_coords, out_coords); } int diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx index 088bfc53fc..0db4240265 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx @@ -569,17 +569,19 @@ public: double coords[]) const; - /** Convert a point in the reference space of an element to a point in the + /** Convert points in the reference space of an element to points in the * reference space of the tree. * * \param [in] elem The element. - * \param [in] coords_input The coordinates of the point in the reference space of the element. - * \param [in] user_data User data. - * \param [out] out_coords The coordinates of the point in the reference space of the tree. + * \param [in] coords_input The coordinates \f$ [0,1]^\mathrm{dim} \f$ of the point + * in the reference space of the element. + * \param [in] num_coords Number of \f$ dim\f$-sized coordinates to evaluate. + * \param [out] out_coords The coordinates of the points in the + * reference space of the tree. */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c index 1a7df64381..2718d777aa 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c @@ -26,22 +26,25 @@ void t8_dhex_compute_reference_coords (const t8_dhex_t * elem, const double *ref_coords, - double *out_coords) + const int num_coords, double *out_coords) { const p8est_quadrant_t *q1 = (const p8est_quadrant_t *) elem; /* Get the length of the quadrant */ const p4est_qcoord_t len = P8EST_QUADRANT_LEN (q1->level); - /* Compute the x, y and z coordinates of the point depending on the - * reference coordinates */ - out_coords[0] = q1->x + ref_coords[0] * len; - out_coords[1] = q1->y + ref_coords[1] * len; - out_coords[2] = q1->z + ref_coords[2] * len; - - /* We divide the integer coordinates by the root length of the hex - * to obtain the reference coordinates. */ - out_coords[0] /= (double) P8EST_ROOT_LEN; - out_coords[1] /= (double) P8EST_ROOT_LEN; - out_coords[2] /= (double) P8EST_ROOT_LEN; + for (int coord = 0; coord < num_coords; ++coord) { + const int offset = 3 * coord; + /* Compute the x, y and z coordinates of the point depending on the + * reference coordinates */ + out_coords[offset + 0] = q1->x + ref_coords[offset + 0] * len; + out_coords[offset + 1] = q1->y + ref_coords[offset + 1] * len; + out_coords[offset + 2] = q1->z + ref_coords[offset + 2] * len; + + /* We divide the integer coordinates by the root length of the hex + * to obtain the reference coordinates. */ + out_coords[offset + 0] /= (double) P8EST_ROOT_LEN; + out_coords[offset + 1] /= (double) P8EST_ROOT_LEN; + out_coords[offset + 2] /= (double) P8EST_ROOT_LEN; + } } diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h index 0b084e08bb..f17c89cbe3 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h @@ -32,17 +32,20 @@ T8_EXTERN_C_BEGIN (); -/** Convert a point in the reference space of a hex element to a point in the +/** Convert points in the reference space of a hex element to points in the * reference space of the tree (level 0) embedded in \f$ [0,1]^3 \f$. * \param [in] elem Input hex. - * \param [in] ref_coords The reference coordinate on the hex \f$ [0,1]^3 \f$ - * \param [out] out_coords An array of 1 double that + * \param [in] ref_coords The reference coordinates in the hex + * (\a num_coords times \f$ [0,1]^3 \f$) + * \param [in] num_coords Number of coordinates to evaluate + * \param [out] out_coords An array of \a num_coords x 3 x double that * will be filled with the reference coordinates - * of the point on the hex. + * of the points on the hex. */ void t8_dhex_compute_reference_coords (const t8_dhex_t * elem, const double *ref_coords, + const int num_coords, double *out_coords); T8_EXTERN_C_END (); diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx index 3fc049b872..0f0bb2aae2 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx @@ -372,14 +372,14 @@ t8_default_scheme_line_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); T8_ASSERT (ref_coords != NULL); t8_dline_compute_reference_coords ((const t8_dline_t *) elem, ref_coords, - out_coords); + num_coords, 0, out_coords); } int diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx index 120eb8b0d2..e77a6d6ea2 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx @@ -587,17 +587,19 @@ public: double coords[]) const; - /** Convert a point in the reference space of an element to a point in the + /** Convert points in the reference space of an element to points in the * reference space of the tree. * * \param [in] elem The element. - * \param [in] coords_input The coordinates of the point in the reference space of the element. - * \param [in] user_data User data. - * \param [out] out_coords The coordinates of the point in the reference space of the tree. + * \param [in] coords_input The coordinates \f$ [0,1]^\mathrm{dim} \f$ of the point + * in the reference space of the element. + * \param [in] num_coords Number of \f$ dim\f$-sized coordinates to evaluate. + * \param [out] out_coords The coordinates of the points in the + * reference space of the tree. */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c index c25d51eb29..a751941ecd 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c +++ b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c @@ -352,12 +352,16 @@ t8_dline_vertex_ref_coords (const t8_dline_t *elem, const int vertex, void t8_dline_compute_reference_coords (const t8_dline_t *elem, const double *ref_coords, - double *out_coords) + const int num_coords, + const int skip_coords, double *out_coords) { T8_ASSERT (t8_dline_is_valid (elem)); - out_coords[0] = elem->x; - out_coords[0] += T8_DLINE_LEN (elem->level) * ref_coords[0]; - out_coords[0] /= (double) T8_DLINE_ROOT_LEN; + for (int coord = 0; coord < num_coords; ++coord) { + const int offset = coord * skip_coords; + out_coords[offset] = elem->x; + out_coords[offset] += T8_DLINE_LEN (elem->level) * ref_coords[coord]; + out_coords[offset] /= (double) T8_DLINE_ROOT_LEN; + } } t8_linearidx_t diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h index b432af12e5..1ed0f6df4a 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h +++ b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h @@ -242,17 +242,25 @@ void t8_dline_vertex_ref_coords (const t8_dline_t *elem, const int vertex, double coordinates[1]); -/** Convert a point in the reference space of a line element to a point in the +/** Convert points in the reference space of a line element to points in the * reference space of the tree (level 0) embedded in [0,1]^1. * \param [in] elem Input line. - * \param [in] ref_coords The reference coordinate on the line \f$ [0,1]^1 \f$ - * \param [out] out_coords An array of 1 double that + * \param [in] ref_coords The reference coordinates in the line + * (\a num_coords times \f$ [0,1]^1 \f$) + * \param [in] num_coords Number of coordinates to evaluate + * \param [in] skip_coords Only used for batch computation of prisms. + * In all other cases 0. + * Skip coordinates in the \a ref_coords and + * \a out_coords array. + * \param [out] out_coords An array of \a num_coords x 1 x double that * will be filled with the reference coordinates - * of the point on the line. + * of the points on the line. */ void t8_dline_compute_reference_coords (const t8_dline_t *elem, const double *ref_coords, + const int num_coords, + const int skip_coords, double *out_coords); /** Computes the linear position of a line in an uniform grid. diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx index 2b65796a6c..122631bae4 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx @@ -484,13 +484,13 @@ t8_default_scheme_prism_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); t8_dprism_compute_reference_coords ((const t8_dprism_t *) elem, ref_coords, - out_coords); + num_coords, out_coords); } void diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx index 10337c3486..3c75ec53ae 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx @@ -596,17 +596,19 @@ public: double coords[]) const; - /** Convert a point in the reference space of an element to a point in the + /** Convert points in the reference space of an element to points in the * reference space of the tree. * * \param [in] elem The element. - * \param [in] coords_input The coordinates of the point in the reference space of the element. - * \param [in] user_data User data. - * \param [out] out_coords The coordinates of the point in the reference space of the tree. + * \param [in] coords_input The coordinates \f$ [0,1]^\mathrm{dim} \f$ of the point + * in the reference space of the element. + * \param [in] num_coords Number of \f$ dim\f$-sized coordinates to evaluate. + * \param [out] out_coords The coordinates of the points in the + * reference space of the tree. */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c index 9cace16919..80fcceddb9 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c @@ -597,15 +597,16 @@ t8_dprism_vertex_ref_coords (const t8_dprism_t *elem, const int vertex, void t8_dprism_compute_reference_coords (const t8_dprism_t *elem, const double *ref_coords, - double *out_coords) + const int num_coords, double *out_coords) { T8_ASSERT (t8_dprism_is_valid (elem)); T8_ASSERT (elem->line.level == elem->tri.level); /*Compute x and y coordinate */ - t8_dtri_compute_reference_coords (&elem->tri, ref_coords, out_coords); + t8_dtri_compute_reference_coords (&elem->tri, ref_coords, num_coords, 1, + out_coords); /*Compute z coordinate */ - t8_dline_compute_reference_coords (&elem->line, ref_coords + 2, - out_coords + 2); + t8_dline_compute_reference_coords (&elem->line, ref_coords + 2, num_coords, + 2, out_coords + 2); } t8_linearidx_t diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h index 197de4dea9..1257eb9eda 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h @@ -316,18 +316,20 @@ void t8_dprism_vertex_ref_coords (const t8_dprism_t *elem, int vertex, double coords[3]); -/** Convert a point in the reference space of a prism element to a point in the +/** Convert points in the reference space of a prism element to points in the * reference space of the tree (level 0) embedded in \f$ [0,1]^3 \f$. - * \param [in] elem Input prism. - * \param [in] ref_coords The reference coordinates inside the - * prism element \f$ [0,1]^3 \f$ - * \param [out] out_coords An array of 3 doubles that will be filled with the - * reference coordinates in the tree of the prism. + * \param [in] ref_coords The reference coordinates in the prism + * (\a num_coords times \f$ [0,1]^3 \f$) + * \param [in] num_coords Number of coordinates to evaluate + * \param [out] out_coords An array of \a num_coords x 3 x double that + * will be filled with the reference coordinates + * of the points on the prism. */ void t8_dprism_compute_reference_coords (const t8_dprism_t *elem, const double *ref_coords, + const int num_coords, double *out_coords); /** Computes the linear position of a prism in an uniform grid. diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx index 1b04009493..6b2f01faf3 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx @@ -480,14 +480,14 @@ t8_default_scheme_pyramid_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void - *user_data, + const int + num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); t8_dpyramid_compute_reference_coords ((const t8_dpyramid_t *) elem, - ref_coords, out_coords); + ref_coords, num_coords, out_coords); } int diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx index 63969a5aed..988d86ca61 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx @@ -615,17 +615,19 @@ public: double coords[]) const; - /** Convert a point in the reference space of an element to a point in the + /** Convert points in the reference space of an element to points in the * reference space of the tree. * * \param [in] elem The element. - * \param [in] coords_input The coordinates of the point in the reference space of the element. - * \param [in] user_data User data. - * \param [out] out_coords The coordinates of the point in the reference space of the tree. + * \param [in] coords_input The coordinates \f$ [0,1]^\mathrm{dim} \f$ of the point + * in the reference space of the element. + * \param [in] num_coords Number of \f$ dim\f$-sized coordinates to evaluate. + * \param [out] out_coords The coordinates of the points in the + * reference space of the tree. */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c index 2748c0ff6e..e491244b35 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c @@ -1745,35 +1745,42 @@ t8_dpyramid_vertex_reference_coords (const t8_dpyramid_t *elem, void t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, const double *ref_coords, + const int num_coords, double *out_coords) { T8_ASSERT (ref_coords != NULL); T8_ASSERT (t8_dpyramid_is_valid (elem)); if (t8_dpyramid_shape (elem) == T8_ECLASS_PYRAMID) { const t8_dpyramid_coord_t length = T8_DPYRAMID_LEN (elem->pyramid.level); - out_coords[0] = elem->pyramid.x; - out_coords[1] = elem->pyramid.y; - out_coords[2] = elem->pyramid.z; - - if (elem->pyramid.type == T8_DPYRAMID_FIRST_TYPE) { - out_coords[0] += ref_coords[0] * length; - out_coords[1] += ref_coords[1] * length; - out_coords[2] += ref_coords[2] * length; - } - else { - out_coords[0] += (ref_coords[0] - ref_coords[2]) * length; - out_coords[1] += (ref_coords[1] - ref_coords[2]) * length; - out_coords[2] += (1 - ref_coords[2]) * length; - } - /*scale the coordinates onto the reference cube */ - out_coords[0] /= (double) T8_DPYRAMID_ROOT_LEN; - out_coords[1] /= (double) T8_DPYRAMID_ROOT_LEN; - out_coords[2] /= (double) T8_DPYRAMID_ROOT_LEN; + for (int coord = 0; coord < num_coords; ++coord) { + const int offset = coord * 3; + out_coords[offset + 0] = elem->pyramid.x; + out_coords[offset + 1] = elem->pyramid.y; + out_coords[offset + 2] = elem->pyramid.z; + + if (elem->pyramid.type == T8_DPYRAMID_FIRST_TYPE) { + out_coords[offset + 0] += ref_coords[offset + 0] * length; + out_coords[offset + 1] += ref_coords[offset + 1] * length; + out_coords[offset + 2] += ref_coords[offset + 2] * length; + } + else { + out_coords[offset + 0] += + (ref_coords[offset + 0] - ref_coords[offset + 2]) * length; + out_coords[offset + 1] += + (ref_coords[offset + 1] - ref_coords[offset + 2]) * length; + out_coords[offset + 2] += (1 - ref_coords[offset + 2]) * length; + } + + /*scale the coordinates onto the reference cube */ + out_coords[offset + 0] /= (double) T8_DPYRAMID_ROOT_LEN; + out_coords[offset + 1] /= (double) T8_DPYRAMID_ROOT_LEN; + out_coords[offset + 2] /= (double) T8_DPYRAMID_ROOT_LEN; + } } else { t8_dtet_compute_reference_coords (&(elem->pyramid), ref_coords, - out_coords); + num_coords, out_coords); } } diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h index 33b2b086db..f15d093af6 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h @@ -372,18 +372,22 @@ void t8_dpyramid_vertex_reference_coords (const t8_dpyramid_t const int vertex, double coords[]); -/** Convert a point in the reference space of a pyramid element to a point in - * the reference space of the tree (level 0) embedded in \f$ [0,1]^3 \f$. +/** Convert points in the reference space of a pyramid element to points in the + * reference space of the tree (level 0) embedded in \f$ [0,1]^3 \f$. * \param [in] elem Input pyramid. - * \param [in] ref_coords The reference coordinates inside the - * pyramid element \f$ [0,1]^3 \f$ - * \param [out] out_coords An array of 3 doubles that will be filled with the - * reference coordinates in the tree of the pyramid. + * \param [in] ref_coords The reference coordinates in the pyramid + * (\a num_coords times \f$ [0,1]^3 \f$) + * \param [in] num_coords Number of coordinates to evaluate + * \param [out] out_coords An array of \a num_coords x 3 x double that + * will be filled with the reference coordinates + * of the points on the pyramid. */ void t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, const double *ref_coords, + const int + num_coords, double *out_coords); /** diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx index 8f33d5e335..a2e6beb3d1 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx @@ -797,13 +797,13 @@ t8_default_scheme_quad_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); t8_dquad_compute_reference_coords ((const t8_dquad_t *) elem, ref_coords, - out_coords); + num_coords, out_coords); } void diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx index e3d6ed65c1..312e951069 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx @@ -602,17 +602,19 @@ public: double coords[]) const; - /** Convert a point in the reference space of an element to a point in the + /** Convert points in the reference space of an element to points in the * reference space of the tree. * * \param [in] elem The element. - * \param [in] coords_input The coordinates of the point in the reference space of the element. - * \param [in] user_data User data. - * \param [out] out_coords The coordinates of the point in the reference space of the tree. + * \param [in] coords_input The coordinates \f$ [0,1]^\mathrm{dim} \f$ of the point + * in the reference space of the element. + * \param [in] num_coords Number of \f$ dim\f$-sized coordinates to evaluate. + * \param [out] out_coords The coordinates of the points in the + * reference space of the tree. */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c index 9fe4d199f1..97ce5e6537 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c @@ -26,15 +26,18 @@ void t8_dquad_compute_reference_coords (const t8_dquad_t * elem, const double *ref_coords, - double *out_coords) + const int num_coords, double *out_coords) { const p4est_quadrant_t *q1 = (const p4est_quadrant_t *) elem; const p4est_qcoord_t h = P4EST_QUADRANT_LEN (q1->level); - out_coords[0] = q1->x + ref_coords[0] * h; - out_coords[1] = q1->y + ref_coords[1] * h; + for (int coord = 0; coord < num_coords; ++coord) { + const int offset = coord * 2; + out_coords[offset + 0] = q1->x + ref_coords[offset + 0] * h; + out_coords[offset + 1] = q1->y + ref_coords[offset + 1] * h; - out_coords[0] /= (double) P4EST_ROOT_LEN; - out_coords[1] /= (double) P4EST_ROOT_LEN; + out_coords[offset + 0] /= (double) P4EST_ROOT_LEN; + out_coords[offset + 1] /= (double) P4EST_ROOT_LEN; + } } diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h index 6eb9f58523..e23c7a4b00 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h @@ -32,18 +32,21 @@ T8_EXTERN_C_BEGIN (); -/** Convert a point in the reference space of a quad element to a point in the +/** Convert points in the reference space of a quad element to points in the * reference space of the tree (level 0) embedded in \f$ [0,1]^2 \f$. * \param [in] elem Input quad. - * \param [in] ref_coords The reference coordinate on the quad \f$ [0,1]^2 \f$ - * \param [out] out_coords An array of 1 double that + * \param [in] ref_coords The reference coordinates in the quad + * (\a num_coords times \f$ [0,1]^2 \f$) + * \param [in] num_coords Number of coordinates to evaluate + * \param [out] out_coords An array of \a num_coords x 2 x double that * will be filled with the reference coordinates - * of the point on the quad. + * of the points on the quad. */ void t8_dquad_compute_reference_coords (const t8_dquad_t * elem, const double *ref_coords, + const int num_coords, double *out_coords); T8_EXTERN_C_END (); diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx index 286cb3c53f..e1f98ac684 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx @@ -561,13 +561,13 @@ t8_default_scheme_tet_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); t8_dtet_compute_reference_coords ((const t8_dtet_t *) elem, ref_coords, - out_coords); + num_coords, 0, out_coords); } /** Returns true, if there is one element in the tree, that does not refine into 2^dim children. diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx index 28eec270d9..c2a85ce3e3 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx @@ -582,17 +582,19 @@ public: double coords[]) const; - /** Convert a point in the reference space of an element to a point in the + /** Convert points in the reference space of an element to points in the * reference space of the tree. * * \param [in] elem The element. - * \param [in] coords_input The coordinates of the point in the reference space of the element. - * \param [in] user_data User data. - * \param [out] out_coords The coordinates of the point in the reference space of the tree. + * \param [in] coords_input The coordinates \f$ [0,1]^\mathrm{dim} \f$ of the point + * in the reference space of the element. + * \param [in] num_coords Number of \f$ dim\f$-sized coordinates to evaluate. + * \param [out] out_coords The coordinates of the points in the + * reference space of the tree. */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h b/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h index 2d2096f430..7266af0c1d 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h @@ -55,17 +55,20 @@ void t8_dtet_compute_vertex_ref_coords (const t8_dtet_t *elem, int vertex, double coordinates[3]); -/** Convert a point in the reference space of a tet element to a point in the +/** Convert points in the reference space of a tet element to points in the * reference space of the tree (level 0) embedded in \f$ [0,1]^3 \f$. - * \param [in] elem Input tetrahedron. - * \param [in] ref_coords The reference coordinates inside the - * tet element \f$ [0,1]^2 \f$ - * \param [out] out_coords An array of 3 doubles that will be filled with the - * reference coordinates in the tree of the tet. + * \param [in] elem Input tet. + * \param [in] ref_coords The reference coordinates in the tet + * (\a num_coords times \f$ [0,1]^3 \f$) + * \param [in] num_coords Number of coordinates to evaluate + * \param [out] out_coords An array of \a num_coords x 3 x double that + * will be filled with the reference coordinates + * of the points on the tet. */ void t8_dtet_compute_reference_coords (const t8_dtet_t *elem, const double *ref_coords, + const int num_coords, double out_coords[3]); /** Compute the coordinates of the four vertices of a tetrahedron. diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx index 9298842705..afbd612cee 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx @@ -580,13 +580,13 @@ t8_default_scheme_tri_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); t8_dtri_compute_reference_coords ((const t8_dtri_t *) elem, ref_coords, - out_coords); + num_coords, out_coords); } int diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx index 892823ecb9..c84b5d4b0b 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx @@ -575,17 +575,19 @@ public: double coords[]) const; - /** Convert a point in the reference space of an element to a point in the + /** Convert points in the reference space of an element to points in the * reference space of the tree. * * \param [in] elem The element. - * \param [in] coords_input The coordinates of the point in the reference space of the element. - * \param [in] user_data User data. - * \param [out] out_coords The coordinates of the point in the reference space of the tree. + * \param [in] coords_input The coordinates \f$ [0,1]^\mathrm{dim} \f$ of the point + * in the reference space of the element. + * \param [in] num_coords Number of \f$ dim\f$-sized coordinates to evaluate. + * \param [out] out_coords The coordinates of the points in the + * reference space of the tree. */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c index ca02747b6a..16434b2b28 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c @@ -378,7 +378,11 @@ t8_dtri_compute_vertex_ref_coords (const t8_dtri_t *elem, const int vertex, void t8_dtri_compute_reference_coords (const t8_dtri_t *elem, const double *ref_coords, - double out_coords[T8_DTRI_DIM]) + const int num_coords, +#ifndef T8_DTRI_TO_DTET + const int skip_coords, +#endif + double *out_coords) { /* Calculate the reference coordinates of a triangle/tetrahedron in * relation to its orientation. Orientations are described here: @@ -420,30 +424,37 @@ t8_dtri_compute_reference_coords (const t8_dtri_t *elem, const int tet_orientation2 = (tet_orientation0 + ((type % 2 == 0) ? 2 : 1)) % 3; #endif - - out_coords[0] = elem->x; - out_coords[1] = elem->y; + for (int coord = 0; coord < num_coords; ++coord) { + /* offset defines, how many coordinates to skip in an iteration. */ +#ifndef T8_DTRI_TO_DTET + const int offset = (2 + skip_coords) * coord; +#else + const int offset = 3 * coord; +#endif + out_coords[offset + 0] = elem->x; + out_coords[offset + 1] = elem->y; #ifdef T8_DTRI_TO_DTET - out_coords[2] = elem->z; + out_coords[offset + 2] = elem->z; #endif #ifndef T8_DTRI_TO_DTET - out_coords[tri_orientation] += h * ref_coords[1]; - out_coords[1 - tri_orientation] += h * ref_coords[0]; + out_coords[offset + tri_orientation] += h * ref_coords[offset + 1]; + out_coords[offset + 1 - tri_orientation] += h * ref_coords[offset + 0]; #else - out_coords[tet_orientation0] += h * ref_coords[0]; - out_coords[tet_orientation1] += h * ref_coords[1]; - out_coords[tet_orientation2] += h * ref_coords[2]; + out_coords[offset + tet_orientation0] += h * ref_coords[offset + 0]; + out_coords[offset + tet_orientation1] += h * ref_coords[offset + 1]; + out_coords[offset + tet_orientation2] += h * ref_coords[offset + 2]; - /* done 3D */ + /* done 3D */ #endif - /* Since the integer coordinates are coordinates w.r.t to - * the embedding into [0,T8_DTRI_ROOT_LEN]^d, we just need - * to divide them by the root length. */ - out_coords[0] /= (double) T8_DTRI_ROOT_LEN; - out_coords[1] /= (double) T8_DTRI_ROOT_LEN; + /* Since the integer coordinates are coordinates w.r.t to + * the embedding into [0,T8_DTRI_ROOT_LEN]^d, we just need + * to divide them by the root length. */ + out_coords[offset + 0] /= (double) T8_DTRI_ROOT_LEN; + out_coords[offset + 1] /= (double) T8_DTRI_ROOT_LEN; #ifdef T8_DTRI_TO_DTET - out_coords[2] /= (double) T8_DTRI_ROOT_LEN; + out_coords[offset + 2] /= (double) T8_DTRI_ROOT_LEN; #endif + } } /* Compute the coordinates of each vertex of a triangle/tet */ diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h index 5b22a79ee8..7719bf9eb9 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h @@ -87,17 +87,25 @@ void t8_dtri_compute_vertex_ref_coords (const t8_dtri_t *elem, const int vertex, double coordinates[2]); -/** Convert a point in the reference space of a triangle element to a point in - * the reference space of the tree (level 0) embedded in \f$ [0,1]^2 \f$. +/** Convert points in the reference space of a tri element to points in the + * reference space of the tree (level 0) embedded in \f$ [0,1]^2 \f$. * \param [in] elem Input triangle. - * \param [in] ref_coords The reference coordinates inside the - * triangle element \f$ [0,1]^2 \f$ - * \param [out] out_coords An array of 2 doubles that will be filled with the - * reference coordinates in the tree of the triangle. + * \param [in] ref_coords The reference coordinates in the triangle + * (\a num_coords times \f$ [0,1]^2 \f$) + * \param [in] num_coords Number of coordinates to evaluate + * \param [in] skip_coords Only used for batch computation of prisms. + * In all other cases 0. + * Skip coordinates in the \a ref_coords and + * \a out_coords array. + * \param [out] out_coords An array of \a num_coords x 2 x double that + * will be filled with the reference coordinates + * of the points on the triangle. */ void t8_dtri_compute_reference_coords (const t8_dtri_t *elem, const double *ref_coords, + const int num_coords, + const int skip_coords, double out_coords[2]); /** Compute the coordinates of the four vertices of a triangle. diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx index 4b8da2ed98..23d7e8148d 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx @@ -325,14 +325,13 @@ t8_default_scheme_vertex_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void - *user_data, + const int num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); t8_dvertex_compute_reference_coords ((const t8_dvertex_t *) elem, - ref_coords, out_coords); + ref_coords, num_coords, out_coords); } #ifdef T8_ENABLE_DEBUG diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx index 4c4270f1d1..38f8899b26 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx @@ -615,17 +615,19 @@ public: double coords[]) const; - /** Convert a point in the reference space of an element to a point in the + /** Convert points in the reference space of an element to points in the * reference space of the tree. * * \param [in] elem The element. - * \param [in] coords_input The coordinates of the point in the reference space of the element. - * \param [in] user_data User data. - * \param [out] out_coords The coordinates of the point in the reference space of the tree. + * \param [in] coords_input The coordinates \f$ [0,1]^\mathrm{dim} \f$ of the point + * in the reference space of the element. + * \param [in] num_coords Number of \f$ dim\f$-sized coordinates to evaluate. + * \param [out] out_coords The coordinates of the points in the + * reference space of the tree. */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const void *user_data, + const int num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c index 18c76498e7..8c9a47dc3e 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c @@ -176,11 +176,13 @@ t8_dvertex_vertex_ref_coords (const t8_dvertex_t *elem, const int vertex, void t8_dvertex_compute_reference_coords (const t8_dvertex_t *elem, const double *ref_coords, - double *out_coords) + const int num_coords, double *out_coords) { T8_ASSERT (abs (ref_coords[0]) <= T8_PRECISION_EPS); T8_ASSERT (t8_dvertex_is_valid (elem)); - out_coords[0] = 0; + for (int coord = 0; coord < num_coords; ++coord) { + out_coords[coord] = 0; + } } t8_linearidx_t diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h index aedfc2bd6a..f8b36bbb99 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h @@ -195,16 +195,21 @@ void t8_dvertex_vertex_ref_coords (const t8_dvertex_t *elem, int vertex, double coords[]); -/** Compute the coordinates of a reference coordinate (always 0) inside the - * [0,1]^0 reference space. - * \param [in] elem Vertex whose vertex is computed. - * \param [in] ref_coords The reference coordinate inside the vertex (must be 0). - * \param [out] out_coords The coordinates of the computed vertex, must have one entry (will be set to 0). +/** Convert points in the reference space of a vertex element to points in the + * reference space of the tree (level 0) embedded in \f$ [0,1]^1 \f$. + * \param [in] elem Input vertex. + * \param [in] ref_coords The reference coordinates in the vertex + * (\a num_coords times \f$ [0,1]^1 \f$) + * \param [in] num_coords Number of coordinates to evaluate + * \param [out] out_coords An array of \a num_coords x 1 x double that + * will be filled with the reference coordinates + * of the points on the vertex (will be set to 0). */ void t8_dvertex_compute_reference_coords (const t8_dvertex_t *elem, const double *ref_coords, + const int num_coords, double *out_coords); /** Computes the linear position of a vertex in an uniform grid. From 6a07cfb4c40ed2f5e143138cd0004240626c6d5f Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 1 Aug 2023 12:33:08 +0200 Subject: [PATCH 2/9] bugfix --- src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx | 2 +- src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx index e1f98ac684..6d0c9f1333 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx @@ -567,7 +567,7 @@ t8_default_scheme_tet_c::t8_element_reference_coords (const t8_element_t { T8_ASSERT (t8_element_is_valid (elem)); t8_dtet_compute_reference_coords ((const t8_dtet_t *) elem, ref_coords, - num_coords, 0, out_coords); + num_coords, out_coords); } /** Returns true, if there is one element in the tree, that does not refine into 2^dim children. diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx index afbd612cee..25783d35c7 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx @@ -586,7 +586,7 @@ t8_default_scheme_tri_c::t8_element_reference_coords (const t8_element_t { T8_ASSERT (t8_element_is_valid (elem)); t8_dtri_compute_reference_coords ((const t8_dtri_t *) elem, ref_coords, - num_coords, out_coords); + num_coords, 0, out_coords); } int From d37e03ba3af8abac42adbb49aee802c33ba3f534 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 18 Aug 2023 09:09:01 +0200 Subject: [PATCH 3/9] use size_t instead of int for array size --- src/t8_element_cxx.hxx | 2 +- .../t8_default/t8_default_common/t8_default_common_cxx.hxx | 2 +- .../t8_default/t8_default_hex/t8_default_hex_cxx.cxx | 2 +- .../t8_default/t8_default_hex/t8_default_hex_cxx.hxx | 2 +- .../t8_default/t8_default_line/t8_default_line_cxx.cxx | 3 ++- .../t8_default/t8_default_line/t8_default_line_cxx.hxx | 2 +- .../t8_default/t8_default_prism/t8_default_prism_cxx.cxx | 3 ++- .../t8_default/t8_default_prism/t8_default_prism_cxx.hxx | 2 +- .../t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx | 2 +- .../t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx | 2 +- .../t8_default/t8_default_quad/t8_default_quad_cxx.cxx | 3 ++- .../t8_default/t8_default_quad/t8_default_quad_cxx.hxx | 2 +- .../t8_default/t8_default_tet/t8_default_tet_cxx.cxx | 2 +- .../t8_default/t8_default_tet/t8_default_tet_cxx.hxx | 2 +- .../t8_default/t8_default_tri/t8_default_tri_cxx.cxx | 2 +- .../t8_default/t8_default_tri/t8_default_tri_cxx.hxx | 2 +- .../t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx | 3 ++- .../t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx | 2 +- 18 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/t8_element_cxx.hxx b/src/t8_element_cxx.hxx index 015b8ce284..8c1d0f7637 100644 --- a/src/t8_element_cxx.hxx +++ b/src/t8_element_cxx.hxx @@ -617,7 +617,7 @@ public: */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const = 0; diff --git a/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx b/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx index ffc99506ab..0c2112c8e3 100644 --- a/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx @@ -121,7 +121,7 @@ public: */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const = 0; diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx index 2af3549d01..60b8376ff2 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx @@ -664,7 +664,7 @@ t8_default_scheme_hex_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const { diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx index 0db4240265..48b9d8501d 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx @@ -581,7 +581,7 @@ public: */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx index 0f0bb2aae2..ba20dcf0ef 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx @@ -372,7 +372,8 @@ t8_default_scheme_line_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t + num_coords, double *out_coords) const { diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx index e77a6d6ea2..f4cbbcee26 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx @@ -599,7 +599,7 @@ public: */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx index 122631bae4..24a7801e6c 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx @@ -484,7 +484,8 @@ t8_default_scheme_prism_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t + num_coords, double *out_coords) const { diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx index 3c75ec53ae..645ad039cd 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx @@ -608,7 +608,7 @@ public: */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx index 6b2f01faf3..806f5c7560 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx @@ -480,7 +480,7 @@ t8_default_scheme_pyramid_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int + const size_t num_coords, double *out_coords) const diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx index 988d86ca61..98120f4653 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx @@ -627,7 +627,7 @@ public: */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx index a2e6beb3d1..3375b28765 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx @@ -797,7 +797,8 @@ t8_default_scheme_quad_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t + num_coords, double *out_coords) const { diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx index 312e951069..7994b21b45 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx @@ -614,7 +614,7 @@ public: */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx index 6d0c9f1333..1a8c26a614 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx @@ -561,7 +561,7 @@ t8_default_scheme_tet_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const { diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx index c2a85ce3e3..78d19eb71c 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx @@ -594,7 +594,7 @@ public: */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx index 25783d35c7..6b8e3ff076 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx @@ -580,7 +580,7 @@ t8_default_scheme_tri_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const { diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx index c84b5d4b0b..bb3a0f161f 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx @@ -587,7 +587,7 @@ public: */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const; diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx index 23d7e8148d..9d2db2536d 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx @@ -325,7 +325,8 @@ t8_default_scheme_vertex_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t + num_coords, double *out_coords) const { diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx index 38f8899b26..e868df63a8 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx @@ -627,7 +627,7 @@ public: */ virtual void t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) const; From 1c587bac85dec40b00663bbc2c53f013360f8efe Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 18 Aug 2023 09:54:10 +0200 Subject: [PATCH 4/9] use size_t instead of int for array size in element bits --- src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c | 2 +- src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h | 2 +- src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c | 5 +++-- src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h | 6 ++++-- .../t8_default/t8_default_prism/t8_dprism_bits.c | 3 ++- .../t8_default/t8_default_prism/t8_dprism_bits.h | 3 ++- .../t8_default/t8_default_pyramid/t8_dpyramid_bits.c | 2 +- .../t8_default/t8_default_pyramid/t8_dpyramid_bits.h | 2 +- src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c | 3 ++- src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h | 3 ++- src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h | 4 ++-- src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c | 4 ++-- src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h | 7 ++++--- .../t8_default/t8_default_vertex/t8_dvertex_bits.c | 3 ++- .../t8_default/t8_default_vertex/t8_dvertex_bits.h | 3 ++- 15 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c index 2718d777aa..e0e0d5ad28 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c @@ -26,7 +26,7 @@ void t8_dhex_compute_reference_coords (const t8_dhex_t * elem, const double *ref_coords, - const int num_coords, double *out_coords) + const size_t num_coords, double *out_coords) { const p8est_quadrant_t *q1 = (const p8est_quadrant_t *) elem; diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h index f17c89cbe3..7f225cdda8 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h @@ -45,7 +45,7 @@ T8_EXTERN_C_BEGIN (); void t8_dhex_compute_reference_coords (const t8_dhex_t * elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords); T8_EXTERN_C_END (); diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c index a751941ecd..12fa2439ae 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c +++ b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c @@ -352,8 +352,9 @@ t8_dline_vertex_ref_coords (const t8_dline_t *elem, const int vertex, void t8_dline_compute_reference_coords (const t8_dline_t *elem, const double *ref_coords, - const int num_coords, - const int skip_coords, double *out_coords) + const size_t num_coords, + const size_t skip_coords, + double *out_coords) { T8_ASSERT (t8_dline_is_valid (elem)); for (int coord = 0; coord < num_coords; ++coord) { diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h index 1ed0f6df4a..cac34f9c75 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h +++ b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h @@ -259,8 +259,10 @@ void t8_dline_vertex_ref_coords (const t8_dline_t *elem, void t8_dline_compute_reference_coords (const t8_dline_t *elem, const double *ref_coords, - const int num_coords, - const int skip_coords, + const size_t + num_coords, + const size_t + skip_coords, double *out_coords); /** Computes the linear position of a line in an uniform grid. diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c index 80fcceddb9..5bcdc82dd9 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c @@ -597,7 +597,8 @@ t8_dprism_vertex_ref_coords (const t8_dprism_t *elem, const int vertex, void t8_dprism_compute_reference_coords (const t8_dprism_t *elem, const double *ref_coords, - const int num_coords, double *out_coords) + const size_t num_coords, + double *out_coords) { T8_ASSERT (t8_dprism_is_valid (elem)); T8_ASSERT (elem->line.level == elem->tri.level); diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h index 1257eb9eda..64a6d5045c 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h @@ -329,7 +329,8 @@ void t8_dprism_compute_reference_coords (const t8_dprism_t *elem, const double *ref_coords, - const int num_coords, + const size_t + num_coords, double *out_coords); /** Computes the linear position of a prism in an uniform grid. diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c index e491244b35..d57baf6ef3 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c @@ -1745,7 +1745,7 @@ t8_dpyramid_vertex_reference_coords (const t8_dpyramid_t *elem, void t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, double *out_coords) { T8_ASSERT (ref_coords != NULL); diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h index f15d093af6..3aee6c5e4a 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h @@ -386,7 +386,7 @@ void t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, const double *ref_coords, - const int + const size_t num_coords, double *out_coords); diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c index 97ce5e6537..b8d366ca79 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c @@ -26,7 +26,8 @@ void t8_dquad_compute_reference_coords (const t8_dquad_t * elem, const double *ref_coords, - const int num_coords, double *out_coords) + const size_t num_coords, + double *out_coords) { const p4est_quadrant_t *q1 = (const p4est_quadrant_t *) elem; diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h index e23c7a4b00..b032c6759c 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h @@ -46,7 +46,8 @@ void t8_dquad_compute_reference_coords (const t8_dquad_t * elem, const double *ref_coords, - const int num_coords, + const size_t + num_coords, double *out_coords); T8_EXTERN_C_END (); diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h b/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h index 7266af0c1d..ad1741e898 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h @@ -68,8 +68,8 @@ void t8_dtet_compute_vertex_ref_coords (const t8_dtet_t *elem, void t8_dtet_compute_reference_coords (const t8_dtet_t *elem, const double *ref_coords, - const int num_coords, - double out_coords[3]); + const size_t num_coords, + double *out_coords); /** Compute the coordinates of the four vertices of a tetrahedron. * \param [in] elem Input tetrahedron. diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c index 16434b2b28..5c1f9cda35 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c @@ -378,9 +378,9 @@ t8_dtri_compute_vertex_ref_coords (const t8_dtri_t *elem, const int vertex, void t8_dtri_compute_reference_coords (const t8_dtri_t *elem, const double *ref_coords, - const int num_coords, + const size_t num_coords, #ifndef T8_DTRI_TO_DTET - const int skip_coords, + const size_t skip_coords, #endif double *out_coords) { diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h index 7719bf9eb9..f2097a8248 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h @@ -104,9 +104,10 @@ void t8_dtri_compute_vertex_ref_coords (const t8_dtri_t *elem, void t8_dtri_compute_reference_coords (const t8_dtri_t *elem, const double *ref_coords, - const int num_coords, - const int skip_coords, - double out_coords[2]); + const size_t num_coords, + const size_t + skip_coords, + double *out_coords); /** Compute the coordinates of the four vertices of a triangle. * \param [in] elem Input triangle. diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c index 8c9a47dc3e..b277eb9e12 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c @@ -176,7 +176,8 @@ t8_dvertex_vertex_ref_coords (const t8_dvertex_t *elem, const int vertex, void t8_dvertex_compute_reference_coords (const t8_dvertex_t *elem, const double *ref_coords, - const int num_coords, double *out_coords) + const size_t num_coords, + double *out_coords) { T8_ASSERT (abs (ref_coords[0]) <= T8_PRECISION_EPS); T8_ASSERT (t8_dvertex_is_valid (elem)); diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h index f8b36bbb99..67edda1e89 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h @@ -209,7 +209,8 @@ void t8_dvertex_compute_reference_coords (const t8_dvertex_t *elem, const double *ref_coords, - const int num_coords, + const size_t + num_coords, double *out_coords); /** Computes the linear position of a vertex in an uniform grid. From 02da77d15d479ea6dff9a56d57a55f89e0298f21 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 18 Aug 2023 09:57:11 +0200 Subject: [PATCH 5/9] use size_t instead of int --- src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c | 4 ++-- src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c | 4 ++-- .../t8_default/t8_default_pyramid/t8_dpyramid_bits.c | 4 ++-- src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c | 4 ++-- src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c | 6 +++--- .../t8_default/t8_default_vertex/t8_dvertex_bits.c | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c index e0e0d5ad28..59709541fa 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c @@ -33,8 +33,8 @@ t8_dhex_compute_reference_coords (const t8_dhex_t * elem, /* Get the length of the quadrant */ const p4est_qcoord_t len = P8EST_QUADRANT_LEN (q1->level); - for (int coord = 0; coord < num_coords; ++coord) { - const int offset = 3 * coord; + for (size_t coord = 0; coord < num_coords; ++coord) { + const size_t offset = 3 * coord; /* Compute the x, y and z coordinates of the point depending on the * reference coordinates */ out_coords[offset + 0] = q1->x + ref_coords[offset + 0] * len; diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c index 12fa2439ae..796d2a12f2 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c +++ b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c @@ -357,8 +357,8 @@ t8_dline_compute_reference_coords (const t8_dline_t *elem, double *out_coords) { T8_ASSERT (t8_dline_is_valid (elem)); - for (int coord = 0; coord < num_coords; ++coord) { - const int offset = coord * skip_coords; + for (size_t coord = 0; coord < num_coords; ++coord) { + const size_t offset = coord * skip_coords; out_coords[offset] = elem->x; out_coords[offset] += T8_DLINE_LEN (elem->level) * ref_coords[coord]; out_coords[offset] /= (double) T8_DLINE_ROOT_LEN; diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c index d57baf6ef3..01c227f4f6 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c @@ -1753,8 +1753,8 @@ t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, if (t8_dpyramid_shape (elem) == T8_ECLASS_PYRAMID) { const t8_dpyramid_coord_t length = T8_DPYRAMID_LEN (elem->pyramid.level); - for (int coord = 0; coord < num_coords; ++coord) { - const int offset = coord * 3; + for (size_t coord = 0; coord < num_coords; ++coord) { + const size_t offset = coord * 3; out_coords[offset + 0] = elem->pyramid.x; out_coords[offset + 1] = elem->pyramid.y; out_coords[offset + 2] = elem->pyramid.z; diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c index b8d366ca79..6fe20e9b7f 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c @@ -33,8 +33,8 @@ t8_dquad_compute_reference_coords (const t8_dquad_t * elem, const p4est_qcoord_t h = P4EST_QUADRANT_LEN (q1->level); - for (int coord = 0; coord < num_coords; ++coord) { - const int offset = coord * 2; + for (size_t coord = 0; coord < num_coords; ++coord) { + const size_t offset = coord * 2; out_coords[offset + 0] = q1->x + ref_coords[offset + 0] * h; out_coords[offset + 1] = q1->y + ref_coords[offset + 1] * h; diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c index 5c1f9cda35..e301eca867 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c @@ -424,12 +424,12 @@ t8_dtri_compute_reference_coords (const t8_dtri_t *elem, const int tet_orientation2 = (tet_orientation0 + ((type % 2 == 0) ? 2 : 1)) % 3; #endif - for (int coord = 0; coord < num_coords; ++coord) { + for (size_t coord = 0; coord < num_coords; ++coord) { /* offset defines, how many coordinates to skip in an iteration. */ #ifndef T8_DTRI_TO_DTET - const int offset = (2 + skip_coords) * coord; + const size_t offset = (2 + skip_coords) * coord; #else - const int offset = 3 * coord; + const size_t offset = 3 * coord; #endif out_coords[offset + 0] = elem->x; out_coords[offset + 1] = elem->y; diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c index b277eb9e12..a77869e8b1 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c @@ -181,7 +181,7 @@ t8_dvertex_compute_reference_coords (const t8_dvertex_t *elem, { T8_ASSERT (abs (ref_coords[0]) <= T8_PRECISION_EPS); T8_ASSERT (t8_dvertex_is_valid (elem)); - for (int coord = 0; coord < num_coords; ++coord) { + for (size_t coord = 0; coord < num_coords; ++coord) { out_coords[coord] = 0; } } From 5301bd364c3bab431010a96e61a53ae390a4dea0 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 29 Aug 2023 23:05:35 +0200 Subject: [PATCH 6/9] indent --- src/t8_element_cxx.hxx | 9 ++++----- src/t8_forest/t8_forest_cxx.cxx | 14 ++++++-------- .../t8_default_common/t8_default_common_cxx.hxx | 9 ++++----- .../t8_default_hex/t8_default_hex_cxx.cxx | 12 +++--------- .../t8_default_hex/t8_default_hex_cxx.hxx | 8 +++----- .../t8_default/t8_default_hex/t8_dhex_bits.c | 7 +++---- .../t8_default/t8_default_hex/t8_dhex_bits.h | 8 +++----- .../t8_default_line/t8_default_line_cxx.cxx | 13 +++---------- .../t8_default_line/t8_default_line_cxx.hxx | 8 +++----- .../t8_default/t8_default_line/t8_dline_bits.c | 9 +++------ .../t8_default/t8_default_line/t8_dline_bits.h | 11 +++-------- .../t8_default_prism/t8_default_prism_cxx.cxx | 17 +++++------------ .../t8_default_prism/t8_default_prism_cxx.hxx | 8 +++----- .../t8_default_prism/t8_dprism_bits.c | 10 +++------- .../t8_default_prism/t8_dprism_bits.h | 10 +++------- .../t8_default_pyramid_cxx.cxx | 17 +++++------------ .../t8_default_pyramid_cxx.hxx | 8 +++----- .../t8_default_pyramid/t8_dpyramid_bits.c | 15 +++++---------- .../t8_default_pyramid/t8_dpyramid_bits.h | 10 +++------- .../t8_default_quad/t8_default_quad_cxx.cxx | 13 +++---------- .../t8_default_quad/t8_default_quad_cxx.hxx | 8 +++----- .../t8_default/t8_default_quad/t8_dquad_bits.c | 6 ++---- .../t8_default/t8_default_quad/t8_dquad_bits.h | 10 +++------- .../t8_default_tet/t8_default_tet_cxx.cxx | 12 +++--------- .../t8_default_tet/t8_default_tet_cxx.hxx | 8 +++----- .../t8_default/t8_default_tet/t8_dtet_bits.h | 8 +++----- .../t8_default_tri/t8_default_tri_cxx.cxx | 12 +++--------- .../t8_default_tri/t8_default_tri_cxx.hxx | 8 +++----- .../t8_default/t8_default_tri/t8_dtri_bits.c | 8 +++----- .../t8_default/t8_default_tri/t8_dtri_bits.h | 10 +++------- .../t8_default_vertex/t8_default_vertex_cxx.cxx | 13 +++---------- .../t8_default_vertex/t8_default_vertex_cxx.hxx | 8 +++----- .../t8_default_vertex/t8_dvertex_bits.c | 4 +--- .../t8_default_vertex/t8_dvertex_bits.h | 10 +++------- 34 files changed, 110 insertions(+), 231 deletions(-) diff --git a/src/t8_element_cxx.hxx b/src/t8_element_cxx.hxx index bf89bb6945..e0c0f175d8 100644 --- a/src/t8_element_cxx.hxx +++ b/src/t8_element_cxx.hxx @@ -627,11 +627,10 @@ struct t8_eclass_scheme * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void t8_element_reference_coords (const t8_element_t *elem, - const double *ref_coords, - const size_t num_coords, - double *out_coords) - const = 0; + virtual void + t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords) const + = 0; /* TODO: deactivate */ /** Return a pointer to a t8_element in an array indexed by a size_t. diff --git a/src/t8_forest/t8_forest_cxx.cxx b/src/t8_forest/t8_forest_cxx.cxx index 02039a852f..5eed7b3905 100644 --- a/src/t8_forest/t8_forest_cxx.cxx +++ b/src/t8_forest/t8_forest_cxx.cxx @@ -395,14 +395,12 @@ void t8_forest_element_from_ref_coords (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element, const double *ref_coords, double *coords_out, sc_array_t *stretch_factors) { - double tree_ref_coords[3] = { 0 }; - const t8_eclass_t tree_class = t8_forest_get_tree_class (forest, ltreeid); - const t8_eclass_scheme_c *scheme = - t8_forest_get_eclass_scheme (forest, tree_class); - scheme->t8_element_reference_coords (element, ref_coords, 1, - tree_ref_coords); - const t8_cmesh_t cmesh = t8_forest_get_cmesh (forest); - const t8_gloidx_t gtreeid = t8_forest_global_tree_id (forest, ltreeid); + double tree_ref_coords[3] = { 0 }; + const t8_eclass_t tree_class = t8_forest_get_tree_class (forest, ltreeid); + const t8_eclass_scheme_c *scheme = t8_forest_get_eclass_scheme (forest, tree_class); + scheme->t8_element_reference_coords (element, ref_coords, 1, tree_ref_coords); + const t8_cmesh_t cmesh = t8_forest_get_cmesh (forest); + const t8_gloidx_t gtreeid = t8_forest_global_tree_id (forest, ltreeid); t8_geometry_evaluate (cmesh, gtreeid, tree_ref_coords, coords_out); } diff --git a/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx b/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx index 287992a718..4050825fd9 100644 --- a/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_common/t8_default_common_cxx.hxx @@ -119,11 +119,10 @@ class t8_default_scheme_common_c: public t8_eclass_scheme_c { * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void t8_element_reference_coords (const t8_element_t *elem, - const double *ref_coords, - const size_t num_coords, - double *out_coords) - const = 0; + virtual void + t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords) const + = 0; /** Get the integer coordinates of the anchor node of an element. * The default scheme implements the Morton type SFCs. In these SFCs the diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx index 7d17b887a7..64da81b3fc 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx @@ -584,17 +584,11 @@ t8_default_scheme_hex_c::t8_element_vertex_reference_coords (const t8_element_t } void -t8_default_scheme_hex_c::t8_element_reference_coords (const t8_element_t - *elem, - const double - *ref_coords, - const size_t num_coords, - double *out_coords) - const +t8_default_scheme_hex_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, + const size_t num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); - t8_dhex_compute_reference_coords ((const t8_dhex_t *) elem, ref_coords, - num_coords, out_coords); + t8_dhex_compute_reference_coords ((const t8_dhex_t *) elem, ref_coords, num_coords, out_coords); } int diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx index a681588e2f..4329023766 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.hxx @@ -557,11 +557,9 @@ struct t8_default_scheme_hex_c: public t8_default_scheme_common_c * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void t8_element_reference_coords (const t8_element_t *elem, - const double *ref_coords, - const size_t num_coords, - double *out_coords) - const; + virtual void + t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords) const; /** Returns true, if there is one element in the tree, that does not refine into 2^dim children. * Returns false otherwise. diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c index 59709541fa..5ddec13a69 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.c @@ -24,9 +24,8 @@ #include void -t8_dhex_compute_reference_coords (const t8_dhex_t * elem, - const double *ref_coords, - const size_t num_coords, double *out_coords) +t8_dhex_compute_reference_coords (const t8_dhex_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords) { const p8est_quadrant_t *q1 = (const p8est_quadrant_t *) elem; @@ -34,7 +33,7 @@ t8_dhex_compute_reference_coords (const t8_dhex_t * elem, const p4est_qcoord_t len = P8EST_QUADRANT_LEN (q1->level); for (size_t coord = 0; coord < num_coords; ++coord) { - const size_t offset = 3 * coord; + const size_t offset = 3 * coord; /* Compute the x, y and z coordinates of the point depending on the * reference coordinates */ out_coords[offset + 0] = q1->x + ref_coords[offset + 0] * len; diff --git a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h index 7f225cdda8..92c5ec8cec 100644 --- a/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h +++ b/src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h @@ -42,11 +42,9 @@ T8_EXTERN_C_BEGIN (); * will be filled with the reference coordinates * of the points on the hex. */ -void t8_dhex_compute_reference_coords (const t8_dhex_t * elem, - const double - *ref_coords, - const size_t num_coords, - double *out_coords); +void +t8_dhex_compute_reference_coords (const t8_dhex_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords); T8_EXTERN_C_END (); diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx index 8b329c80b9..1615c16cae 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.cxx @@ -296,19 +296,12 @@ t8_default_scheme_line_c::t8_element_vertex_reference_coords (const t8_element_t } void -t8_default_scheme_line_c::t8_element_reference_coords (const t8_element_t - *elem, - const double - *ref_coords, - const size_t - num_coords, - double *out_coords) - const +t8_default_scheme_line_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, + const size_t num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); T8_ASSERT (ref_coords != NULL); - t8_dline_compute_reference_coords ((const t8_dline_t *) elem, ref_coords, - num_coords, 0, out_coords); + t8_dline_compute_reference_coords ((const t8_dline_t *) elem, ref_coords, num_coords, 0, out_coords); } int diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx index da9c2a2591..72662f5d35 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx @@ -575,11 +575,9 @@ struct t8_default_scheme_line_c: public t8_default_scheme_common_c * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void t8_element_reference_coords (const t8_element_t *elem, - const double *ref_coords, - const size_t num_coords, - double *out_coords) - const; + virtual void + t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords) const; /** Returns true, if there is one element in the tree, that does not refine into 2^dim children. * Returns false otherwise. diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c index 6837aa9dd1..a984935465 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c +++ b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.c @@ -340,15 +340,12 @@ t8_dline_vertex_ref_coords (const t8_dline_t *elem, const int vertex, double coo } void -t8_dline_compute_reference_coords (const t8_dline_t *elem, - const double *ref_coords, - const size_t num_coords, - const size_t skip_coords, - double *out_coords) +t8_dline_compute_reference_coords (const t8_dline_t *elem, const double *ref_coords, const size_t num_coords, + const size_t skip_coords, double *out_coords) { T8_ASSERT (t8_dline_is_valid (elem)); for (size_t coord = 0; coord < num_coords; ++coord) { - const size_t offset = coord * skip_coords; + const size_t offset = coord * skip_coords; out_coords[offset] = elem->x; out_coords[offset] += T8_DLINE_LEN (elem->level) * ref_coords[coord]; out_coords[offset] /= (double) T8_DLINE_ROOT_LEN; diff --git a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h index ae1d72d041..a187d7bb18 100644 --- a/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h +++ b/src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h @@ -261,14 +261,9 @@ t8_dline_vertex_ref_coords (const t8_dline_t *elem, const int vertex, double coo * will be filled with the reference coordinates * of the points on the line. */ -void t8_dline_compute_reference_coords (const t8_dline_t *elem, - const double - *ref_coords, - const size_t - num_coords, - const size_t - skip_coords, - double *out_coords); +void +t8_dline_compute_reference_coords (const t8_dline_t *elem, const double *ref_coords, const size_t num_coords, + const size_t skip_coords, double *out_coords); /** Computes the linear position of a line in an uniform grid. * \param [in] line Line whose id will be computed. diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx index 0cb98c5a17..a93a8f1a8a 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.cxx @@ -404,18 +404,11 @@ t8_default_scheme_prism_c::t8_element_vertex_reference_coords (const t8_element_ } void -t8_default_scheme_prism_c::t8_element_reference_coords (const t8_element_t - *elem, - const double - *ref_coords, - const size_t - num_coords, - double *out_coords) - const -{ - T8_ASSERT (t8_element_is_valid (elem)); - t8_dprism_compute_reference_coords ((const t8_dprism_t *) elem, ref_coords, - num_coords, out_coords); +t8_default_scheme_prism_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, + const size_t num_coords, double *out_coords) const +{ + T8_ASSERT (t8_element_is_valid (elem)); + t8_dprism_compute_reference_coords ((const t8_dprism_t *) elem, ref_coords, num_coords, out_coords); } void diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx index 20aa37fa5b..863e9274df 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_default_prism_cxx.hxx @@ -553,11 +553,9 @@ struct t8_default_scheme_prism_c: public t8_default_scheme_common_c * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void t8_element_reference_coords (const t8_element_t *elem, - const double *ref_coords, - const size_t num_coords, - double *out_coords) - const; + virtual void + t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords) const; /** Returns true, if there is one element in the tree, that does not refine into 2^dim children. * Returns false otherwise. diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c index 4e5e0c1734..b9d93efec2 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c @@ -562,19 +562,15 @@ t8_dprism_vertex_ref_coords (const t8_dprism_t *elem, const int vertex, double c } void -t8_dprism_compute_reference_coords (const t8_dprism_t *elem, - const double *ref_coords, - const size_t num_coords, +t8_dprism_compute_reference_coords (const t8_dprism_t *elem, const double *ref_coords, const size_t num_coords, double *out_coords) { T8_ASSERT (t8_dprism_is_valid (elem)); T8_ASSERT (elem->line.level == elem->tri.level); /*Compute x and y coordinate */ - t8_dtri_compute_reference_coords (&elem->tri, ref_coords, num_coords, 1, - out_coords); + t8_dtri_compute_reference_coords (&elem->tri, ref_coords, num_coords, 1, out_coords); /*Compute z coordinate */ - t8_dline_compute_reference_coords (&elem->line, ref_coords + 2, num_coords, - 2, out_coords + 2); + t8_dline_compute_reference_coords (&elem->line, ref_coords + 2, num_coords, 2, out_coords + 2); } t8_linearidx_t diff --git a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h index 4faf69ba13..1e1c6ebce8 100644 --- a/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h +++ b/src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h @@ -308,13 +308,9 @@ t8_dprism_vertex_ref_coords (const t8_dprism_t *elem, int vertex, double coords[ * will be filled with the reference coordinates * of the points on the prism. */ -void t8_dprism_compute_reference_coords (const t8_dprism_t - *elem, - const double - *ref_coords, - const size_t - num_coords, - double *out_coords); +void +t8_dprism_compute_reference_coords (const t8_dprism_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords); /** Computes the linear position of a prism in an uniform grid. * \param [in] p Prism whose id will be computed. diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx index e277d685e9..0bac46a2e2 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.cxx @@ -382,18 +382,11 @@ t8_default_scheme_pyramid_c::t8_element_vertex_reference_coords (const t8_elemen } void -t8_default_scheme_pyramid_c::t8_element_reference_coords (const t8_element_t - *elem, - const double - *ref_coords, - const size_t - num_coords, - double *out_coords) - const -{ - T8_ASSERT (t8_element_is_valid (elem)); - t8_dpyramid_compute_reference_coords ((const t8_dpyramid_t *) elem, - ref_coords, num_coords, out_coords); +t8_default_scheme_pyramid_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, + const size_t num_coords, double *out_coords) const +{ + T8_ASSERT (t8_element_is_valid (elem)); + t8_dpyramid_compute_reference_coords ((const t8_dpyramid_t *) elem, ref_coords, num_coords, out_coords); } int diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx index 08d6b3a18a..c5dd3e8a78 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid_cxx.hxx @@ -545,11 +545,9 @@ struct t8_default_scheme_pyramid_c: public t8_default_scheme_common_c * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void t8_element_reference_coords (const t8_element_t *elem, - const double *ref_coords, - const size_t num_coords, - double *out_coords) - const; + virtual void + t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords) const; /** Returns true, if there is one element in the tree, that does not refine into 2^dim children. * Returns false otherwise. diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c index 85beb5065f..17a243c7f9 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c @@ -1554,9 +1554,7 @@ t8_dpyramid_vertex_reference_coords (const t8_dpyramid_t *elem, const int vertex } void -t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, - const double *ref_coords, - const size_t num_coords, +t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, const double *ref_coords, const size_t num_coords, double *out_coords) { T8_ASSERT (ref_coords != NULL); @@ -1565,7 +1563,7 @@ t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, const t8_dpyramid_coord_t length = T8_DPYRAMID_LEN (elem->pyramid.level); for (size_t coord = 0; coord < num_coords; ++coord) { - const size_t offset = coord * 3; + const size_t offset = coord * 3; out_coords[offset + 0] = elem->pyramid.x; out_coords[offset + 1] = elem->pyramid.y; out_coords[offset + 2] = elem->pyramid.z; @@ -1576,10 +1574,8 @@ t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, out_coords[offset + 2] += ref_coords[offset + 2] * length; } else { - out_coords[offset + 0] += - (ref_coords[offset + 0] - ref_coords[offset + 2]) * length; - out_coords[offset + 1] += - (ref_coords[offset + 1] - ref_coords[offset + 2]) * length; + out_coords[offset + 0] += (ref_coords[offset + 0] - ref_coords[offset + 2]) * length; + out_coords[offset + 1] += (ref_coords[offset + 1] - ref_coords[offset + 2]) * length; out_coords[offset + 2] += (1 - ref_coords[offset + 2]) * length; } @@ -1590,8 +1586,7 @@ t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, } } else { - t8_dtet_compute_reference_coords (&(elem->pyramid), ref_coords, - num_coords, out_coords); + t8_dtet_compute_reference_coords (&(elem->pyramid), ref_coords, num_coords, out_coords); } } diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h index 4be1fe19f2..d9c3aea005 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.h @@ -355,13 +355,9 @@ t8_dpyramid_vertex_reference_coords (const t8_dpyramid_t *elem, const int vertex * will be filled with the reference coordinates * of the points on the pyramid. */ -void t8_dpyramid_compute_reference_coords (const t8_dpyramid_t - *elem, - const double - *ref_coords, - const size_t - num_coords, - double *out_coords); +void +t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords); /** * Compute the nearest common ancestor of two elements diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx index de7701608f..9686135234 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.cxx @@ -713,18 +713,11 @@ t8_default_scheme_quad_c::t8_element_vertex_reference_coords (const t8_element_t } void -t8_default_scheme_quad_c::t8_element_reference_coords (const t8_element_t - *elem, - const double - *ref_coords, - const size_t - num_coords, - double *out_coords) - const +t8_default_scheme_quad_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, + const size_t num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); - t8_dquad_compute_reference_coords ((const t8_dquad_t *) elem, ref_coords, - num_coords, out_coords); + t8_dquad_compute_reference_coords ((const t8_dquad_t *) elem, ref_coords, num_coords, out_coords); } void diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx index 277e8d92e5..9e1f718328 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_default_quad_cxx.hxx @@ -592,11 +592,9 @@ struct t8_default_scheme_quad_c: public t8_default_scheme_common_c * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void t8_element_reference_coords (const t8_element_t *elem, - const double *ref_coords, - const size_t num_coords, - double *out_coords) - const; + virtual void + t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords) const; /** Returns true, if there is one element in the tree, that does not refine into 2^dim children. * Returns false otherwise. diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c index 6fe20e9b7f..3bed7be214 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.c @@ -24,9 +24,7 @@ #include void -t8_dquad_compute_reference_coords (const t8_dquad_t * elem, - const double *ref_coords, - const size_t num_coords, +t8_dquad_compute_reference_coords (const t8_dquad_t *elem, const double *ref_coords, const size_t num_coords, double *out_coords) { const p4est_quadrant_t *q1 = (const p4est_quadrant_t *) elem; @@ -34,7 +32,7 @@ t8_dquad_compute_reference_coords (const t8_dquad_t * elem, const p4est_qcoord_t h = P4EST_QUADRANT_LEN (q1->level); for (size_t coord = 0; coord < num_coords; ++coord) { - const size_t offset = coord * 2; + const size_t offset = coord * 2; out_coords[offset + 0] = q1->x + ref_coords[offset + 0] * h; out_coords[offset + 1] = q1->y + ref_coords[offset + 1] * h; diff --git a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h index b032c6759c..8320e586ac 100644 --- a/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h +++ b/src/t8_schemes/t8_default/t8_default_quad/t8_dquad_bits.h @@ -42,13 +42,9 @@ T8_EXTERN_C_BEGIN (); * will be filled with the reference coordinates * of the points on the quad. */ -void t8_dquad_compute_reference_coords (const t8_dquad_t * - elem, - const double - *ref_coords, - const size_t - num_coords, - double *out_coords); +void +t8_dquad_compute_reference_coords (const t8_dquad_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords); T8_EXTERN_C_END (); diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx index ab4b8bea78..b92f0e06a7 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.cxx @@ -488,17 +488,11 @@ t8_default_scheme_tet_c::t8_element_vertex_reference_coords (const t8_element_t } void -t8_default_scheme_tet_c::t8_element_reference_coords (const t8_element_t - *elem, - const double - *ref_coords, - const size_t num_coords, - double *out_coords) - const +t8_default_scheme_tet_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, + const size_t num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); - t8_dtet_compute_reference_coords ((const t8_dtet_t *) elem, ref_coords, - num_coords, out_coords); + t8_dtet_compute_reference_coords ((const t8_dtet_t *) elem, ref_coords, num_coords, out_coords); } /** Returns true, if there is one element in the tree, that does not refine into 2^dim children. diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx index d85877c74f..5da90f6971 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_default_tet_cxx.hxx @@ -512,11 +512,9 @@ struct t8_default_scheme_tet_c: public t8_default_scheme_common_c * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void t8_element_reference_coords (const t8_element_t *elem, - const double *ref_coords, - const size_t num_coords, - double *out_coords) - const; + virtual void + t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords) const; /** Returns true, if there is one element in the tree, that does not refine into 2^dim children. * Returns false otherwise. diff --git a/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h b/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h index ac3c5866f4..02ae001d42 100644 --- a/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h +++ b/src/t8_schemes/t8_default/t8_default_tet/t8_dtet_bits.h @@ -62,11 +62,9 @@ t8_dtet_compute_vertex_ref_coords (const t8_dtet_t *elem, int vertex, double coo * will be filled with the reference coordinates * of the points on the tet. */ -void t8_dtet_compute_reference_coords (const t8_dtet_t *elem, - const double - *ref_coords, - const size_t num_coords, - double *out_coords); +void +t8_dtet_compute_reference_coords (const t8_dtet_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords); /** Compute the coordinates of the four vertices of a tetrahedron. * \param [in] elem Input tetrahedron. diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx index df2c9d6643..6efd9df221 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.cxx @@ -502,17 +502,11 @@ t8_default_scheme_tri_c::t8_element_vertex_reference_coords (const t8_element_t } void -t8_default_scheme_tri_c::t8_element_reference_coords (const t8_element_t - *elem, - const double - *ref_coords, - const size_t num_coords, - double *out_coords) - const +t8_default_scheme_tri_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, + const size_t num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); - t8_dtri_compute_reference_coords ((const t8_dtri_t *) elem, ref_coords, - num_coords, 0, out_coords); + t8_dtri_compute_reference_coords ((const t8_dtri_t *) elem, ref_coords, num_coords, 0, out_coords); } int diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx index 06261f3ba7..9c623606af 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_default_tri_cxx.hxx @@ -506,11 +506,9 @@ struct t8_default_scheme_tri_c: public t8_default_scheme_common_c * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void t8_element_reference_coords (const t8_element_t *elem, - const double *ref_coords, - const size_t num_coords, - double *out_coords) - const; + virtual void + t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords) const; /** Returns true, if there is one element in the tree, that does not refine into 2^dim children. * Returns false otherwise. diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c index 03e801a1bb..2695e609b6 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.c @@ -368,9 +368,7 @@ t8_dtri_compute_vertex_ref_coords (const t8_dtri_t *elem, const int vertex, doub } void -t8_dtri_compute_reference_coords (const t8_dtri_t *elem, - const double *ref_coords, - const size_t num_coords, +t8_dtri_compute_reference_coords (const t8_dtri_t *elem, const double *ref_coords, const size_t num_coords, #ifndef T8_DTRI_TO_DTET const size_t skip_coords, #endif @@ -417,9 +415,9 @@ t8_dtri_compute_reference_coords (const t8_dtri_t *elem, for (size_t coord = 0; coord < num_coords; ++coord) { /* offset defines, how many coordinates to skip in an iteration. */ #ifndef T8_DTRI_TO_DTET - const size_t offset = (2 + skip_coords) * coord; + const size_t offset = (2 + skip_coords) * coord; #else - const size_t offset = 3 * coord; + const size_t offset = 3 * coord; #endif out_coords[offset + 0] = elem->x; out_coords[offset + 1] = elem->y; diff --git a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h index 4ae79a36fa..35d8722cdd 100644 --- a/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h +++ b/src/t8_schemes/t8_default/t8_default_tri/t8_dtri_bits.h @@ -97,13 +97,9 @@ t8_dtri_compute_vertex_ref_coords (const t8_dtri_t *elem, const int vertex, doub * will be filled with the reference coordinates * of the points on the triangle. */ -void t8_dtri_compute_reference_coords (const t8_dtri_t *elem, - const double - *ref_coords, - const size_t num_coords, - const size_t - skip_coords, - double *out_coords); +void +t8_dtri_compute_reference_coords (const t8_dtri_t *elem, const double *ref_coords, const size_t num_coords, + const size_t skip_coords, double *out_coords); /** Compute the coordinates of the four vertices of a triangle. * \param [in] elem Input triangle. diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx index d880bc9817..99d4f56e86 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.cxx @@ -274,18 +274,11 @@ t8_default_scheme_vertex_c::t8_element_vertex_reference_coords (const t8_element } void -t8_default_scheme_vertex_c::t8_element_reference_coords (const t8_element_t - *elem, - const double - *ref_coords, - const size_t - num_coords, - double *out_coords) - const +t8_default_scheme_vertex_c::t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, + const size_t num_coords, double *out_coords) const { T8_ASSERT (t8_element_is_valid (elem)); - t8_dvertex_compute_reference_coords ((const t8_dvertex_t *) elem, - ref_coords, num_coords, out_coords); + t8_dvertex_compute_reference_coords ((const t8_dvertex_t *) elem, ref_coords, num_coords, out_coords); } #ifdef T8_ENABLE_DEBUG diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx index 382c75e37c..126a5f33e6 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_default_vertex_cxx.hxx @@ -602,11 +602,9 @@ struct t8_default_scheme_vertex_c: public t8_default_scheme_common_c * \param [out] out_coords The coordinates of the points in the * reference space of the tree. */ - virtual void t8_element_reference_coords (const t8_element_t *elem, - const double *ref_coords, - const size_t num_coords, - double *out_coords) - const; + virtual void + t8_element_reference_coords (const t8_element_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords) const; /** Returns true, if there is one element in the tree, that does not refine into 2^dim children. * Returns false otherwise. diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c index 55e179d0c1..995844d775 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.c @@ -169,9 +169,7 @@ t8_dvertex_vertex_ref_coords (const t8_dvertex_t *elem, const int vertex, double } void -t8_dvertex_compute_reference_coords (const t8_dvertex_t *elem, - const double *ref_coords, - const size_t num_coords, +t8_dvertex_compute_reference_coords (const t8_dvertex_t *elem, const double *ref_coords, const size_t num_coords, double *out_coords) { T8_ASSERT (abs (ref_coords[0]) <= T8_PRECISION_EPS); diff --git a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h index 529fda4af1..21c899109d 100644 --- a/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h +++ b/src/t8_schemes/t8_default/t8_default_vertex/t8_dvertex_bits.h @@ -206,13 +206,9 @@ t8_dvertex_vertex_ref_coords (const t8_dvertex_t *elem, int vertex, double coord * will be filled with the reference coordinates * of the points on the vertex (will be set to 0). */ -void t8_dvertex_compute_reference_coords (const t8_dvertex_t - *elem, - const double - *ref_coords, - const size_t - num_coords, - double *out_coords); +void +t8_dvertex_compute_reference_coords (const t8_dvertex_t *elem, const double *ref_coords, const size_t num_coords, + double *out_coords); /** Computes the linear position of a vertex in an uniform grid. * \param [in] vertex vertex whose id will be computed. From ecdc84f524d02e1810d5ecd7a444b6fdb1171a42 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Wed, 6 Sep 2023 12:10:36 +0200 Subject: [PATCH 7/9] performance engineering --- .../t8_default_pyramid/t8_dpyramid_bits.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c index 17a243c7f9..448cc7c1f0 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c @@ -1561,24 +1561,31 @@ t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, const double *r T8_ASSERT (t8_dpyramid_is_valid (elem)); if (t8_dpyramid_shape (elem) == T8_ECLASS_PYRAMID) { const t8_dpyramid_coord_t length = T8_DPYRAMID_LEN (elem->pyramid.level); - - for (size_t coord = 0; coord < num_coords; ++coord) { + size_t coord; + for (coord = 0; coord < num_coords; ++coord) { const size_t offset = coord * 3; out_coords[offset + 0] = elem->pyramid.x; out_coords[offset + 1] = elem->pyramid.y; out_coords[offset + 2] = elem->pyramid.z; - - if (elem->pyramid.type == T8_DPYRAMID_FIRST_TYPE) { + } + if (elem->pyramid.type == T8_DPYRAMID_FIRST_TYPE) { + for (coord = 0; coord < num_coords; ++coord) { + const size_t offset = coord * 3; out_coords[offset + 0] += ref_coords[offset + 0] * length; out_coords[offset + 1] += ref_coords[offset + 1] * length; out_coords[offset + 2] += ref_coords[offset + 2] * length; } - else { + } + else { + for (coord = 0; coord < num_coords; ++coord) { + const size_t offset = coord * 3; out_coords[offset + 0] += (ref_coords[offset + 0] - ref_coords[offset + 2]) * length; out_coords[offset + 1] += (ref_coords[offset + 1] - ref_coords[offset + 2]) * length; out_coords[offset + 2] += (1 - ref_coords[offset + 2]) * length; } - + } + for (coord = 0; coord < num_coords; ++coord) { + const size_t offset = coord * 3; /*scale the coordinates onto the reference cube */ out_coords[offset + 0] /= (double) T8_DPYRAMID_ROOT_LEN; out_coords[offset + 1] /= (double) T8_DPYRAMID_ROOT_LEN; From 34a3c5c7abae5bc279d831e75df3872dbe33b8d3 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 8 Sep 2023 09:59:00 +0200 Subject: [PATCH 8/9] typo --- src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c index 448cc7c1f0..3d19f40a61 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c @@ -1586,7 +1586,7 @@ t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, const double *r } for (coord = 0; coord < num_coords; ++coord) { const size_t offset = coord * 3; - /*scale the coordinates onto the reference cube */ + /* Scale the coordinates onto the reference cube */ out_coords[offset + 0] /= (double) T8_DPYRAMID_ROOT_LEN; out_coords[offset + 1] /= (double) T8_DPYRAMID_ROOT_LEN; out_coords[offset + 2] /= (double) T8_DPYRAMID_ROOT_LEN; From 4308441dbe1bcd7f1749a7687afd405f9d10dffc Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 11 Sep 2023 10:23:23 +0200 Subject: [PATCH 9/9] reduce spaghetti-code --- .../t8_default_pyramid/t8_dpyramid_bits.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c index 3d19f40a61..eff0cbcb07 100644 --- a/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c +++ b/src/t8_schemes/t8_default/t8_default_pyramid/t8_dpyramid_bits.c @@ -1567,21 +1567,17 @@ t8_dpyramid_compute_reference_coords (const t8_dpyramid_t *elem, const double *r out_coords[offset + 0] = elem->pyramid.x; out_coords[offset + 1] = elem->pyramid.y; out_coords[offset + 2] = elem->pyramid.z; + + out_coords[offset + 0] += ref_coords[offset + 0] * length; + out_coords[offset + 1] += ref_coords[offset + 1] * length; + out_coords[offset + 2] += ref_coords[offset + 2] * length; } - if (elem->pyramid.type == T8_DPYRAMID_FIRST_TYPE) { - for (coord = 0; coord < num_coords; ++coord) { - const size_t offset = coord * 3; - out_coords[offset + 0] += ref_coords[offset + 0] * length; - out_coords[offset + 1] += ref_coords[offset + 1] * length; - out_coords[offset + 2] += ref_coords[offset + 2] * length; - } - } - else { + if (elem->pyramid.type == T8_DPYRAMID_SECOND_TYPE) { for (coord = 0; coord < num_coords; ++coord) { const size_t offset = coord * 3; - out_coords[offset + 0] += (ref_coords[offset + 0] - ref_coords[offset + 2]) * length; - out_coords[offset + 1] += (ref_coords[offset + 1] - ref_coords[offset + 2]) * length; - out_coords[offset + 2] += (1 - ref_coords[offset + 2]) * length; + out_coords[offset + 0] -= ref_coords[offset + 2] * length; + out_coords[offset + 1] -= ref_coords[offset + 2] * length; + out_coords[offset + 2] += (1 - 2 * ref_coords[offset + 2]) * length; } } for (coord = 0; coord < num_coords; ++coord) {