DataOnSlice.hpp
1 // Distributed under the MIT License.
2 // See LICENSE.txt for details.
3 
4 #pragma once
5 
6 #include <array>
7 #include <boost/range/combine.hpp>
8 #include <cstddef>
9 
11 #include "DataStructures/Index.hpp"
12 #include "DataStructures/SliceIterator.hpp"
15 #include "Utilities/TMPL.hpp"
16 #include "Utilities/TypeTraits.hpp"
17 
18 namespace db {
19 /*!
20  * \ingroup DataBoxGroup
21  * \brief Slices volume `Tensor`s from a `DataBox` into a `Variables`
22  *
23  * The slice has a constant logical coordinate in direction `sliced_dim`,
24  * slicing the volume at `fixed_index` in that dimension. For
25  * example, to get the lower boundary of `sliced_dim`, pass `0` for
26  * `fixed_index`; to get the upper boundary, pass
27  * `extents[sliced_dim] - 1`. The last argument to the function is the typelist
28  * holding the tags to slice.
29  *
30  * \snippet Test_DataBox.cpp data_on_slice
31  */
32 template <size_t VolumeDim, typename TagsList, typename... TagsToSlice>
33 Variables<tmpl::list<TagsToSlice...>> data_on_slice(
34  const db::DataBox<TagsList>& box, const Index<VolumeDim>& element_extents,
35  const size_t sliced_dim, const size_t fixed_index,
36  tmpl::list<TagsToSlice...> /*meta*/) noexcept {
37  return data_on_slice<TagsToSlice...>(element_extents, sliced_dim, fixed_index,
38  db::get<TagsToSlice>(box)...);
39 }
40 } // namespace db
Defines class template Index.
Defines classes and functions used for manipulating DataBox&#39;s.
Definition: InterpolationTargetWedgeSectionTorus.hpp:24
Defines class Variables.
Namespace for DataBox related things.
Definition: DataBox.hpp:33
Variables< tmpl::list< TagsToSlice... > > data_on_slice(const db::DataBox< TagsList > &box, const Index< VolumeDim > &element_extents, const size_t sliced_dim, const size_t fixed_index, tmpl::list< TagsToSlice... >) noexcept
Slices volume Tensors from a DataBox into a Variables
Definition: DataOnSlice.hpp:33
Wraps the template metaprogramming library used (brigand)
Defines helper functions for use with Variables class.
Defines type traits, some of which are future STL type_traits header.