Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,19 @@ class t8_default_scheme_common: public t8_crtp_operator<TUnderlyingEclassScheme,
const int dim = t8_eclass_to_dimension[eclass];
return count_leaves_from_level (0, level, dim);
}

/**
* Print a given element. For a example for a triangle print the coordinates
* and the level of the triangle. This function is only available in the
* debugging configuration.
Comment on lines +311 to +313
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
* Print a given element. For a example for a triangle print the coordinates
* and the level of the triangle. This function is only available in the
* debugging configuration.
* Print a given element. For a example for a triangle print the coordinates
* and the level of the triangle.

* \param [in] elem The element to print
*/
inline void
element_print (const t8_element_t *elem) const
{
char debug_string[BUFSIZ];
this->underlying ().element_to_string (elem, debug_string, BUFSIZ);
t8_productionf ("%s\n", debug_string);
}
#if T8_ENABLE_DEBUG
/**
* Print a given element. For a example for a triangle print the coordinates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ t8_default_scheme_hex::element_is_valid (const t8_element_t *element) const
&& T8_QUAD_GET_TDIM ((const p8est_quadrant_t *) element) == 3;
}

#endif
void
t8_default_scheme_hex::element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const
{
Expand All @@ -647,7 +648,6 @@ t8_default_scheme_hex::element_to_string (const t8_element_t *elem, char *debug_
p8est_quadrant_t *hex = (p8est_quadrant_t *) elem;
snprintf (debug_string, string_size, "x: %i, y: %i, z: %i, level: %i", hex->x, hex->y, hex->z, hex->level);
}
#endif

void
t8_default_scheme_hex::set_to_root (t8_element_t *elem) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ class t8_default_scheme_hex: public t8_default_scheme_common<t8_default_scheme_h
int
element_is_valid (const t8_element_t *element) const;

#endif
/**
* Print a given element. For a example for a triangle print the coordinates
* and the level of the triangle. This function is only available in the
Expand All @@ -585,7 +586,6 @@ class t8_default_scheme_hex: public t8_default_scheme_common<t8_default_scheme_h
*/
void
element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const;
#endif

/** Fills an element with the root element.
* \param [in,out] elem The element to be filled with root.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ t8_default_scheme_line::element_is_valid (const t8_element_t *element) const
{
return t8_dline_is_valid ((const t8_dline_t *) element);
}
#endif

void
t8_default_scheme_line::element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const
Expand All @@ -414,7 +415,6 @@ t8_default_scheme_line::element_to_string (const t8_element_t *elem, char *debug
t8_dline_t *line = (t8_dline_t *) elem;
snprintf (debug_string, string_size, "x: %i, level: %i", line->x, line->level);
}
#endif

void
t8_default_scheme_line::element_new (int length, t8_element_t **elem) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ class t8_default_scheme_line: public t8_default_scheme_common<t8_default_scheme_
int
element_is_valid (const t8_element_t *element) const;

#endif
/**
* Print a given element. For a example for a triangle print the coordinates
* and the level of the triangle. This function is only available in the
Expand All @@ -596,7 +597,6 @@ class t8_default_scheme_line: public t8_default_scheme_common<t8_default_scheme_
*/
void
element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const;
#endif
/** Fills an element with the root element.
* \param [in,out] elem The element to be filled with root.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ t8_default_scheme_prism::element_is_valid (const t8_element_t *element) const
T8_ASSERT (element != NULL);
return t8_dprism_is_valid ((const t8_dprism_t *) element);
}
#endif /* T8_ENABLE_DEBUG */

void
t8_default_scheme_prism::element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const
Expand All @@ -452,8 +453,6 @@ t8_default_scheme_prism::element_to_string (const t8_element_t *elem, char *debu
prism->line.x, prism->tri.type, prism->tri.level);
}

#endif /* T8_ENABLE_DEBUG */

void
t8_default_scheme_prism::set_to_root (t8_element_t *elem) const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ class t8_default_scheme_prism: public t8_default_scheme_common<t8_default_scheme
*/
int
element_is_valid (const t8_element_t *element) const;
#endif

/**
* Print a given element. For a example for a triangle print the coordinates
Expand All @@ -567,7 +568,6 @@ class t8_default_scheme_prism: public t8_default_scheme_common<t8_default_scheme
*/
void
element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const;
#endif

