SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/ForceFree - MaskNeutronStarInterior.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 20.0 % 5 1
Test Date: 2026-10-22 17:29:42
Legend: Lines:     hit not hit

            Line data    Source code
       1            0 : // Distributed under the MIT License.
       2              : // See LICENSE.txt for details.
       3              : 
       4              : #pragma once
       5              : 
       6              : #include <cstddef>
       7              : #include <optional>
       8              : #include <type_traits>
       9              : 
      10              : #include "DataStructures/DataBox/Protocols/Mutator.hpp"
      11              : #include "DataStructures/DataVector.hpp"
      12              : #include "DataStructures/Tensor/Tensor.hpp"
      13              : #include "Domain/Tags.hpp"
      14              : #include "Evolution/DgSubcell/Tags/Coordinates.hpp"
      15              : #include "Evolution/DgSubcell/Tags/Inactive.hpp"
      16              : #include "Evolution/Systems/ForceFree/Tags.hpp"
      17              : #include "PointwiseFunctions/InitialDataUtilities/InitialData.hpp"
      18              : #include "PointwiseFunctions/InitialDataUtilities/Tags/InitialData.hpp"
      19              : #include "Utilities/CallWithDynamicType.hpp"
      20              : #include "Utilities/Gsl.hpp"
      21              : #include "Utilities/ProtocolHelpers.hpp"
      22              : #include "Utilities/TMPL.hpp"
      23              : #include "Utilities/TypeTraits/CreateIsCallable.hpp"
      24              : 
      25              : namespace ForceFree {
      26              : namespace detail {
      27              : CREATE_IS_CALLABLE(interior_mask)
      28              : CREATE_IS_CALLABLE_V(interior_mask)
      29              : CREATE_IS_CALLABLE_R_V(interior_mask)
      30              : }  // namespace detail
      31              : 
      32              : /*!
      33              :  * \brief Assign the masking scalar variable (see Tags::NsInteriorMask) at the
      34              :  * initialization phase in NS magnetosphere simulations.
      35              :  *
      36              :  * Run the `interior_mask()` member function of the initial data if it is
      37              :  * callable.
      38              :  */
      39              : template <typename Metavariables, bool UsedForFdGrid>
      40            1 : struct MaskNeutronStarInterior : tt::ConformsTo<db::protocols::Mutator> {
      41            0 :   using argument_tags = tmpl::list<
      42              :       tmpl::conditional_t<
      43              :           UsedForFdGrid,
      44              :           evolution::dg::subcell::Tags::Coordinates<3, Frame::Inertial>,
      45              :           domain::Tags::Coordinates<3, Frame::Inertial>>,
      46              :       evolution::initial_data::Tags::InitialData>;
      47              : 
      48            0 :   using return_tags = tmpl::list<tmpl::conditional_t<
      49              :       UsedForFdGrid,
      50              :       evolution::dg::subcell::Tags::Inactive<Tags::NsInteriorMask>,
      51              :       Tags::NsInteriorMask>>;
      52              : 
      53            0 :   static void apply(
      54              :       const gsl::not_null<std::optional<Scalar<DataVector>>*>
      55              :           neutron_star_interior_mask,
      56              :       const tnsr::I<DataVector, 3, Frame::Inertial>& inertial_coords,
      57              :       const evolution::initial_data::InitialData& solution_or_data) {
      58              :     using all_data_and_solutions =
      59              :         tmpl::at<typename Metavariables::factory_creation::factory_classes,
      60              :                  evolution::initial_data::InitialData>;
      61              : 
      62              :     call_with_dynamic_type<void, all_data_and_solutions>(
      63              :         &solution_or_data, [&neutron_star_interior_mask,
      64              :                             &inertial_coords](const auto* initial_data_ptr) {
      65              :           using InitialData = std::decay_t<decltype(*initial_data_ptr)>;
      66              : 
      67              :           if constexpr (detail::is_interior_mask_callable_r_v<
      68              :                             std::optional<Scalar<DataVector>>, InitialData,
      69              :                             tnsr::I<DataVector, 3, Frame::Inertial>>) {
      70              :             (*neutron_star_interior_mask) =
      71              :                 (*initial_data_ptr).interior_mask(inertial_coords);
      72              :           }
      73              :         });
      74              :   }
      75              : };
      76              : 
      77              : }  // namespace ForceFree
        

Generated by: LCOV version 2.0-1