Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : #include <map> 8 : #include <memory> 9 : #include <string> 10 : #include <unordered_map> 11 : 12 1 : namespace gsl { 13 : template <class T> 14 : class not_null; 15 : } // namespace gsl 16 : 17 : namespace domain::FunctionsOfTime { 18 : template <size_t max_deriv> 19 : class PiecewisePolynomial; 20 : class FunctionOfTime; 21 : 22 : /// \brief Import SpEC `FunctionOfTime` data from an H5 file. 23 : /// 24 : /// Columns in the file to be read must have the following form: 25 : /// - 0 = time 26 : /// - 1 = time of last update 27 : /// - 2 = number of components 28 : /// - 3 = maximum derivative order 29 : /// - 4 = version 30 : /// - 5 = function 31 : /// - 6 = d/dt (function) 32 : /// - 7 = d^2/dt^2 (function) 33 : /// - 8 = d^3/dt^3 (function) 34 : /// 35 : /// If the function has more than one component, columns 5-8 give 36 : /// the first component and its derivatives, columns 9-12 give the second 37 : /// component and its derivatives, etc. 38 : /// 39 : /// Currently, only support order 2 and 3 piecewise polynomials and order 3 40 : /// quaternion functions of time. This could be generalized later, but the SpEC 41 : /// functions of time that we will read in with this action will always be 42 : /// 3rd-order piecewise polynomials. 43 : /// 44 : template <template <size_t> class FoTType, size_t MaxDeriv> 45 1 : void read_spec_piecewise_polynomial( 46 : gsl::not_null<std::unordered_map<std::string, FoTType<MaxDeriv>>*> 47 : spec_functions_of_time, 48 : const std::string& file_name, 49 : const std::map<std::string, std::string>& dataset_name_map, 50 : const bool quaternion_rotation = false); 51 : 52 : /// \brief Replace the functions of time from the `domain_creator` with the ones 53 : /// read in from `function_of_time_file`. 54 : /// 55 : /// \note Currently, only support order 2 or 3 piecewise polynomials. This could 56 : /// be generalized later, but the SpEC functions of time that we will read in 57 : /// with this action will always be 2nd-order or 3rd-order piecewise polynomials 58 1 : void override_functions_of_time( 59 : const gsl::not_null<std::unordered_map< 60 : std::string, std::unique_ptr<domain::FunctionsOfTime::FunctionOfTime>>*> 61 : functions_of_time, 62 : const std::string& function_of_time_file, 63 : const std::map<std::string, std::string>& function_of_time_name_map); 64 : } // namespace domain::FunctionsOfTime