Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <array>
7 : #include <memory>
8 : #include <string>
9 :
10 : #include "DataStructures/DataVector.hpp"
11 : #include "Domain/FunctionsOfTime/FunctionOfTime.hpp"
12 : #include "Domain/Structure/ObjectLabel.hpp"
13 : #include "Options/Auto.hpp"
14 : #include "Options/Context.hpp"
15 : #include "Options/String.hpp"
16 : #include "Utilities/TMPL.hpp"
17 :
18 : namespace domain::creators::time_dependent_options {
19 : /// @{
20 : /*!
21 : * \brief Read in FunctionOfTime coefficients from an H5 file and volume
22 : * subfile.
23 : *
24 : * \details The H5 file will only be accessed in the `retrieve_function_of_time`
25 : * function.
26 : */
27 1 : struct FromVolumeFile {
28 0 : struct H5Filename {
29 0 : using type = std::string;
30 0 : static constexpr Options::String help{
31 : "Name of H5 file to read functions of time from."};
32 : };
33 :
34 0 : struct SubfileName {
35 0 : using type = std::string;
36 0 : static constexpr Options::String help{
37 : "Subfile that holds the volume data. Must be an h5::VolumeData "
38 : "subfile."};
39 : };
40 :
41 0 : using options = tmpl::list<H5Filename, SubfileName>;
42 0 : static constexpr Options::String help =
43 : "Read function of time coefficients from a volume subfile of an H5 file.";
44 :
45 0 : FromVolumeFile() = default;
46 : // The replay option cannot be set from options
47 0 : FromVolumeFile(std::string h5_filename, std::string subfile_name,
48 : bool replay = false);
49 :
50 : /*!
51 : * \returns clones of all global functions of time
52 : * in \p function_of_time_names
53 : *
54 : * \details If a value for \p time is specified, will ensure that \p time is
55 : * within the `domain::FunctionsOfTime::FunctionOfTime::time_bounds()` of each
56 : * function of time.
57 : */
58 1 : FunctionsOfTimeMap retrieve_function_of_time(
59 : const std::unordered_set<std::string>& function_of_time_names,
60 : double time) const;
61 :
62 : /*!
63 : * \brief Whether the function of time from the volume file should just be
64 : * replayed (read in and unmodified), or not.
65 : */
66 1 : bool replay() const { return replay_; }
67 :
68 : private:
69 0 : std::string h5_filename_;
70 0 : std::string subfile_name_;
71 0 : bool replay_{false};
72 : };
73 : /// @}
74 : } // namespace domain::creators::time_dependent_options
|