diff --git a/mesh_handle/competence_pack.hxx b/mesh_handle/competence_pack.hxx index f93c7219a1..d7406b5112 100644 --- a/mesh_handle/competence_pack.hxx +++ b/mesh_handle/competence_pack.hxx @@ -27,6 +27,7 @@ #pragma once #include "competences.hxx" +#include "internal/competence_pack_union.hxx" namespace t8_mesh_handle { /** Class to pack different competences into one template parameter for the \ref mesh class. @@ -53,4 +54,13 @@ using all_cache_competences using cache_face_competences = competence_pack; +/** Compute the unique union of the competences of several \ref t8_mesh_handle::competence_pack 's. + * This produces a new \ref t8_mesh_handle::competence_pack containing all competences of the competence packs + * with duplicates removed. + * \tparam TPacks The competence pack for which we should compute the unique union of the competences. + * Each competence pack is expected to be of type \ref t8_mesh_handle::competence_pack. + */ +template +using union_competence_packs_type = typename detail::union_competence_packs::type; + } // namespace t8_mesh_handle diff --git a/mesh_handle/internal/competence_pack_union.hxx b/mesh_handle/internal/competence_pack_union.hxx new file mode 100644 index 0000000000..ab86c5c618 --- /dev/null +++ b/mesh_handle/internal/competence_pack_union.hxx @@ -0,0 +1,157 @@ +/* + This file is part of t8code. + t8code is a C library to manage a collection (a forest) of multiple + connected adaptive space-trees of general element classes in parallel. + + Copyright (C) 2026 the developers + + t8code is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + t8code is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with t8code; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +/** \file competence_pack_union.hxx + * Define the implementation of the unique union of competences of several \ref t8_mesh_handle::competence_pack 's. + * Users should use \ref t8_mesh_handle::union_competence_packs_type in \ref competence_pack.hxx. + */ + +#pragma once + +#include + +namespace t8_mesh_handle +{ + +/** Forward declaration of the competence pack class. + * \tparam TCompetence The competences to be packed. + */ +template