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

Conversation

sandro-elsweijer
Copy link
Collaborator

@sandro-elsweijer sandro-elsweijer commented Aug 16, 2024

Describe your changes here:
This PR introduces a padding to the reference coords. This way the element ref coords becomes consistend with the geometries and the element_from_ref_coord_function.
This is the result of the element ref coord discussion.

All these boxes must be checked by the reviewers before merging the pull request:

As a reviewer please read through all the code lines and make sure that the code is fully understood, bug free, well-documented and well-structured.

General

  • The reviewer executed the new code features at least once and checked the results manually

  • The code follows the t8code coding guidelines

  • New source/header files are properly added to the Makefiles

  • The code is well documented

  • All function declarations, structs/classes and their members have a proper doxygen documentation

  • All new algorithms and data structures are sufficiently optimal in terms of memory and runtime (If this should be merged, but there is still potential for optimization, create a new issue)

Tests

  • The code is covered in an existing or new test case using Google Test

Github action

  • The code compiles without warning in debugging and release mode, with and without MPI (this should be executed automatically in a github action)

  • All tests pass (in various configurations, this should be executed automatically in a github action)

    If the Pull request introduces code that is not covered by the github action (for example coupling with a new library):

    • Should this use case be added to the github action?
    • If not, does the specific use case compile and all tests pass (check manually)

Scripts and Wiki

  • If a new directory with source-files is added, it must be covered by the script/find_all_source_files.scp to check the indentation of these files.
  • If this PR introduces a new feature, it must be covered in an example/tutorial and a Wiki article.

Licence

  • The author added a BSD statement to doc/ (or already has one)

@sandro-elsweijer sandro-elsweijer added enhancement Enhances already existing code priority: medium Should be solved within half a year workload: low Would take half a day or less labels Aug 16, 2024
Copy link
Collaborator

@holke holke left a comment

Choose a reason for hiding this comment

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

Not a thorough review but skimmed over it. Looks great on the first glance.

Changed the comment describing padding thoughout, since "amount of padding" could be understood as "number of bytes" instead we mean "number of entries" (i.e. doubles).

src/t8_element.hxx Outdated Show resolved Hide resolved
src/t8_forest/t8_forest_geometrical.h Outdated Show resolved Hide resolved
src/t8_schemes/t8_default/t8_default_hex/t8_dhex_bits.h Outdated Show resolved Hide resolved
src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h Outdated Show resolved Hide resolved
test/t8_schemes/t8_gtest_element_ref_coords.cxx Outdated Show resolved Hide resolved
test/t8_schemes/t8_gtest_element_ref_coords.cxx Outdated Show resolved Hide resolved
test/t8_schemes/t8_gtest_element_ref_coords.cxx Outdated Show resolved Hide resolved
@Davknapp Davknapp self-assigned this Aug 19, 2024
Copy link
Collaborator

@Davknapp Davknapp left a comment

Choose a reason for hiding this comment

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

Looks good in general, just found an argument that should be const and some iterator-variables with meaningless names.

t8_forest_element_coordinate (t8_forest_t forest, t8_locidx_t ltree_id, const t8_element_t *element, int corner_number,
double *coordinates);
t8_forest_element_coordinate_from_corner_number (t8_forest_t forest, t8_locidx_t ltree_id, const t8_element_t *element,
int corner_number, double *coordinates);
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
int corner_number, double *coordinates);
const int corner_number, double * const coordinates);

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you change the documentation of *coordinates to "\param [in, out]" to make clear that no memory is allocated?

@@ -52,8 +52,8 @@ t8_forest_get_dimension (const t8_forest_t forest);
* the x, y and z coordinates of the vertex.
*/
void
t8_forest_element_coordinate (t8_forest_t forest, t8_locidx_t ltree_id, const t8_element_t *element, int corner_number,
double *coordinates);
t8_forest_element_coordinate_from_corner_number (t8_forest_t forest, t8_locidx_t ltree_id, const t8_element_t *element,
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 (t8_forest_t forest, t8_locidx_t ltree_id, const t8_element_t *element,
t8_forest_element_coordinate_from_corner_number (const t8_forest_t forest, const t8_locidx_t ltree_id, const t8_element_t *element,

void
t8_forest_element_from_ref_coords (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element,
const double *ref_coords, const size_t num_coords, double *coords_out);
t8_forest_element_coordinate_from_ref_coords (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element,
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_ref_coords (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element,
t8_forest_element_coordinate_from_ref_coords (const t8_forest_t forest, const t8_locidx_t ltreeid, const t8_element_t *element,

const double *ref_coords, const size_t num_coords, double *coords_out);
t8_forest_element_coordinate_from_ref_coords (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element,
const double *ref_coords, const size_t num_coords, const size_t padding,
double *coords_out);
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
double *coords_out);
double * const coords_out);

t8_forest_element_from_ref_coords_ext (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element,
const double *ref_coords, const size_t num_coords, double *coords_out,
const double *stretch_factors);
t8_forest_element_coordinate_from_ref_coords_ext (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element,
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_ref_coords_ext (t8_forest_t forest, t8_locidx_t ltreeid, const t8_element_t *element,
t8_forest_element_coordinate_from_ref_coords_ext (const t8_forest_t forest, const t8_locidx_t ltreeid, const t8_element_t *element,

* \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;

@@ -176,12 +176,13 @@ 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,
double *out_coords)
const size_t padding, double *out_coords)
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 size_t padding, double * const out_coords)

* \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 size_t num_coords,
double *out_coords);
const size_t padding, double *out_coords);
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 size_t padding, double * const out_coords);

@@ -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]);

* \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

@Davknapp Davknapp assigned sandro-elsweijer and unassigned Davknapp Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances already existing code priority: medium Should be solved within half a year workload: low Would take half a day or less
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants