SpECTRE Documentation Coverage Report
Current view: top level - Utilities/Autodiff - Autodiff.hpp Coverage Total Hit
Commit: 0d1d717af84a81fb1284a20c4013708fe85cc2f0 Lines: 0.0 % 9 0
Test Date: 2026-10-22 17:29:42
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              : #ifdef SPECTRE_AUTODIFF
       7              : 
       8              : #include <autodiff/common/numbertraits.hpp>
       9              : #include <autodiff/forward/dual.hpp>
      10              : #include <autodiff/reverse/var.hpp>
      11              : 
      12              : #include "Utilities/MakeWithValue.hpp"
      13              : #include "Utilities/Simd/Simd.hpp"
      14              : 
      15            0 : namespace autodiff {
      16            0 : using BatchType = simd::batch<double>;
      17            0 : using SecondOrderDual = autodiff::HigherOrderDual<2, BatchType>;
      18            0 : using SecondOrderDualNum = autodiff::HigherOrderDual<2, double>;
      19              : 
      20              : namespace detail {
      21              : /// Template specialization for simd::batch<double> to treat it as arithmetic.
      22              : // The major difficulty we have with DataVector working with autodiff is
      23              : // DataVector does not have a scalar broadcast constructor, which is expected
      24              : // in the seed function for autodiff dual type.
      25              : template <>
      26              : struct ArithmeticTraits<simd::batch<double>> {
      27              :   static constexpr bool isArithmetic = true;
      28              : };
      29              : }  // namespace detail
      30              : }  // namespace autodiff
      31              : 
      32              : namespace MakeWithValueImpls {
      33              : template <typename T>
      34            0 : struct MakeWithValueImpl<autodiff::HigherOrderDual<2, double>, T> {
      35            0 :   static SPECTRE_ALWAYS_INLINE autodiff::HigherOrderDual<2, double> apply(
      36              :       const T& /* input */, const double value) {
      37              :     return {value};
      38              :   }
      39              : };
      40              : 
      41              : template <typename T>
      42            0 : struct MakeWithValueImpl<autodiff::HigherOrderDual<2, simd::batch<double>>, T> {
      43              :   static SPECTRE_ALWAYS_INLINE autodiff::HigherOrderDual<2, simd::batch<double>>
      44            0 :   apply(const T& /* input */, const double value) {
      45              :     return {simd::batch<double>::broadcast(value)};
      46              :   }
      47              : };
      48              : }  // namespace MakeWithValueImpls
      49              : 
      50              : #endif  // SPECTRE_AUTODIFF
        

Generated by: LCOV version 2.0-1