diff --git a/src/t8_schemes/t8_default/t8_default.cxx b/src/t8_schemes/t8_default/t8_default.cxx index d477f3aee5..554c80a26c 100644 --- a/src/t8_schemes/t8_default/t8_default.cxx +++ b/src/t8_schemes/t8_default/t8_default.cxx @@ -31,14 +31,14 @@ t8_scheme_new_default (void) { t8_scheme_builder builder; - builder.add_eclass_scheme (T8_ECLASS_VERTEX); - builder.add_eclass_scheme (T8_ECLASS_LINE); - builder.add_eclass_scheme (T8_ECLASS_QUAD); - builder.add_eclass_scheme (T8_ECLASS_HEX); - builder.add_eclass_scheme (T8_ECLASS_TRIANGLE); - builder.add_eclass_scheme (T8_ECLASS_TET); - builder.add_eclass_scheme (T8_ECLASS_PRISM); - builder.add_eclass_scheme (T8_ECLASS_PYRAMID); + builder.add_eclass_scheme (); + builder.add_eclass_scheme (); + builder.add_eclass_scheme (); + builder.add_eclass_scheme (); + builder.add_eclass_scheme (); + builder.add_eclass_scheme (); + builder.add_eclass_scheme (); + builder.add_eclass_scheme (); return builder.build_scheme (); } diff --git a/src/t8_schemes/t8_scheme.hxx b/src/t8_schemes/t8_scheme.hxx index 7368e4ebe3..cd73cc5143 100644 --- a/src/t8_schemes/t8_scheme.hxx +++ b/src/t8_schemes/t8_scheme.hxx @@ -23,7 +23,7 @@ #pragma once #include -#include +#include #include #include #include @@ -72,7 +72,7 @@ class t8_scheme { >; /* clang-format on */ - using scheme_container = std::array; /**< Container type for holding eclass schemes. */ + using scheme_container = std::vector; /**< Container type for holding eclass schemes. */ private: scheme_container eclass_schemes; /**< The container holding the eclass schemes. */ diff --git a/src/t8_schemes/t8_scheme_builder.hxx b/src/t8_schemes/t8_scheme_builder.hxx index 847e504ddf..06b8dd4527 100644 --- a/src/t8_schemes/t8_scheme_builder.hxx +++ b/src/t8_schemes/t8_scheme_builder.hxx @@ -29,6 +29,11 @@ #include +#if T8_ENABLE_DEBUG +// Only needed for a debug print +#include +#endif // T8_ENABLE_DEBUG + class t8_scheme_builder { public: t8_scheme_builder (): scheme (new t8_scheme) {}; @@ -36,13 +41,28 @@ class t8_scheme_builder { using scheme_var = t8_scheme::scheme_var; + /** Add a new element class scheme to the scheme. + * \tparam [in] TEclass_Scheme The type of the element class scheme. + * \tparam [in] _Args The types of the arguments to pass to the constructor of the element class scheme. + * \param [in] args The arguments to pass to the constructor of the element class scheme. + * \return The position of the added element class scheme in the scheme. + */ template - void - add_eclass_scheme (t8_eclass_t tree_class, _Args &&...args) + size_t + add_eclass_scheme (_Args &&...args) { - scheme->eclass_schemes[tree_class] = TEclass_Scheme (std::forward<_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 (TEclass_Scheme).name (), + scheme->eclass_schemes.size ()); +#endif // T8_ENABLE_DEBUG + scheme->eclass_schemes.emplace_back (std::in_place_type, std::forward<_Args> (args)...); + return scheme->eclass_schemes.size (); } + /** Build the scheme. + * \return The built scheme. + */ t8_scheme * build_scheme () const {