diff --git a/NEWS.md b/NEWS.md index 4838e5befc..bc63be274f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,7 +3,7 @@ We have just merged another branch into our main branch that introduces a lot of changes. Here, we want to explain what is new, why we decided on this feature, what we intend with the feature in the (near) future and most importantly what do you as a user have to [change](#what-do-you-have-to-change) to be on par with the upcoming t8code v4.0.0 ## What is new? -Long story short: We completely changed the element-schemes, the part of t8code that decides how any element in a forest behaves. Before this update was introduced we used a virtual base class defining all functions. For each type of tree shape there was a class inheriting from the base class and implementing all these functions for a specific type of tree shape (vertex, line, triangle, tetrahedra, ...). +Long story short: We completely changed the element-schemes, the part of t8code that decides how any element in a forest behaves. Before this update was introduced we used a virtual base class defining all functions. For each type of tree there was a class inheriting from the base class and implementing all these functions for a specific type of tree (vertex, line, triangle, tetrahedra, ...). We provided you with a default implementation for all standard shapes supported by t8code by bundling them all together in the default scheme. If you wanted to use an element function you needed the scheme and the eclass of the tree the element belongs to to call the proper function. diff --git a/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx b/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx index 5d0b93fa67..84739c46c1 100644 --- a/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx +++ b/src/t8_schemes/t8_default/t8_default_common/t8_default_common.hxx @@ -46,13 +46,11 @@ inline static void t8_default_mempool_alloc (sc_mempool_t *ts_context, int length, t8_element_t **elem) { - int i; - T8_ASSERT (ts_context != NULL); T8_ASSERT (0 <= length); T8_ASSERT (elem != NULL); - for (i = 0; i < length; ++i) { + for (int i = 0; i < length; ++i) { elem[i] = (t8_element_t *) sc_mempool_alloc (ts_context); } } diff --git a/src/t8_schemes/t8_scheme.h b/src/t8_schemes/t8_scheme.h index c9221d6dab..daea41808f 100644 --- a/src/t8_schemes/t8_scheme.h +++ b/src/t8_schemes/t8_scheme.h @@ -367,7 +367,7 @@ t8_element_get_face_shape (const t8_scheme_c *scheme, const t8_eclass_t tree_cla */ void t8_element_get_children_at_face (const t8_scheme_c *scheme, const t8_eclass_t tree_class, const t8_element_t *elem, - const int face, t8_element_t *children[], int num_children, int *child_indices); + const int face, t8_element_t *children[], const int num_children, int *child_indices); /** Given a face of an element and a child number of a child of that face, return the face number * of the child of the element that matches the child face. diff --git a/src/t8_schemes/t8_scheme.hxx b/src/t8_schemes/t8_scheme.hxx index d5de9de74c..2b9fe901e0 100644 --- a/src/t8_schemes/t8_scheme.hxx +++ b/src/t8_schemes/t8_scheme.hxx @@ -41,6 +41,24 @@ #include #include #include +#include +#if T8_ENABLE_DEBUG +// Only needed for t8_debug_print_type +#include + +/** + * Get the type of the template parameter as a string. + * \tparam TType The template parameter to get the type of. + * \return std::string& The type of the template parameter as a string. + */ +template +inline std::string & +t8_debug_print_type () +{ + static std::string type_name = typeid (TType).name (); + return type_name; +} +#endif // T8_ENABLE_DEBUG /** This class holds one or more element schemes. * It also relays the function calls to the specific schemes. */ diff --git a/src/t8_schemes/t8_scheme_builder.hxx b/src/t8_schemes/t8_scheme_builder.hxx index 3f11cdd01f..01b8b19fe4 100644 --- a/src/t8_schemes/t8_scheme_builder.hxx +++ b/src/t8_schemes/t8_scheme_builder.hxx @@ -30,11 +30,6 @@ #include -#if T8_ENABLE_DEBUG -// Only needed for a debug print -#include -#endif // T8_ENABLE_DEBUG - /** The scheme builder adds eclass schemes to a scheme container and returns it. * TODO: Make return value a reference. */ @@ -56,8 +51,7 @@ class t8_scheme_builder { add_eclass_scheme (_Args &&...args) { #if T8_ENABLE_DEBUG - // This way the typeinfo header is only included when needed - t8_debugf ("Registering scheme of type %s with position %li.\n", typeid (TEclassScheme).name (), + t8_debugf ("Registering scheme of type %s with position %li.\n", t8_debug_print_type ().c_str (), scheme->eclass_schemes.size ()); #endif // T8_ENABLE_DEBUG scheme->eclass_schemes.emplace_back (std::in_place_type, std::forward<_Args> (args)...);