ElementInitInterpPoints.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <cstddef>
7 #include <tuple>
8 
11 #include "NumericalAlgorithms/Interpolation/PointInfoTag.hpp"
12 #include "Utilities/Requires.hpp"
13 #include "Utilities/TMPL.hpp"
14 #include "Utilities/TaggedTuple.hpp"
15 
16 /// \cond
17 namespace Parallel {
18 template <typename Metavariables>
19 class ConstGlobalCache;
20 } // namespace Parallel
21 /// \endcond
22 
23 namespace intrp {
24 namespace Actions {
25 
26 /// \ingroup ActionsGroup
27 /// \brief Adds interpolation point holders to the Element's DataBox.
28 ///
29 /// This action is for the case in which the points are time-independent.
30 ///
31 /// This action should be placed in the Initialization PDAL for DgElementArray.
32 ///
33 /// Uses: nothing
34 ///
35 /// DataBox changes:
36 /// - Adds:
37 /// - `intrp::Tags::InterpPointInfo<Metavariables>`
38 /// - Removes: nothing
39 /// - Modifies: nothing
41  template <typename DbTags, typename... InboxTags, typename ArrayIndex,
42  typename ActionList, typename Metavariables,
43  typename ParallelComponent>
44  static auto apply(db::DataBox<DbTags>& box,
45  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
47  const ArrayIndex& /*array_index*/,
48  const ActionList /*meta*/,
49  const ParallelComponent* const /*meta*/) noexcept {
50  // It appears that clang-tidy is unhappy with 'if constexpr',
51  // hence the directives below.
52  if constexpr (tmpl::list_contains_v<
53  // NOLINTNEXTLINE clang-tidy wants extra braces.
55  ERROR(
56  "Found 'intrp::Tags::InterpPointInfo<Metavariables>' in DataBox, but "
57  "it should not be there because ElementInitInterpPoints adds it.");
58  return std::forward_as_tuple(std::move(box));
59  } else { // NOLINT clang-tidy thinks 'if' and 'else' not indented the same
60  using point_info_type = tuples::tagged_tuple_from_typelist<
62  typename Metavariables::interpolation_target_tags,
63  Metavariables>>;
64  return std::make_tuple(
68  std::move(box), point_info_type{}));
69  }
70  }
71 };
72 } // namespace Actions
73 } // namespace intrp
Parallel::ConstGlobalCache
Definition: ElementReceiveInterpPoints.hpp:16
intrp::Tags::InterpPointInfo
The following tag is for the case in which interpolation bypasses the Interpolator ParallelComponent....
Definition: PointInfoTag.hpp:44
DataBoxTag.hpp
tuple
intrp::Vars::PointInfoTag
Definition: PointInfoTag.hpp:18
ERROR
#define ERROR(m)
prints an error message to the standard error stream and aborts the program.
Definition: Error.hpp:36
DataBox.hpp
cstddef
tuples::TaggedTuple
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:272
intrp::Actions::ElementInitInterpPoints
Adds interpolation point holders to the Element's DataBox.
Definition: ElementInitInterpPoints.hpp:40
db::AddSimpleTags
tmpl::flatten< tmpl::list< Tags... > > AddSimpleTags
List of Tags to add to the DataBox.
Definition: DataBox.hpp:1150
Requires.hpp
db::wrap_tags_in
tmpl::transform< TagList, tmpl::bind< Wrapper, tmpl::_1, tmpl::pin< Args >... > > wrap_tags_in
Create a new list of Tags by wrapping each tag in TagList using the Wrapper.
Definition: PrefixHelpers.hpp:30
db::create_from
constexpr auto create_from(db::DataBox< TagsList > &&box, Args &&... args) noexcept
Create a new DataBox from an existing one adding or removing items and compute items.
Definition: DataBox.hpp:1339
db::RemoveTags
tmpl::flatten< tmpl::list< Tags... > > RemoveTags
List of Tags to remove from the DataBox.
Definition: DataBox.hpp:1143
db::DataBox
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Parallel
Contains functions that forward to Charm++ parallel functions.
Definition: ElementReceiveInterpPoints.hpp:14
TMPL.hpp