InitializeAnalyticSolution.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 #include <utility>
9 
15 #include "Domain/Tags.hpp"
17 #include "ParallelAlgorithms/Initialization/MergeIntoDataBox.hpp"
18 #include "Utilities/TMPL.hpp"
20 
21 /// \cond
22 namespace Frame {
23 struct Inertial;
24 } // namespace Frame
25 /// \endcond
26 
27 namespace elliptic {
28 namespace Actions {
29 
30 /*!
31  * \brief Place the analytic solution of the system fields in the DataBox.
32  *
33  * Uses:
34  * - DataBox:
35  * - `AnalyticSolutionTag`
36  * - `Tags::Coordinates<Dim, Frame::Inertial>`
37  *
38  * DataBox:
39  * - Adds:
40  * - `db::wrap_tags_in<::Tags::Analytic, AnalyticSolutionFields>`
41  */
42 template <typename AnalyticSolutionTag, typename AnalyticSolutionFields>
44  using const_global_cache_tags = tmpl::list<AnalyticSolutionTag>;
45 
46  template <typename DbTagsList, typename... InboxTags, typename Metavariables,
47  size_t Dim, typename ActionList, typename ParallelComponent>
48  static auto apply(db::DataBox<DbTagsList>& box,
49  const tuples::TaggedTuple<InboxTags...>& /*inboxes*/,
51  const ElementIndex<Dim>& /*array_index*/,
52  const ActionList /*meta*/,
53  const ParallelComponent* const /*meta*/) noexcept {
54  using analytic_fields_tag =
57 
58  const auto& inertial_coords =
59  get<::Tags::Coordinates<Dim, Frame::Inertial>>(box);
60  db::item_type<analytic_fields_tag> analytic_fields{
61  variables_from_tagged_tuple(get<AnalyticSolutionTag>(cache).variables(
62  inertial_coords, AnalyticSolutionFields{}))};
63 
64  return std::make_tuple(
67  std::move(box), std::move(analytic_fields)));
68  }
69 };
70 
71 } // namespace Actions
72 } // namespace elliptic
Prefix< DataBox_detail::dispatch_add_tag_prefix_impl< Prefix, Tag, Args... >, Args... > add_tag_prefix
Wrap Tag in Prefix<_, Args...>, also wrapping variables tags if Tag is a Tags::Variables.
Definition: DataBoxTag.hpp:616
Definition: Variables.hpp:46
Defines class tuples::TaggedTuple.
Prefix indicating the analytic solution value for a quantity.
Definition: Prefixes.hpp:43
Definition: InitializeAnalyticSolution.hpp:27
Define prefixes for DataBox tags.
auto merge_into_databox(db::DataBox< DbTagsList > &&box, Args &&... args) noexcept
Add tags that are not yet in the DataBox.
Definition: MergeIntoDataBox.hpp:132
Place the analytic solution of the system fields in the DataBox.
Definition: InitializeAnalyticSolution.hpp:43
An associative container that is indexed by structs.
Definition: TaggedTuple.hpp:273
Defines classes and functions used for manipulating DataBox&#39;s.
tmpl::flatten< tmpl::list< Tags... > > AddSimpleTags
List of Tags to add to the DataBox.
Definition: DataBox.hpp:1222
Indicates the Frame that a TensorIndexType is in.
Definition: IndexType.hpp:36
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Defines class Variables.
A Charm++ chare that caches constant data once per Charm++ node.
Definition: ConstGlobalCache.hpp:135
Defines classes for Tensor.
constexpr auto apply(F &&f, const DataBox< BoxTags > &box, Args &&... args) noexcept
Apply the invokable f with argument Tags TagsList from DataBox box
Definition: DataBox.hpp:1623
Wraps the template metaprogramming library used (brigand)
typename DataBox_detail::item_type_impl< TagList, Tag >::type item_type
Get the type that can be written to the Tag. If it is a base tag then a TagList must be passed as a s...
Definition: DataBoxTag.hpp:461
Defines tags related to domain quantities.
A class for indexing a Charm array by Element.
Definition: ElementIndex.hpp:53
Defines classes SimpleTag, PrefixTag, ComputeTag and several functions for retrieving tag info...
Defines class template ConstGlobalCache.
Variables< tmpl::list< Tags... > > variables_from_tagged_tuple(const tuples::TaggedTuple< Tags... > &tuple) noexcept
Construct a variables from the Tensors in a TaggedTuple.
Definition: Variables.hpp:831
Definition: ComputeTimeDerivative.hpp:28