SpECTRE Documentation Coverage Report
Current view: top level - IO/H5 - TensorData.hpp Hit Total Coverage
Commit: 1c32b58340e006addc79befb2cdaa7547247e09c Lines: 7 23 30.4 %
Date: 2024-04-19 07:30:15
Legend: Lines: hit not hit

          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 <iosfwd>
       8             : #include <string>
       9             : #include <utility>
      10             : #include <variant>
      11             : #include <vector>
      12             : 
      13             : #include "DataStructures/DataVector.hpp"
      14             : #include "NumericalAlgorithms/Spectral/Basis.hpp"
      15             : #include "NumericalAlgorithms/Spectral/Quadrature.hpp"
      16             : #include "Utilities/GetOutput.hpp"
      17             : 
      18             : /// \cond
      19             : namespace PUP {
      20             : class er;
      21             : }  // namespace PUP
      22             : template <size_t Dim>
      23             : struct ElementId;
      24             : template <size_t Dim>
      25             : struct Mesh;
      26             : /// \endcond
      27             : 
      28             : /*!
      29             :  * \ingroup DataStructuresGroup
      30             :  * \brief An untyped tensor component with a name for observation.
      31             :  *
      32             :  * The name should be just the name of the tensor component, such as 'Psi_xx'.
      33             :  * It must not include any slashes ('/').
      34             :  */
      35           1 : struct TensorComponent {
      36           0 :   TensorComponent() = default;
      37           0 :   TensorComponent(std::string in_name, DataVector in_data);
      38           0 :   TensorComponent(std::string in_name, std::vector<float> in_data);
      39             : 
      40             :   // NOLINTNEXTLINE(google-runtime-references)
      41           0 :   void pup(PUP::er& p);
      42           0 :   std::string name{};
      43           0 :   std::variant<DataVector, std::vector<float>> data{};
      44             : };
      45             : 
      46           0 : std::ostream& operator<<(std::ostream& os, const TensorComponent& t);
      47             : 
      48           0 : bool operator==(const TensorComponent& lhs, const TensorComponent& rhs);
      49             : 
      50           0 : bool operator!=(const TensorComponent& lhs, const TensorComponent& rhs);
      51             : 
      52             : /*!
      53             :  * \ingroup DataStructuresGroup
      54             :  * \brief Holds tensor components on a grid, to be written into an H5 file
      55             :  */
      56           1 : struct ElementVolumeData {
      57           0 :   ElementVolumeData() = default;
      58           0 :   ElementVolumeData(std::string element_name_in,
      59             :                     std::vector<TensorComponent> components,
      60             :                     std::vector<size_t> extents_in,
      61             :                     std::vector<Spectral::Basis> basis_in,
      62             :                     std::vector<Spectral::Quadrature> quadrature_in);
      63             :   template <size_t Dim>
      64           0 :   ElementVolumeData(const ElementId<Dim>& element_id,
      65             :                     std::vector<TensorComponent> components,
      66             :                     const Mesh<Dim>& mesh);
      67             : 
      68             :   // NOLINTNEXTLINE(google-runtime-references)
      69           0 :   void pup(PUP::er& p);
      70             :   /// Name of the grid (should be human-readable). For standard volume data this
      71             :   /// name must be the string representation of an ElementId, such as
      72             :   /// [B0,(L0I1,L0I0,L3I2)]. Code that reads the volume data may rely on this
      73             :   /// pattern to reconstruct the ElementId.
      74           1 :   std::string element_name{};
      75             :   /// All tensor components on the grid
      76           1 :   std::vector<TensorComponent> tensor_components{};
      77             :   /// Number of grid points in every dimension of the grid
      78           1 :   std::vector<size_t> extents{};
      79             :   /// Spectral::Basis in every dimension of the grid
      80           1 :   std::vector<Spectral::Basis> basis{};
      81             :   /// Spectral::Quadrature in every dimension of the grid
      82           1 :   std::vector<Spectral::Quadrature> quadrature{};
      83             : };
      84             : 
      85           0 : bool operator==(const ElementVolumeData& lhs, const ElementVolumeData& rhs);
      86           0 : bool operator!=(const ElementVolumeData& lhs, const ElementVolumeData& rhs);

Generated by: LCOV version 1.14