Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature-template_multilevel' int…
Browse files Browse the repository at this point in the history
…o feature-template_multilevel
  • Loading branch information
Davknapp committed Dec 9, 2024
2 parents d2df1df + 84fe48e commit ffb61d5
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/t8_schemes/t8_scheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 18 additions & 0 deletions src/t8_schemes/t8_scheme.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@
#include <t8_schemes/t8_default/t8_default_tet/t8_default_tet.hxx>
#include <t8_schemes/t8_default/t8_default_prism/t8_default_prism.hxx>
#include <t8_schemes/t8_default/t8_default_pyramid/t8_default_pyramid.hxx>
#include <string>
#if T8_ENABLE_DEBUG
// Only needed for t8_debug_print_type
#include <typeinfo>

/**
* 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 <typename TType>
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. */
Expand Down
8 changes: 1 addition & 7 deletions src/t8_schemes/t8_scheme_builder.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@

#include <t8_schemes/t8_scheme.hxx>

#if T8_ENABLE_DEBUG
// Only needed for a debug print
#include <typeinfo>
#endif // T8_ENABLE_DEBUG

/** The scheme builder adds eclass schemes to a scheme container and returns it.
* TODO: Make return value a reference.
*/
Expand All @@ -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<TEclassScheme> ().c_str (),
scheme->eclass_schemes.size ());
#endif // T8_ENABLE_DEBUG
scheme->eclass_schemes.emplace_back (std::in_place_type<TEclassScheme>, std::forward<_Args> (args)...);
Expand Down

0 comments on commit ffb61d5

Please sign in to comment.