/** Fills an element with the root element.
* \param [in,out] elem The element to be filled with root.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ t8_default_scheme_pyramid::element_is_valid (const t8_element_t *element) const
return t8_dpyramid_is_valid ((const t8_dpyramid_t *) element);
}

#endif
void
t8_default_scheme_pyramid::element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const
{
Expand All @@ -443,7 +444,6 @@ t8_default_scheme_pyramid::element_to_string (const t8_element_t *elem, char *de
pyra->pyramid.x, pyra->pyramid.y, pyra->pyramid.x, pyra->pyramid.type, pyra->pyramid.level,
pyra->switch_shape_at_level);
}
#endif

void
t8_default_scheme_pyramid::set_to_root (t8_element_t *elem) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ class t8_default_scheme_pyramid: public t8_default_scheme_common<t8_default_sche
*/
int
element_is_valid (const t8_element_t *element) const;
#endif

/**
* Print a given element. For a example for a triangle print the coordinates
Expand All @@ -587,7 +588,6 @@ class t8_default_scheme_pyramid: public t8_default_scheme_common<t8_default_sche
*/
void
element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const;
#endif

/** Fills an element with the root element.
* \param [in,out] elem The element to be filled with root.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,7 @@ t8_default_scheme_quad::element_is_valid (const t8_element_t *element) const
*/
return p4est_quadrant_is_extended ((const p4est_quadrant_t *) element);
}
#endif

void
t8_default_scheme_quad::element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const
Expand All @@ -760,7 +761,6 @@ t8_default_scheme_quad::element_to_string (const t8_element_t *elem, char *debug
p4est_quadrant_t *quad = (p4est_quadrant_t *) elem;
snprintf (debug_string, string_size, "x: %i, y: %i, level: %i", quad->x, quad->y, quad->level);
}
#endif

void
t8_default_scheme_quad::set_to_root (t8_element_t *elem) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ class t8_default_scheme_quad: public t8_default_scheme_common<t8_default_scheme_
*/
int
element_is_valid (const t8_element_t *element) const;
#endif

/**
* Print a given element. For a example for a triangle print the coordinates
Expand All @@ -616,7 +617,6 @@ class t8_default_scheme_quad: public t8_default_scheme_common<t8_default_scheme_
*/
void
element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const;
#endif

/** Fills an element with the root element.
* \param [in,out] elem The element to be filled with root.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ t8_default_scheme_tet::element_is_valid (const t8_element_t *element) const
{
return t8_dtet_is_valid ((const t8_dtet_t *) element);
}
#endif

void
t8_default_scheme_tet::element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const
Expand All @@ -505,7 +506,6 @@ t8_default_scheme_tet::element_to_string (const t8_element_t *elem, char *debug_
snprintf (debug_string, string_size, "x: %i, y: %i, z: %i, type: %i, level: %i", tet->x, tet->y, tet->z, tet->type,
tet->level);
}
#endif

void
t8_default_scheme_tet::element_new (int length, t8_element_t **elem) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ class t8_default_scheme_tet: public t8_default_scheme_common<t8_default_scheme_t
*/
int
element_is_valid (const t8_element_t *element) const;
#endif

/**
* Print a given element. For a example for a triangle print the coordinates
Expand All @@ -536,7 +537,6 @@ class t8_default_scheme_tet: public t8_default_scheme_common<t8_default_scheme_t
*/
void
element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const;
#endif

/** Fills an element with the root element.
* \param [in,out] elem The element to be filled with root.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ t8_default_scheme_tri::element_is_valid (const t8_element_t *element) const
{
return t8_dtri_is_valid ((const t8_dtri_t *) element);
}
#endif

void
t8_default_scheme_tri::element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const
Expand All @@ -516,7 +517,6 @@ t8_default_scheme_tri::element_to_string (const t8_element_t *elem, char *debug_
t8_dtri_t *tri = (t8_dtri_t *) elem;
snprintf (debug_string, string_size, "x: %i, y: %i, type: %i, level: %i", tri->x, tri->y, tri->type, tri->level);
}
#endif

void
t8_default_scheme_tri::element_new (int length, t8_element_t **elem) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ class t8_default_scheme_tri: public t8_default_scheme_common<t8_default_scheme_t
*/
int
element_is_valid (const t8_element_t *element) const;
#endif

/**
* Print a given element. For a example for a triangle print the coordinates
Expand All @@ -528,7 +529,6 @@ class t8_default_scheme_tri: public t8_default_scheme_common<t8_default_scheme_t
*/
void
element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const;
#endif

