Program Listing for File competence_pack.hxx

Return to documentation for file (mesh_handle/competence_pack.hxx)

/*
  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.
*/

#pragma once

#include "competences.hxx"
#include "data_handler.hxx"
#include "internal/competence_pack_union.hxx"
namespace t8_mesh_handle
{
// --- Element competence pack. ---
template <template <typename> class... TElementCompetence>
struct element_competence_pack
{
  template <typename TMeshClass, template <typename, template <typename> class...> class Target>
  using apply = Target<TMeshClass, TElementCompetence...>;

  using is_element_competence_pack = void;
};

using empty_element_competences = element_competence_pack<>;

using all_cache_element_competences
  = element_competence_pack<cache_volume, cache_diameter, cache_vertex_coordinates, cache_centroid, cache_face_areas,
                            cache_face_centroids, cache_face_normals, cache_neighbors>;

using cache_face_element_competences
  = element_competence_pack<cache_face_areas, cache_face_centroids, cache_face_normals, cache_neighbors>;

using data_element_competences = element_competence_pack<element_data_element_competence>;

// --- Mesh competence pack. ---
template <template <typename> class... TMeshCompetence>
struct mesh_competence_pack
{
  template <typename TMesh>
  struct apply: public TMeshCompetence<TMesh>...
  {
  };

  using is_mesh_competence_pack = void;
};

using empty_mesh_competences = mesh_competence_pack<>;

template <T8MPISafeType TElementDataType>
using data_mesh_competences = mesh_competence_pack<element_data_mesh_competence<TElementDataType>::template type>;

// --- Compute union of competence packs. ---
template <typename... TPacks>
using union_competence_packs_type = typename detail::union_competence_packs<TPacks...>::type;

}  // namespace t8_mesh_handle