InterpolatedVars.hpp
2 // See LICENSE.txt for details.
3
4 #pragma once
5
6 #include <cstddef>
7 #include <unordered_map>
8 #include <unordered_set>
9 #include <vector>
10
11 #include "DataStructures/IdPair.hpp" // IWYU pragma: keep
13 #include "Domain/BlockId.hpp" // IWYU pragma: keep
14
15 /// \cond
16 template <size_t VolumeDim>
17 class ElementId;
18 template <typename TagsList>
19 class Variables;
20 /// \endcond
21
22 namespace intrp {
23
24 /// Data structures holding quantities that are interpolated by
25 /// Interpolator for use by InterpolationTargets
26 namespace Vars {
27 /// \brief Holds a Variables interpolated onto a list of points, and
28 /// information about those points, for a local Interpolator.
29 ///
30 /// TagList is a tmpl::list of tags that go into the Variables.
31 template <size_t VolumeDim, typename TagList>
32 struct Info {
33  /// block_coord_holders holds the list of all points (in block
34  /// logical coordinates) that need to be interpolated onto for a
35  /// given InterpolationTarget.
36  ///
37  /// The number of interpolated points for which results are stored
38  /// in this Info (in vars and global_offsets below)
39  /// corresponds to only the subset of the points in
40  /// block_coord_holders that are contained in local Elements.
41  /// Moreover, the number of interpolated points stored in this
42  /// Info will change as more Elements send data to this
43  /// Interpolator, and will be less than or equal to the size of
44  /// block_coord_holders even after all Elements have sent their
45  /// data (this is because this Info lives only on a single core,
46  /// and this core will have access only to the local Elements).
48  tnsr::I<double, VolumeDim, typename ::Frame::Logical>>>
50  /// vars holds the interpolated Variables on some subset of the
51  /// points in block_coord_holders. The grid points inside vars
52  /// are indexed according to global_offsets below. The size of
53  /// vars changes as more Elements send data to this Interpolator.
55  /// global_offsets[j][i] is the index into block_coord_holders that
56  /// corresponds to the index i of the DataVector held in vars[j].
57  /// The size of global_offsets changes as more Elements
58  /// send data to this Interpolator.
60  /// Holds the ElementIds of Elements for which interpolation has
61  /// already been done for this Info.
64 };
65
66 /// Holds Infos at all temporal_ids for a given
67 /// InterpolationTargetTag. Also holds temporal_ids when data has
68 /// been interpolated; this is used for cleanup purposes. All
69 /// Holders for all InterpolationTargetTags are held in a single
70 /// TaggedTuple that is in the Interpolator's DataBox with the
71 /// tag Tags::InterpolatedVarsHolders.
72 template <typename Metavariables,
73  typename InterpolationTargetTag, typename TagList>
74 struct Holder {
78  infos;
80  temporal_ids_when_data_has_been_interpolated;
81 };
82
83 /// Indexes a particular Holder in the TaggedTuple that is
84 /// accessed from the Interpolator's DataBox with tag
85 /// Tags::InterpolatedVarsHolders.
86 template <typename InterpolationTargetTag, typename Metavariables>
87 struct HolderTag {
88  using type =
89  Holder<Metavariables, InterpolationTargetTag,
90  typename InterpolationTargetTag::vars_to_interpolate_to_target>;
91 };
92
93 } // namespace Vars
94 } // namespace intrp
A data structure that contains an ID and data associated with that ID.
Definition: IdPair.hpp:16
Index a block of the computational domain.
Definition: BlockId.hpp:21
Holds a Variables interpolated onto a list of points, and information about those points...
Definition: InterpolatedVars.hpp:32
An ElementId uniquely labels an Element. It is constructed from the BlockId of the Block to which the...
Definition: ElementId.hpp:36
std::vector< Variables< TagList > > vars
vars holds the interpolated Variables on some subset of the points in block_coord_holders. The grid points inside vars are indexed according to global_offsets below. The size of vars changes as more Elements send data to this Interpolator.
Definition: InterpolatedVars.hpp:54
std::unordered_set< ElementId< VolumeDim > > interpolation_is_done_for_these_elements
Holds the ElementIds of Elements for which interpolation has already been done for this Info...
Definition: InterpolatedVars.hpp:63
std::vector< IdPair< domain::BlockId, tnsr::I< double, VolumeDim, typename ::Frame::Logical > > > block_coord_holders
block_coord_holders holds the list of all points (in block logical coordinates) that need to be inter...
Definition: InterpolatedVars.hpp:49
std::vector< std::vector< size_t > > global_offsets
global_offsets[j][i] is the index into block_coord_holders that corresponds to the index i of the Dat...
Definition: InterpolatedVars.hpp:59
Defines a list of useful type aliases for tensors.
Holds Infos at all temporal_ids for a given InterpolationTargetTag. Also holds temporal_ids when data...
Definition: InterpolatedVars.hpp:74
Identifies a step in the linear solver algorithm.
Definition: IterationId.hpp:25
Definition: SolvePoissonProblem.hpp:38
Indexes a particular Holder in the TaggedTuple that is accessed from the Interpolator&#39;s DataBox with ...
Definition: InterpolatedVars.hpp:87