SpECTRE Documentation Coverage Report
Current view: top level - DataStructures/DataBox - Prefixes.hpp Hit Total Coverage
Commit: c3e43f8d41800b0ecefb9d1393f1de1d5a280c8f Lines: 16 34 47.1 %
Date: 2026-07-24 22:09:25
Legend: Lines: hit not hit

          Line data    Source code
       1           1 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : /// \file
       5             : /// Define prefixes for DataBox tags
       6             : 
       7             : #pragma once
       8             : 
       9             : #include <cstddef>
      10             : #include <type_traits>
      11             : 
      12             : #include "DataStructures/DataBox/Tag.hpp"
      13             : #include "DataStructures/Tensor/IndexType.hpp"
      14             : #include "DataStructures/Tensor/Metafunctions.hpp"
      15             : #include "DataStructures/Tensor/Tensor.hpp"
      16             : #include "Utilities/TypeTraits/IsA.hpp"
      17             : 
      18             : /// \cond
      19             : template <class>
      20             : class Variables;
      21             : /// \endcond
      22             : 
      23             : namespace Tags {
      24             : /// \ingroup DataBoxTagsGroup
      25             : /// \brief Prefix indicating a time derivative
      26             : ///
      27             : /// \snippet Test_DataBoxPrefixes.cpp dt_name
      28             : template <typename Tag>
      29           1 : struct dt : db::PrefixTag, db::SimpleTag {
      30           0 :   using type = typename Tag::type;
      31           0 :   using tag = Tag;
      32             : };
      33             : 
      34             : /*!
      35             :  * \ingroup DataBoxTagsGroup
      36             :  * \brief Prefix indicating spatial derivatives
      37             :  *
      38             :  * Prefix indicating the spatial derivatives of a Tensor.
      39             :  *
      40             :  * \tparam Tag The tag to wrap
      41             :  * \tparam Dim The volume dim as a type (e.g. `tmpl::size_t<Dim>`)
      42             :  * \tparam Frame The frame of the derivative index
      43             :  *
      44             :  * \see Tags::DerivCompute
      45             :  */
      46             : template <typename Tag, typename Dim, typename Frame>
      47           1 : struct deriv;
      48             : 
      49             : /// \cond
      50             : template <typename Tag, typename Dim, typename Frame>
      51             :   requires(tt::is_a_v<Tensor, typename Tag::type>)
      52             : struct deriv<Tag, Dim, Frame> : db::PrefixTag, db::SimpleTag {
      53             :   using type =
      54             :       TensorMetafunctions::prepend_spatial_index<typename Tag::type, Dim::value,
      55             :                                                  UpLo::Lo, Frame>;
      56             :   using tag = Tag;
      57             : };
      58             : /// \endcond
      59             : 
      60             : /*!
      61             :  * \ingroup DataBoxTagsGroup
      62             :  * \brief Prefix indicating symmetric second spatial derivatives
      63             :  *
      64             :  * Prefix indicating the symmetric second spatial derivatives of a Tensor.
      65             :  *
      66             :  * \tparam Tag The tag to wrap
      67             :  * \tparam Dim The volume dim as a type (e.g. `tmpl::size_t<Dim>`)
      68             :  * \tparam Frame The frame of the derivative index
      69             :  *
      70             :  * \see Tags::DerivCompute
      71             :  */
      72             : template <typename Tag, typename Dim, typename Frame>
      73           1 : struct second_deriv;
      74             : 
      75             : /// \cond
      76             : template <typename Tag, typename Dim, typename Frame>
      77             :   requires(tt::is_a_v<Tensor, typename Tag::type>)
      78             : struct second_deriv<Tag, Dim, Frame> : db::PrefixTag, db::SimpleTag {
      79             :   using type = TensorMetafunctions::prepend_two_symmetric_spatial_indices<
      80             :       typename Tag::type, Dim::value, UpLo::Lo, Frame>;
      81             :   using tag = Tag;
      82             : };
      83             : /// \endcond
      84             : 
      85             : /*!
      86             :  * \ingroup DataBoxTagsGroup
      87             :  * \brief Prefix indicating spacetime derivatives
      88             :  *
      89             :  * Prefix indicating the spacetime derivatives of a Tensor or that a Variables
      90             :  * contains spatial derivatives of Tensors.
      91             :  *
      92             :  * \tparam Tag The tag to wrap
      93             :  * \tparam Dim The volume dim as a type (e.g. `tmpl::size_t<Dim>`)
      94             :  * \tparam Frame The frame of the derivative index
      95             :  */
      96             : template <typename Tag, typename Dim, typename Frame>
      97           1 : struct spacetime_deriv;
      98             : 
      99             : /// \cond
     100             : template <typename Tag, typename Dim, typename Frame>
     101             :   requires(tt::is_a_v<Tensor, typename Tag::type>)
     102             : struct spacetime_deriv<Tag, Dim, Frame> : db::PrefixTag, db::SimpleTag {
     103             :   using type =
     104             :       TensorMetafunctions::prepend_spacetime_index<typename Tag::type,
     105             :                                                    Dim::value, UpLo::Lo, Frame>;
     106             :   using tag = Tag;
     107             : };
     108             : /// \endcond
     109             : 
     110             : /*!
     111             :  * \ingroup DataBoxTagsGroup
     112             :  * \brief Prefix indicating the spatial covariant derivative of a tensor.
     113             :  *
     114             :  * Prefix indicating the first covariant derivative of a tensor with respect
     115             :  * to the spatial metric.
     116             :  *
     117             :  * \tparam Tag The tag to wrap
     118             :  * \tparam Dim The volume dim as a type (e.g. `tmpl::size_t<Dim>`)
     119             :  * \tparam Frame The frame of the derivative index
     120             :  *
     121             :  * \snippet Test_DataBoxPrefixes.cpp covariant_deriv_name
     122             :  */
     123             : template <typename Tag, typename Dim, typename Frame>
     124           1 : struct covariant_deriv;
     125             : 
     126             : /// \cond
     127             : template <typename Tag, typename Dim, typename Frame>
     128             :   requires(tt::is_a_v<Tensor, typename Tag::type>)
     129             : struct covariant_deriv<Tag, Dim, Frame> : db::PrefixTag, db::SimpleTag {
     130             :   using type =
     131             :       TensorMetafunctions::prepend_spatial_index<typename Tag::type, Dim::value,
     132             :                                                  UpLo::Lo, Frame>;
     133             :   using tag = Tag;
     134             : };
     135             : /// \endcond
     136             : 
     137             : /*!
     138             :  * \ingroup DataBoxTagsGroup
     139             :  * \brief Prefix indicating the second spatial covariant derivative of a tensor.
     140             :  *
     141             :  * Prefix indicating the second covariant derivative of a tensor with respect
     142             :  * to the spatial metric.
     143             :  *
     144             :  * \tparam Tag The tag to wrap
     145             :  * \tparam Dim The volume dim as a type (e.g. `tmpl::size_t<Dim>`)
     146             :  * \tparam Frame The frame of the derivative index
     147             :  *
     148             :  * \note If ``Tag::type`` is ``Scalar``, then ``second_covariant_derivative``
     149             :  * will hold a symmetric tensor.
     150             :  *
     151             :  * \snippet Test_DataBoxPrefixes.cpp second_covariant_deriv_name
     152             :  */
     153             : template <typename Tag, typename Dim, typename Frame>
     154           1 : struct second_covariant_deriv;
     155             : 
     156             : /// \cond
     157             : template <typename Tag, typename Dim, typename Frame>
     158             :   requires(tt::is_a_v<Tensor, typename Tag::type> and
     159             :            not std::is_same_v<Scalar<typename Tag::type::type>,
     160             :                               typename Tag::type>)
     161             : struct second_covariant_deriv<Tag, Dim, Frame> : db::PrefixTag, db::SimpleTag {
     162             :   using type = TensorMetafunctions::prepend_spatial_index<
     163             :       TensorMetafunctions::prepend_spatial_index<typename Tag::type, Dim::value,
     164             :                                                  UpLo::Lo, Frame>,
     165             :       Dim::value, UpLo::Lo, Frame>;
     166             :   using tag = Tag;
     167             : };
     168             : /// \endcond
     169             : 
     170             : /// \cond
     171             : template <typename Tag, typename Dim, typename Frame>
     172             :   requires(std::is_same_v<Scalar<typename Tag::type::type>, typename Tag::type>)
     173             : struct second_covariant_deriv<Tag, Dim, Frame> : db::PrefixTag, db::SimpleTag {
     174             :   using type = TensorMetafunctions::prepend_two_symmetric_spatial_indices<
     175             :       typename Tag::type, Dim::value, UpLo::Lo, Frame>;
     176             :   using tag = Tag;
     177             : };
     178             : /// \endcond
     179             : 
     180             : /*!
     181             :  * \ingroup DataBoxTagsGroup
     182             :  * \brief Prefix indicating the Lie derivative with respect to the unit vector
     183             :  * normal to the spatial hypersurfaces.
     184             :  *
     185             :  * \snippet Test_DataBoxPrefixes.cpp lie_normal_name
     186             :  */
     187             : template <typename Tag>
     188           1 : struct lie_normal : db::PrefixTag, db::SimpleTag {
     189           0 :   using type = typename Tag::type;
     190           0 :   using tag = Tag;
     191             : };
     192             : 
     193             : /// \ingroup DataBoxTagsGroup
     194             : /// \brief Prefix indicating a flux
     195             : ///
     196             : /// \snippet Test_DataBoxPrefixes.cpp flux_name
     197             : template <typename Tag, typename VolumeDim, typename Fr>
     198           1 : struct Flux;
     199             : 
     200             : /// \cond
     201             : template <typename Tag, typename VolumeDim, typename Fr>
     202             :   requires(tt::is_a_v<Tensor, typename Tag::type>)
     203             : struct Flux<Tag, VolumeDim, Fr> : db::PrefixTag, db::SimpleTag {
     204             :   using type = TensorMetafunctions::prepend_spatial_index<
     205             :       typename Tag::type, VolumeDim::value, UpLo::Up, Fr>;
     206             :   using tag = Tag;
     207             : };
     208             : 
     209             : template <typename Tag, typename VolumeDim, typename Fr>
     210             :   requires(tt::is_a_v<::Variables, typename Tag::type>)
     211             : struct Flux<Tag, VolumeDim, Fr> : db::PrefixTag, db::SimpleTag {
     212             :   using type = typename Tag::type;
     213             :   using tag = Tag;
     214             : };
     215             : /// \endcond
     216             : 
     217             : /// \ingroup DataBoxTagsGroup
     218             : /// \brief Prefix indicating a source term
     219             : ///
     220             : /// \snippet Test_DataBoxPrefixes.cpp source_name
     221             : template <typename Tag>
     222           1 : struct Source : db::PrefixTag, db::SimpleTag {
     223           0 :   using type = typename Tag::type;
     224           0 :   using tag = Tag;
     225             : };
     226             : 
     227             : /// \ingroup DataBoxTagsGroup
     228             : /// \brief Prefix indicating a source term that is independent of dynamic
     229             : /// variables
     230             : template <typename Tag>
     231           1 : struct FixedSource : db::PrefixTag, db::SimpleTag {
     232           0 :   using type = typename Tag::type;
     233           0 :   using tag = Tag;
     234             : };
     235             : 
     236             : /// \ingroup DataBoxTagsGroup
     237             : /// \brief Prefix indicating the initial value of a quantity
     238             : ///
     239             : /// \snippet Test_DataBoxPrefixes.cpp initial_name
     240             : template <typename Tag>
     241           1 : struct Initial : db::PrefixTag, db::SimpleTag {
     242           0 :   using type = typename Tag::type;
     243           0 :   using tag = Tag;
     244             : };
     245             : 
     246             : /// \ingroup DataBoxTagsGroup
     247             : /// \brief Prefix indicating a boundary unit normal vector dotted into
     248             : /// the flux
     249             : ///
     250             : /// \snippet Test_DataBoxPrefixes.cpp normal_dot_flux_name
     251             : template <typename Tag>
     252           1 : struct NormalDotFlux : db::PrefixTag, db::SimpleTag {
     253           0 :   using type = typename Tag::type;
     254           0 :   using tag = Tag;
     255             : };
     256             : 
     257             : /// \ingroup DataBoxTagsGroup
     258             : /// \brief Prefix indicating a boundary unit normal vector dotted into
     259             : /// the numerical flux
     260             : ///
     261             : /// \snippet Test_DataBoxPrefixes.cpp normal_dot_numerical_flux_name
     262             : template <typename Tag>
     263           1 : struct NormalDotNumericalFlux : db::PrefixTag, db::SimpleTag {
     264           0 :   using type = typename Tag::type;
     265           0 :   using tag = Tag;
     266             : };
     267             : 
     268             : /// \ingroup DataBoxTagsGroup
     269             : /// \brief Prefix indicating the value a quantity took in the previous iteration
     270             : /// of the algorithm.
     271             : template <typename Tag>
     272           1 : struct Previous : db::PrefixTag, db::SimpleTag {
     273           0 :   using type = typename Tag::type;
     274           0 :   using tag = Tag;
     275             : };
     276             : 
     277             : /// \ingroup DataBoxTagsGroup
     278             : /// \brief Prefix indicating the value a quantity will take on the
     279             : /// next iteration of the algorithm.
     280             : ///
     281             : /// \snippet Test_DataBoxPrefixes.cpp next_name
     282             : template <typename Tag>
     283           1 : struct Next : db::PrefixTag, db::SimpleTag {
     284           0 :   using type = typename Tag::type;
     285           0 :   using tag = Tag;
     286             : };
     287             : 
     288             : }  // namespace Tags

Generated by: LCOV version 1.14