SpECTRE Documentation Coverage Report
Current view: top level - DataStructures/Variables - FrameTransform.hpp Hit Total Coverage
Commit: 965048f86d23c819715b3af1ca3f880c8145d4bb Lines: 4 6 66.7 %
Date: 2024-05-16 17:00:40
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             : 
       8             : #include "DataStructures/Tensor/EagerMath/FrameTransform.hpp"
       9             : #include "DataStructures/Tensor/Metafunctions.hpp"
      10             : #include "DataStructures/Tensor/TypeAliases.hpp"
      11             : #include "DataStructures/Variables.hpp"
      12             : #include "Utilities/Gsl.hpp"
      13             : 
      14             : namespace transform {
      15             : 
      16             : /// Tags to represent the result of frame-transforming Variables
      17           1 : namespace Tags {
      18             : /// The `Tag` with the first index transformed to a different frame
      19             : template <typename Tag, typename FirstIndexFrame>
      20           1 : struct TransformedFirstIndex : db::SimpleTag {
      21           0 :   using type = TensorMetafunctions::prepend_spatial_index<
      22             :       TensorMetafunctions::remove_first_index<typename Tag::type>,
      23             :       tmpl::front<typename Tag::type::index_list>::dim, UpLo::Up,
      24             :       FirstIndexFrame>;
      25             : };
      26             : }  // namespace Tags
      27             : 
      28             : /// @{
      29             : /// Transforms the first index of all tensors in the Variables to a different
      30             : /// frame
      31             : ///
      32             : /// See single-Tensor overload for details.
      33             : template <typename... ResultTags, typename... InputTags, size_t Dim,
      34             :           typename SourceFrame, typename TargetFrame>
      35           1 : void first_index_to_different_frame(
      36             :     const gsl::not_null<Variables<tmpl::list<ResultTags...>>*> result,
      37             :     const Variables<tmpl::list<InputTags...>>& input,
      38             :     const InverseJacobian<DataVector, Dim, SourceFrame, TargetFrame>&
      39             :         inv_jacobian) {
      40             :   EXPAND_PACK_LEFT_TO_RIGHT(
      41             :       first_index_to_different_frame(make_not_null(&get<ResultTags>(*result)),
      42             :                                      get<InputTags>(input), inv_jacobian));
      43             : }
      44             : 
      45             : template <typename... InputTags, size_t Dim, typename SourceFrame,
      46             :           typename TargetFrame,
      47             :           typename ResultVars = Variables<tmpl::list<
      48             :               Tags::TransformedFirstIndex<InputTags, SourceFrame>...>>>
      49           1 : ResultVars first_index_to_different_frame(
      50             :     const Variables<tmpl::list<InputTags...>>& input,
      51             :     const InverseJacobian<DataVector, Dim, SourceFrame, TargetFrame>&
      52             :         inv_jacobian) {
      53             :   ResultVars result{input.number_of_grid_points()};
      54             :   first_index_to_different_frame(make_not_null(&result), input, inv_jacobian);
      55             :   return result;
      56             : }
      57             : /// @}
      58             : 
      59             : }  // namespace transform

Generated by: LCOV version 1.14