SpECTRE Documentation Coverage Report
Current view: top level - Parallel - CreateFromOptions.hpp Hit Total Coverage
Commit: aabde07399ba7837e5db64eedfd0a21f31f96922 Lines: 1 2 50.0 %
Date: 2024-04-26 02:38:13
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 "Utilities/TMPL.hpp"
       7             : #include "Utilities/TaggedTuple.hpp"
       8             : #include "Utilities/TypeTraits.hpp"
       9             : 
      10             : namespace Parallel {
      11             : namespace detail {
      12             : template <typename Metavariables, typename Tag, typename... OptionTags,
      13             :           Requires<Tag::pass_metavariables> = nullptr>
      14             : typename Tag::type create_initialization_item_from_options(
      15             :     const tuples::TaggedTuple<OptionTags...>& options) {
      16             :   return tuples::apply<typename Tag::template option_tags<Metavariables>>(
      17             :       [](const auto&... option) {
      18             :         return Tag::template create_from_options<Metavariables>(option...);
      19             :       },
      20             :       options);
      21             : }
      22             : 
      23             : template <typename Metavariables, typename Tag, typename... OptionTags,
      24             :           Requires<not Tag::pass_metavariables> = nullptr>
      25             : typename Tag::type create_initialization_item_from_options(
      26             :     const tuples::TaggedTuple<OptionTags...>& options) {
      27             :   return tuples::apply<typename Tag::option_tags>(
      28             :       [](const auto&... option) { return Tag::create_from_options(option...); },
      29             :       options);
      30             : }
      31             : }  // namespace detail
      32             : 
      33             : /// \ingroup ParallelGroup
      34             : /// \brief Given a list of tags and a tagged tuple containing items
      35             : /// created from input options, return a tagged tuple of items constructed
      36             : /// by calls to create_from_options for each tag in the list.
      37             : template <typename Metavariables, typename... Tags, typename... OptionTags>
      38           1 : tuples::TaggedTuple<Tags...> create_from_options(
      39             :     const tuples::TaggedTuple<OptionTags...>& options,
      40             :     tmpl::list<Tags...> /*meta*/) {
      41             :   return {detail::create_initialization_item_from_options<Metavariables, Tags>(
      42             :       options)...};
      43             : }
      44             : }  // namespace Parallel

Generated by: LCOV version 1.14