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

Feature puma patches [1/x] refactoring #514

Merged
merged 5 commits into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
19 changes: 10 additions & 9 deletions src/t8_schemes/t8_default/t8_default_hex/t8_default_hex_cxx.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,14 @@ t8_default_scheme_hex_c::t8_element_root_len (const t8_element_t *elem) const
}

void
t8_default_scheme_hex_c::t8_element_vertex_coords (const t8_element_t *t,
t8_default_scheme_hex_c::t8_element_vertex_coords (const t8_element_t *elem,
int vertex,
int coords[]) const
{
const p8est_quadrant_t *q1 = (const p8est_quadrant_t *) t;
const p8est_quadrant_t *q1 = (const p8est_quadrant_t *) elem;
int len;

T8_ASSERT (t8_element_is_valid (t));
T8_ASSERT (t8_element_is_valid (elem));
T8_ASSERT (0 <= vertex && vertex < 8);
/* Get the length of the quadrant */
len = P8EST_QUADRANT_LEN (q1->level);
Expand All @@ -638,22 +638,23 @@ t8_default_scheme_hex_c::t8_element_vertex_coords (const t8_element_t *t,

void
t8_default_scheme_hex_c::t8_element_vertex_reference_coords (const
t8_element_t *t,
t8_element_t
*elem,
const int vertex,
double coords[])
const
{
T8_ASSERT (t8_element_is_valid (t));
T8_ASSERT (t8_element_is_valid (elem));
T8_ASSERT (0 <= vertex && vertex < 8);

int coords_int[3];
t8_element_vertex_coords (t, vertex, coords_int);
t8_element_vertex_coords (elem, vertex, coords_int);

/* We divide the integer coordinates by the root length of the hex
* to obtain the reference coordinates. */
coords[0] = coords_int[0] / (double) P8EST_ROOT_LEN;
coords[1] = coords_int[1] / (double) P8EST_ROOT_LEN;
coords[2] = coords_int[2] / (double) P8EST_ROOT_LEN;
coords[0] /= (double) P8EST_ROOT_LEN;
coords[1] /= (double) P8EST_ROOT_LEN;
coords[2] /= (double) P8EST_ROOT_LEN;
}

int
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,24 +545,24 @@ public:
* elements are positioned in a cube [0,1]^(dL) with dimension d (=0,1,2,3) and
* L the maximum refinement level.
* All element vertices have integer coordinates in this cube.
* \param [in] t The element to be considered.
* \param [in] elem The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [out] coords An array of at least as many integers as the element's dimension
* whose entries will be filled with the coordinates of \a vertex.
*/
virtual void t8_element_vertex_coords (const t8_element_t *t,
virtual void t8_element_vertex_coords (const t8_element_t *elem,
int vertex,
int coords[]) const;

/** Compute the coordinates of a given element vertex inside a reference tree
* that is embedded into [0,1]^d (d = dimension).
* \param [in] t The element to be considered.
* \param [in] elem The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [out] coords An array of at least as many doubles as the element's dimension
* whose entries will be filled with the coordinates of \a vertex.
*/
virtual void t8_element_vertex_reference_coords (const t8_element_t
*t,
*elem,
const int vertex,
double coords[])
const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,24 +346,25 @@ t8_default_scheme_line_c::t8_element_last_descendant (const t8_element_t
}

void
t8_default_scheme_line_c::t8_element_vertex_coords (const t8_element_t *t,
t8_default_scheme_line_c::t8_element_vertex_coords (const t8_element_t *elem,
int vertex,
int coords[]) const
{
T8_ASSERT (t8_element_is_valid (t));
t8_dline_vertex_coords ((const t8_dline_t *) t, vertex, coords);
T8_ASSERT (t8_element_is_valid (elem));
t8_dline_vertex_coords ((const t8_dline_t *) elem, vertex, coords);
}

void
t8_default_scheme_line_c::t8_element_vertex_reference_coords (const
t8_element_t *t,
t8_element_t
*elem,
const int
vertex,
double coords[])
const
{
T8_ASSERT (t8_element_is_valid (t));
t8_dline_vertex_ref_coords ((const t8_dline_t *) t, vertex, coords);
T8_ASSERT (t8_element_is_valid (elem));
t8_dline_vertex_ref_coords ((const t8_dline_t *) elem, vertex, coords);
}

int
Expand Down
20 changes: 11 additions & 9 deletions src/t8_schemes/t8_default/t8_default_line/t8_default_line_cxx.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
*/

/** \file t8_default_lines.h
* The default implementation for lines.
* The default implementation for lines. Interface between the
* \file t8_default_common_cxx.hxx definitions and the element type specific
* implementations in \file t8_dline_bits.h
*/

#ifndef T8_DEFAULT_LINE_CXX_HXX
Expand Down Expand Up @@ -563,24 +565,24 @@ public:
* elements are positioned in a cube [0,1]^(dL) with dimension d (=0,1,2,3) and
* L the maximum refinement level.
* All element vertices have integer coordinates in this cube.
* \param [in] t The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [in] elem The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [out] coords An array of at least as many integers as the element's dimension
* whose entries will be filled with the coordinates of \a vertex.
* whose entries will be filled with the coordinates of \a vertex.
*/
virtual void t8_element_vertex_coords (const t8_element_t *t,
virtual void t8_element_vertex_coords (const t8_element_t *elem,
int vertex,
int coords[]) const;

/** Compute the coordinates of a given element vertex inside a reference tree
* that is embedded into [0,1]^d (d = dimension).
* \param [in] t The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [in] elem The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [out] coords An array of at least as many doubles as the element's dimension
* whose entries will be filled with the coordinates of \a vertex.
* whose entries will be filled with the coordinates of \a vertex.
*/
virtual void t8_element_vertex_reference_coords (const t8_element_t
*t,
*elem,
const int vertex,
double coords[])
const;
Expand Down
1 change: 1 addition & 0 deletions src/t8_schemes/t8_default/t8_default_line/t8_dline_bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

/** \file t8_dline_bits.h
* Definition if line-specific functions.
*/

#ifndef T8_DLINE_BITS_H
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
*/

/** \file t8_default_prism_cxx.hxx
* The default implementation for prism.
* The default implementation for prisms. Interface between the
* \file t8_default_common_cxx.hxx definitions and the element type specific
* implementations in \file t8_dprism_bits.h
*/

#ifndef T8_DEFAULT_PRISM_CXX_HXX
Expand Down Expand Up @@ -583,13 +585,13 @@ public:

/** Compute the coordinates of a given element vertex inside a reference tree
* that is embedded into [0,1]^d (d = dimension).
* \param [in] t The element to be considered.
* \param [in] elem The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [out] coords An array of at least as many doubles as the element's dimension
* whose entries will be filled with the coordinates of \a vertex.
*/
virtual void t8_element_vertex_reference_coords (const t8_element_t
*t,
*elem,
const int vertex,
double coords[])
const;
Expand Down
12 changes: 6 additions & 6 deletions src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.c
Original file line number Diff line number Diff line change
Expand Up @@ -550,29 +550,29 @@ t8_dprism_corner_descendant (const t8_dprism_t *p, t8_dprism_t *s,
}

void
t8_dprism_vertex_coords (const t8_dprism_t *p, const int vertex,
t8_dprism_vertex_coords (const t8_dprism_t *elem, const int vertex,
int coords[3])
{
T8_ASSERT (vertex >= 0 && vertex < 6);
T8_ASSERT (p->line.level == p->tri.level);
T8_ASSERT (elem->line.level == elem->tri.level);
/*Compute x and y coordinate */
t8_dtri_compute_coords (&p->tri, vertex % 3, coords);
t8_dtri_compute_coords (&elem->tri, vertex % 3, coords);
/*Compute z coordinatecoords[0] *= T8_DPRISM_ROOT_BY_DTRI_ROOT; */
t8_dline_vertex_coords (&p->line, vertex / 3, &coords[2]);
t8_dline_vertex_coords (&elem->line, vertex / 3, &coords[2]);
coords[0] /= T8_DPRISM_ROOT_BY_DTRI_ROOT;
coords[1] /= T8_DPRISM_ROOT_BY_DTRI_ROOT;
coords[2] /= T8_DPRISM_ROOT_BY_DLINE_ROOT;
}

void
t8_dprism_vertex_ref_coords (const t8_dprism_t *p, const int vertex,
t8_dprism_vertex_ref_coords (const t8_dprism_t *elem, const int vertex,
double coords[3])
{
int coords_int[3];
T8_ASSERT (vertex >= 0 && vertex < 6);

/* Compute the integere coordinates in [0, root_len]^3 */
t8_dprism_vertex_coords (p, vertex, coords_int);
t8_dprism_vertex_coords (elem, vertex, coords_int);

/* Divide by the root length. */
coords[0] = coords_int[0] / (double) T8_DPRISM_ROOT_LEN;
Expand Down
15 changes: 8 additions & 7 deletions src/t8_schemes/t8_default/t8_default_prism/t8_dprism_bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

/** \file t8_dprism_bits.h
* Definition if prism-specific functions.
*/

#ifndef T8_DPRISM_BITS_H
Expand Down Expand Up @@ -295,22 +296,22 @@ void t8_dprism_corner_descendant (const t8_dprism_t *p,
int level);

/** Compute the coordinates of a vertex of a prism.
* \param [in] p Input prism.
* \param [in] vertex The number of the vertex.
* \param [in] elem Input prism.
* \param [in] vertex The number of the vertex.
* \param [out] coordinates An array of 3 t8_dprism_coord_t that
* will be filled with the coordinates of the vertex.
*/
void t8_dprism_vertex_coords (const t8_dprism_t *p,
void t8_dprism_vertex_coords (const t8_dprism_t *elem,
int vertex, int coords[3]);

/** Compute the reference coordinates of a vertex of a prism when the
* tree (level 0 prism) is embedded in [0,1]^3.
* \param [in] p Input prism.
* \param [in] vertex The number of the vertex.
* tree (level 0) is embedded in [0,1]^3.
* \param [in] elem Input prism.
* \param [in] vertex The number of the vertex.
* \param [out] coordinates An array of 3 double that
* will be filled with the reference coordinates of the vertex.
*/
void t8_dprism_vertex_ref_coords (const t8_dprism_t *p,
void t8_dprism_vertex_ref_coords (const t8_dprism_t *elem,
int vertex,
double coords[3]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
*/

/** \file t8_default_pyramid_cxx.hxx
* The default implementation for pyramid.
* The default implementation for pyramids. Interface between the
* \file t8_default_common_cxx.hxx definitions and the element type specific
* implementations in \file t8_dpyramid_bits.h
*/

#ifndef T8_DEFAULT_PYRAMID_CXX_HXX
Expand Down Expand Up @@ -602,13 +604,13 @@ public:

/** Compute the coordinates of a given element vertex inside a reference tree
* that is embedded into [0,1]^d (d = dimension).
* \param [in] t The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [in] elem The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [out] coords An array of at least as many doubles as the element's dimension
* whose entries will be filled with the coordinates of \a vertex.
*/
virtual void t8_element_vertex_reference_coords (const t8_element_t
*t,
*elem,
const int vertex,
double coords[])
const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

/** \file t8_dpyramid_bits.h
* Definition if pyramid-specific functions.
*/

#ifndef T8_DPYRAMID_BITS_H
#define T8_DPYRAMID_BITS_H

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -752,14 +752,14 @@ t8_default_scheme_quad_c::t8_element_root_len (const t8_element_t *elem) const
}

void
t8_default_scheme_quad_c::t8_element_vertex_coords (const t8_element_t *t,
t8_default_scheme_quad_c::t8_element_vertex_coords (const t8_element_t *elem,
int vertex,
int coords[]) const
{
const p4est_quadrant_t *q1 = (const p4est_quadrant_t *) t;
const p4est_quadrant_t *q1 = (const p4est_quadrant_t *) elem;
int len;

T8_ASSERT (t8_element_is_valid (t));
T8_ASSERT (t8_element_is_valid (elem));
T8_ASSERT (0 <= vertex && vertex < 4);
/* Get the length of the quadrant */
len = P4EST_QUADRANT_LEN (q1->level);
Expand All @@ -771,22 +771,23 @@ t8_default_scheme_quad_c::t8_element_vertex_coords (const t8_element_t *t,

void
t8_default_scheme_quad_c::t8_element_vertex_reference_coords (const
t8_element_t *t,
t8_element_t
*elem,
const int
vertex,
double coords[])
const
{
T8_ASSERT (t8_element_is_valid (t));
T8_ASSERT (t8_element_is_valid (elem));
T8_ASSERT (0 <= vertex && vertex < 4);

int coords_int[2];
t8_element_vertex_coords (t, vertex, coords_int);
t8_element_vertex_coords (elem, vertex, coords_int);

/* We divide the integer coordinates by the root length of the quad
* to obtain the reference coordinates. */
coords[0] = coords_int[0] / (double) P4EST_ROOT_LEN;
coords[1] = coords_int[1] / (double) P4EST_ROOT_LEN;
coords[0] /= (double) P4EST_ROOT_LEN;
coords[1] /= (double) P4EST_ROOT_LEN;
}

void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,24 +578,24 @@ public:
* elements are positioned in a cube [0,1]^(dL) with dimension d (=0,1,2,3) and
* L the maximum refinement level.
* All element vertices have integer coordinates in this cube.
* \param [in] t The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [in] elem The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [out] coords An array of at least as many integers as the element's dimension
* whose entries will be filled with the coordinates of \a vertex.
*/
virtual void t8_element_vertex_coords (const t8_element_t *t,
virtual void t8_element_vertex_coords (const t8_element_t *elem,
int vertex,
int coords[]) const;

/** Compute the coordinates of a given element vertex inside a reference tree
* that is embedded into [0,1]^d (d = dimension).
* \param [in] t The element to be considered.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [in] elem The element.
* \param [in] vertex The id of the vertex whose coordinates shall be computed.
* \param [out] coords An array of at least as many doubles as the element's dimension
* whose entries will be filled with the coordinates of \a vertex.
*/
virtual void t8_element_vertex_reference_coords (const t8_element_t
*t,
*elem,
const int vertex,
double coords[])
const;
Expand Down
Loading