SpECTRE Documentation Coverage Report
Current view: top level - IO/Exporter - Exporter.hpp Hit Total Coverage
Commit: 965048f86d23c819715b3af1ca3f880c8145d4bb Lines: 4 9 44.4 %
Date: 2024-05-16 17:00:40
Legend: Lines: hit not hit

          Line data    Source code
       1           1 : // Distributed under the MIT License.
       2             : // See LICENSE.txt for details.
       3             : 
       4             : /// \file
       5             : /// Declares functions for interpolating data in volume files to target points.
       6             : /// This file is intended to be included in external programs, so it
       7             : /// intentionally has no dependencies on any other headers.
       8             : 
       9             : #pragma once
      10             : 
      11             : #include <array>
      12             : #include <cstddef>
      13             : #include <optional>
      14             : #include <string>
      15             : #include <variant>
      16             : #include <vector>
      17             : 
      18           0 : namespace spectre::Exporter {
      19             : 
      20             : /// Identifies an observation by its ID in the volume data file.
      21           1 : struct ObservationId {
      22           0 :   explicit ObservationId(size_t local_value) : value(local_value) {}
      23           0 :   size_t value;
      24             : };
      25             : 
      26             : /// Identifies an observation by its index in the ordered list of observations.
      27             : /// Negative indices are counted from the end of the list.
      28           1 : struct ObservationStep {
      29           0 :   explicit ObservationStep(int local_value) : value(local_value) {}
      30           0 :   int value;
      31             : };
      32             : 
      33             : /*!
      34             :  * \brief Interpolate data in volume files to target points
      35             :  *
      36             :  * \tparam Dim Dimension of the domain
      37             :  * \param volume_files_or_glob The list of H5 files, or a glob pattern
      38             :  * \param subfile_name The name of the subfile in the H5 files containing the
      39             :  * volume data
      40             :  * \param observation Either the observation ID as a `size_t`, or the index of
      41             :  * the observation in the volume files to interpolate as an `int` (a value of 0
      42             :  * would be the first observation, and a value of -1 would be the last
      43             :  * observation).
      44             :  * \param tensor_components The tensor components to interpolate, e.g.
      45             :  * "Lapse", "Shift_x", "Shift_y", "Shift_z", "SpatialMetric_xx", etc.
      46             :  * Look into the H5 file to see what components are available.
      47             :  * \param target_points The points to interpolate to, in inertial coordinates.
      48             :  * \param num_threads The number of threads to use if OpenMP is linked in. If
      49             :  * not specified, OpenMP will determine the number of threads automatically.
      50             :  * It's also possible to set the number of threads using the environment
      51             :  * variable OMP_NUM_THREADS. It's an error to specify num_threads if OpenMP is
      52             :  * not linked in. Set num_threads to 1 to disable OpenMP.
      53             :  * \return std::vector<std::vector<double>> The interpolated data. The first
      54             :  * dimension corresponds to the selected tensor components, and the second
      55             :  * dimension corresponds to the target points.
      56             :  */
      57             : template <size_t Dim>
      58           1 : std::vector<std::vector<double>> interpolate_to_points(
      59             :     const std::variant<std::vector<std::string>, std::string>&
      60             :         volume_files_or_glob,
      61             :     const std::string& subfile_name,
      62             :     const std::variant<ObservationId, ObservationStep>& observation,
      63             :     const std::vector<std::string>& tensor_components,
      64             :     const std::array<std::vector<double>, Dim>& target_points,
      65             :     std::optional<size_t> num_threads = std::nullopt);
      66             : 
      67             : }  // namespace spectre::Exporter

Generated by: LCOV version 1.14