SpECTRE Documentation Coverage Report
Current view: top level - Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference - Tag.hpp Hit Total Coverage
Commit: eb45036e71ee786d31156fb02c6e736b9a032426 Lines: 4 12 33.3 %
Date: 2024-04-18 22:31:00
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 <memory>
       8             : 
       9             : #include "DataStructures/DataBox/Tag.hpp"
      10             : #include "Evolution/DgSubcell/SubcellOptions.hpp"
      11             : #include "Evolution/DgSubcell/Tags/Reconstructor.hpp"
      12             : #include "Evolution/DgSubcell/Tags/SubcellOptions.hpp"
      13             : #include "Evolution/DgSubcell/Tags/SubcellSolver.hpp"
      14             : #include "Evolution/Systems/GrMhd/ValenciaDivClean/FiniteDifference/Reconstructor.hpp"
      15             : #include "Options/String.hpp"
      16             : #include "Utilities/ErrorHandling/Error.hpp"
      17             : #include "Utilities/TMPL.hpp"
      18             : 
      19             : namespace grmhd::ValenciaDivClean::fd {
      20             : /// Option tags for reconstruction
      21           1 : namespace OptionTags {
      22             : /// \brief Option tag for the reconstructor
      23           1 : struct Reconstructor {
      24           0 :   using type = std::unique_ptr<fd::Reconstructor>;
      25             : 
      26           0 :   static constexpr Options::String help = {"The reconstruction scheme to use."};
      27           0 :   using group = evolution::dg::subcell::OptionTags::SubcellSolverGroup;
      28             : };
      29             : }  // namespace OptionTags
      30             : 
      31             : /// %Tags for reconstruction
      32           1 : namespace Tags {
      33             : /// \brief Tag for the reconstructor
      34           1 : struct Reconstructor : db::SimpleTag,
      35             :                        evolution::dg::subcell::Tags::Reconstructor {
      36           0 :   using type = std::unique_ptr<fd::Reconstructor>;
      37           0 :   using option_tags =
      38             :       tmpl::list<OptionTags::Reconstructor,
      39             :                  ::evolution::dg::subcell::OptionTags::SubcellOptions>;
      40             : 
      41           0 :   static constexpr bool pass_metavariables = false;
      42           0 :   static type create_from_options(
      43             :       const type& reconstructor,
      44             :       const ::evolution::dg::subcell::SubcellOptions& subcell_options) {
      45             :     if (static_cast<int>(subcell_options.finite_difference_derivative_order()) <
      46             :             0 and
      47             :         not reconstructor->supports_adaptive_order()) {
      48             :       ERROR_NO_TRACE(
      49             :           "Cannot use adaptive finite difference derivative order with "
      50             :           "specified reconstructor.");
      51             :     }
      52             :     if ((static_cast<int>(
      53             :              subcell_options.finite_difference_derivative_order()) /
      54             :              2 -
      55             :          1) > static_cast<int>(reconstructor->ghost_zone_size())) {
      56             :       ERROR_NO_TRACE(
      57             :           "The derivative order chosen ("
      58             :           << subcell_options.finite_difference_derivative_order()
      59             :           << ") requires more ghost zones ("
      60             :           << (static_cast<int>(
      61             :                   subcell_options.finite_difference_derivative_order()) /
      62             :                   2 -
      63             :               1)
      64             :           << ") than the reconstructor sends, "
      65             :           << reconstructor->ghost_zone_size());
      66             :     }
      67             :     return reconstructor->get_clone();
      68             :   }
      69             : };
      70             : }  // namespace Tags
      71             : }  // namespace NewtonianEuler::fd

Generated by: LCOV version 1.14