From e96805874f86326415c051ed89fb6812be5ed74f Mon Sep 17 00:00:00 2001 From: Lena Ploetzke Date: Thu, 5 Mar 2026 09:34:33 +0100 Subject: [PATCH 1/5] ideas with union --- mesh_handle/competence_pack.hxx | 13 ++ .../internal/competence_pack_union.hxx | 144 ++++++++++++++++++ .../mesh_handle/t8_gtest_cache_competence.cxx | 3 +- 3 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 mesh_handle/internal/competence_pack_union.hxx diff --git a/mesh_handle/competence_pack.hxx b/mesh_handle/competence_pack.hxx index f93c7219a1..82fa50212c 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,16 @@ using all_cache_competences using cache_face_competences = competence_pack; +/** + * \brief Convenience alias for \ref combine_competence_packs. + * + * Provides direct access to the resulting competence pack type. + * + * \tparam P1 First competence pack. + * \tparam P2 Second competence pack. + */ +template +using union_competence_packs = + typename combine_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..9de4802f12 --- /dev/null +++ b/mesh_handle/internal/competence_pack_union.hxx @@ -0,0 +1,144 @@ +/* + 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) 2025 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 union operator for two competence packs. The result of the union of two competence packs is a competence pack + * that contains all competences of both packs, but each competence at most once. + */ + + #pragma once + #include + + namespace t8_mesh_handle +{ +/** Forward definition of the competence_pack class. + */ +template