Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <optional>
7 : #include <string>
8 :
9 : #include "DataStructures/DataBox/Tag.hpp"
10 : #include "DataStructures/DataBox/TagName.hpp"
11 : #include "Parallel/ParallelComponentHelpers.hpp"
12 : #include "Parallel/Section.hpp"
13 : #include "Utilities/Serialization/PupStlCpp17.hpp"
14 :
15 : namespace Parallel::Tags {
16 :
17 : /*!
18 : * \brief The `Parallel::Section<ParallelComponent, SectionIdTag>` that this
19 : * element belongs to.
20 : *
21 : * The tag holds a `std::nullopt` if the element doesn't belong to a section of
22 : * the `SectionIdTag`. For example, a section may describe a specific region in
23 : * the computational domain and thus doesn't include all elements, so this tag
24 : * would hold `std::nullopt` on the elements outside that region.
25 : *
26 : * \see Parallel::Section
27 : */
28 : template <typename ParallelComponent, typename SectionIdTag>
29 1 : struct Section : db::SimpleTag {
30 0 : static std::string name() {
31 : return "Section(" + db::tag_name<SectionIdTag>() + ")";
32 : }
33 0 : using type =
34 : std::optional<Parallel::Section<ParallelComponent, SectionIdTag>>;
35 : // Allow default-constructing the tag so sections can be created and assigned
36 : // to the tag in a parallel component's `allocate_array` function.
37 0 : constexpr static bool pass_metavariables = false;
38 0 : using option_tags = tmpl::list<>;
39 0 : static type create_from_options() { return {}; };
40 : };
41 :
42 : } // namespace Parallel::Tags
|