Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add padding option to element reference coords #1221

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/time_forest_partition.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ t8_anchor_element (t8_forest_t forest, t8_locidx_t which_tree,
t8_forest_ltreeid_to_cmesh_ltreeid
(forest, which_tree));

t8_forest_element_coordinate (forest, which_tree, element, tree_vertices,
t8_forest_element_coordinate_from_corner_number (forest, which_tree, element, tree_vertices,
0, elem_anchor_f);
#if 0
/* get the element anchor node */
Expand Down
6 changes: 3 additions & 3 deletions example/IO/cmesh/gmsh/t8_load_and_refine_square_w_hole.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ t8_midpoint (t8_forest_t forest, t8_locidx_t which_tree, t8_eclass_scheme_c *ts,
/* We approximate the midpoint of a square as the middle of
* the diagonal from vertex 0 to vertex 3 */
/* Get the coordinates of the elements 0-th vertex */
t8_forest_element_coordinate (forest, which_tree, element, 0, corner[0]);
t8_forest_element_coordinate_from_corner_number (forest, which_tree, element, 0, corner[0]);
/* Get the coordinates of the elements 3rd vertex */
t8_forest_element_coordinate (forest, which_tree, element, 3, corner[1]);
t8_forest_element_coordinate_from_corner_number (forest, which_tree, element, 3, corner[1]);

for (j = 0; j < 3; j++) {
elem_mid_point[j] += corner[0][j] / 2.;
Expand All @@ -94,7 +94,7 @@ t8_midpoint (t8_forest_t forest, t8_locidx_t which_tree, t8_eclass_scheme_c *ts,
for (i = 0; i < 3; i++) {
corner[i] = T8_ALLOC (double, 3);
/* Get the coordinates of the elements i-th vertex */
t8_forest_element_coordinate (forest, which_tree, element, i, corner[i]);
t8_forest_element_coordinate_from_corner_number (forest, which_tree, element, i, corner[i]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
t8_forest_element_coordinate_from_corner_number (forest, which_tree, element, i, corner[i]);
t8_forest_element_coordinate_from_corner_number (forest, which_tree, element, icorner, corner[icorner]);

/* At a third of the vertex coordinates to the midpoint coordinates */
for (j = 0; j < 3; j++) {
elem_mid_point[j] += corner[i][j] / 3.;
Expand Down
4 changes: 2 additions & 2 deletions example/common/t8_example_common.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ t8_common_within_levelset (t8_forest_t forest, t8_locidx_t ltreeid, t8_element_t
double coords[3];

/* Compute LS function at first corner */
t8_forest_element_coordinate (forest, ltreeid, element, 0, coords);
t8_forest_element_coordinate_from_corner_number (forest, ltreeid, element, 0, coords);
/* compute the level-set function at this corner */
value = levelset (coords, t, udata);
/* sign = 1 if value > 0, -1 if value < 0, 0 if value = 0 */
sign = value > 0 ? 1 : -(value < 0);
/* iterate over all corners */
for (icorner = 1; icorner < num_corners; icorner++) {
t8_forest_element_coordinate (forest, ltreeid, element, icorner, coords);
t8_forest_element_coordinate_from_corner_number (forest, ltreeid, element, icorner, coords);
/* compute the level-set function at this corner */
value = levelset (coords, t, udata);
if ((value > 0 && sign <= 0) || (value == 0 && sign != 0) || (value < 0 && sign >= 0)) {
Expand Down
2 changes: 1 addition & 1 deletion example/forest/t8_test_face_iterate.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ t8_test_fiterate_callback (t8_forest_t forest, t8_locidx_t ltreeid, const t8_ele

if (leaf_index >= 0) {
coords = ((t8_test_fiterate_udata_t *) user_data)->coords;
t8_forest_element_coordinate (forest, ltreeid, element, 0, coords);
t8_forest_element_coordinate_from_corner_number (forest, ltreeid, element, 0, coords);
t8_debugf ("Leaf element in tree %i at face %i, tree local index %i has corner 0 coords %lf %lf %lf\n", ltreeid,
face, (int) leaf_index, coords[0], coords[1], coords[2]);
((t8_test_fiterate_udata_t *) user_data)->count++;
Expand Down
3 changes: 2 additions & 1 deletion src/t8_cmesh/t8_cmesh_examples.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3324,7 +3324,8 @@ t8_cmesh_new_spherical_shell (t8_eclass_t eclass, t8_geometry_c *geometry,
/* Retrieve 2D element vertices. */
double elem_vertices_2d[T8_ECLASS_MAX_CORNERS * 3];
for (int ivert = 0; ivert < t8_eclass_num_vertices[eclass_2d]; ivert++) {
t8_forest_element_coordinate (forest, itree_local, element, ivert, elem_vertices_2d + ivert * 3);
t8_forest_element_coordinate_from_corner_number (forest, itree_local, element, ivert,
elem_vertices_2d + ivert * 3);
}

{
Expand Down
7 changes: 6 additions & 1 deletion src/t8_element.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -578,12 +578,17 @@ struct t8_eclass_scheme
* \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 [in] padding Only used if \a num_coords > 1.
* The number of padding entries in \a ref_coords between array elements:
* For elem dim 2 and input {x1, y1, x2, y2, ...} padding is 0.
* For elem dim 2 and input {x1, y1, z1, x2, y2, z2, ...} padding is 1.
* For elem dim 3 and input {x1, y1, z1, x2, y2, z2, ...} padding is 0.
* \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
const size_t padding, double *out_coords) const
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const size_t padding, double *out_coords) const
const size_t padding, double * const out_coords) const

= 0;

/** Count how many leaf descendants of a given uniform level an element would produce.
Expand Down
Loading