Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cmath> 7 : #include <cstddef> 8 : #include <string> 9 : 10 : #include "Evolution/Systems/Cce/Tags.hpp" 11 : #include "IO/H5/File.hpp" 12 : #include "Utilities/ForceInline.hpp" 13 : 14 : /// \cond 15 : class ComplexModalVector; 16 : /// \endcond 17 : 18 : namespace Cce { 19 : 20 : /// The dataset string associated with each scalar that will be output in the 21 : /// reduced set of SpEC-like worldtube boundary data. 22 : template <typename Tag> 23 1 : std::string dataset_label_for_tag(); 24 : 25 : template <> 26 0 : SPECTRE_ALWAYS_INLINE std::string 27 : dataset_label_for_tag<Cce::Tags::BoundaryValue<Cce::Tags::BondiBeta>>() { 28 : return "Beta"; 29 : } 30 : 31 : template <> 32 0 : SPECTRE_ALWAYS_INLINE std::string 33 : dataset_label_for_tag<Cce::Tags::BoundaryValue<Cce::Tags::BondiU>>() { 34 : return "U"; 35 : } 36 : 37 : template <> 38 0 : SPECTRE_ALWAYS_INLINE std::string 39 : dataset_label_for_tag<Cce::Tags::BoundaryValue<Cce::Tags::BondiQ>>() { 40 : return "Q"; 41 : } 42 : 43 : template <> 44 0 : SPECTRE_ALWAYS_INLINE std::string 45 : dataset_label_for_tag<Cce::Tags::BoundaryValue<Cce::Tags::BondiW>>() { 46 : return "W"; 47 : } 48 : 49 : template <> 50 0 : SPECTRE_ALWAYS_INLINE std::string 51 : dataset_label_for_tag<Cce::Tags::BoundaryValue<Cce::Tags::BondiJ>>() { 52 : return "J"; 53 : } 54 : 55 : template <> 56 0 : SPECTRE_ALWAYS_INLINE std::string dataset_label_for_tag< 57 : Cce::Tags::BoundaryValue<Cce::Tags::Dr<Cce::Tags::BondiJ>>>() { 58 : return "DrJ"; 59 : } 60 : 61 : template <> 62 0 : SPECTRE_ALWAYS_INLINE std::string dataset_label_for_tag< 63 : Cce::Tags::BoundaryValue<Cce::Tags::Du<Cce::Tags::BondiJ>>>() { 64 : return "H"; 65 : } 66 : 67 : template <> 68 0 : SPECTRE_ALWAYS_INLINE std::string 69 : dataset_label_for_tag<Cce::Tags::BoundaryValue<Cce::Tags::BondiR>>() { 70 : return "R"; 71 : } 72 : 73 : template <> 74 0 : SPECTRE_ALWAYS_INLINE std::string dataset_label_for_tag< 75 : Cce::Tags::BoundaryValue<Cce::Tags::Du<Cce::Tags::BondiR>>>() { 76 : return "DuR"; 77 : } 78 : 79 : /// Records a compressed representation of SpEC-like worldtube data associated 80 : /// with just the spin-weighted scalars required to perform the CCE algorithm. 81 1 : struct ReducedWorldtubeModeRecorder { 82 : public: 83 : /// The constructor takes the filename used to create the H5File object for 84 : /// writing the data 85 1 : explicit ReducedWorldtubeModeRecorder(const std::string& filename) 86 : : output_file_{filename} {} 87 : 88 : /// append to `dataset_path` the vector created by `time` followed by the 89 : /// `modes` rearranged in ascending m-varies-fastest format. 90 : /// 91 : /// For real quantities, negative m and the imaginary part of m=0 are omitted. 92 1 : void append_worldtube_mode_data(const std::string& dataset_path, double time, 93 : const ComplexModalVector& modes, size_t l_max, 94 : bool is_real = false); 95 : 96 : private: 97 0 : h5::H5File<h5::AccessType::ReadWrite> output_file_; 98 : }; 99 : } // namespace Cce