/** Fills an element with the root element.
* \param [in,out] elem The element to be filled with root.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ t8_default_scheme_vertex::element_is_valid ([[maybe_unused]] const t8_element_t
const t8_dvertex_t *vertex = (t8_dvertex_t *) element;
return vertex->level <= T8_DVERTEX_MAXLEVEL;
}
#endif

void
t8_default_scheme_vertex::element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const
Expand All @@ -326,7 +327,6 @@ t8_default_scheme_vertex::element_to_string (const t8_element_t *elem, char *deb
t8_dvertex_t *vertex = (t8_dvertex_t *) elem;
snprintf (debug_string, string_size, "level: %i", vertex->level);
}
#endif

int
t8_default_scheme_vertex::refines_irregular () const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ class t8_default_scheme_vertex: public t8_default_scheme_common<t8_default_schem
*/
static int
element_is_valid (const t8_element_t *element);
#endif

/**
* Print a given element. For a example for a triangle print the coordinates
Expand All @@ -631,7 +632,6 @@ class t8_default_scheme_vertex: public t8_default_scheme_common<t8_default_schem
*/
void
element_to_string (const t8_element_t *elem, char *debug_string, const int string_size) const;
#endif

/** Fills an element with the root element.
* \param [in,out] elem The element to be filled with root.
Expand Down
8 changes: 7 additions & 1 deletion src/t8_schemes/t8_scheme.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ t8_element_debug_print (const t8_scheme_c *scheme, const t8_eclass_t tree_class,
{
return scheme->element_debug_print (tree_class, elem);
}
#endif

void
t8_element_to_string (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *elem,
Expand All @@ -378,7 +379,12 @@ t8_element_to_string (const t8_scheme_c *scheme, const t8_eclass_t tree_class, c

return scheme->element_to_string (tree_class, elem, debug_string, string_size);
}
#endif

void
t8_element_print (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *elem)
{
return scheme->element_print (tree_class, elem);
}

void
t8_element_new (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const int length, t8_element_t **elems)
Expand Down
15 changes: 14 additions & 1 deletion src/t8_schemes/t8_scheme.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,7 @@ class t8_scheme {
return std::visit ([&] (auto &&scheme) { return scheme.element_debug_print (element); },
eclass_schemes[tree_class]);
};
#endif

/**
* Fill a string with readable information about the element
Expand All @@ -999,7 +1000,19 @@ class t8_scheme {
return std::visit ([&] (auto &&scheme) { return scheme.element_to_string (element, debug_string, string_size); },
eclass_schemes[tree_class]);
};
#endif

/**
* Print a given element. For a example for a triangle print the coordinates
* and the level of the triangle. This function is only available in the
* debugging configuration.
* \param [in] tree_class The eclass of the current tree.
* \param [in] element The element to print
*/
inline void
element_print (const t8_eclass_t tree_class, const t8_element_t *element) const
{
return std::visit ([&] (auto &&scheme) { return scheme.element_print (element); }, eclass_schemes[tree_class]);
};

/** Allocate memory for \a length many elements of a given class and initialize them,
* and put pointers to the elements in the provided array.
Expand Down
17 changes: 15 additions & 2 deletions src/t8_schemes/t8_standalone/t8_standalone_implementation.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,7 @@ struct t8_standalone_scheme
t8_debugf ("t_%i: %i \n", e_num, get_typebit (el->type, e_num));
}
}

#endif
/**
* Fill a string with readable information about the element
* \param[in] elem The element to translate into human-readable information
Expand All @@ -1752,7 +1752,20 @@ struct t8_standalone_scheme
}
}

#endif
static constexpr void
element_print (const t8_element_t *elem) noexcept
{

const t8_standalone_element<TEclass> *el = (const t8_standalone_element<TEclass> *) elem;

t8_productionf ("level: %i\n", el->level);
for (int idim = 0; idim < T8_ELEMENT_DIM[TEclass]; idim++) {
t8_productionf ("x_%i: %i \n", idim, el->coords[idim]);
}
for (int e_num = 0; e_num < T8_ELEMENT_NUM_EQUATIONS[TEclass]; e_num++) {
t8_productionf ("t_%i: %i \n", e_num, get_typebit (el->type, e_num));
}
}

// ################################################____MPI____################################################

Expand Down