SpECTRE Documentation Coverage Report
Current view: top level - Utilities/Autodiff - Autodiff.hpp Hit Total Coverage
Commit: 3ffcbc8ecf43797401b60bcca17d6040ee06f013 Lines: 0 9 0.0 %
Date: 2026-03-03 02:01:44
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 1.14