// @HEADER // ***************************************************************************** // Sacado Package // // Copyright 2006 NTESS and the Sacado contributors. // SPDX-License-Identifier: LGPL-2.1-or-later // ***************************************************************************** // @HEADER #ifndef SACADO_FAD_SLFADTRAITS_HPP #define SACADO_FAD_SLFADTRAITS_HPP #include "Sacado_ConfigDefs.h" #ifdef SACADO_NEW_FAD_DESIGN_IS_DEFAULT #include "Sacado_Fad_Exp_GeneralFadTraits.hpp" #else #include "Sacado_Traits.hpp" #include // Forward declarations namespace Sacado { namespace Fad { template class SLFad; } } namespace Sacado { //! Specialization of %Promote to SLFad types SACADO_SFAD_PROMOTE_SPEC( Fad, SLFad ) //! Specialization of %ScalarType to SLFad types template struct ScalarType< Fad::SLFad > { typedef typename Fad::SLFad::ScalarT type; }; //! Specialization of %ValueType to SLFad types template struct ValueType< Fad::SLFad > { typedef ValueT type; }; //! Specialization of %IsADType to SLFad types template struct IsADType< Fad::SLFad > { static const bool value = true; }; //! Specialization of %IsScalarType to SLFad types template struct IsScalarType< Fad::SLFad > { static const bool value = false; }; //! Specialization of %IsSimdType to SLFad types template struct IsSimdType< Fad::SLFad > { static const bool value = IsSimdType::value; }; //! Specialization of %Value to SLFad types template struct Value< Fad::SLFad > { typedef typename ValueType< Fad::SLFad >::type value_type; SACADO_INLINE_FUNCTION static const value_type& eval(const Fad::SLFad& x) { return x.val(); } }; //! Specialization of %ScalarValue to SLFad types template struct ScalarValue< Fad::SLFad > { typedef typename ValueType< Fad::SLFad >::type value_type; typedef typename ScalarType< Fad::SLFad >::type scalar_type; SACADO_INLINE_FUNCTION static const scalar_type& eval(const Fad::SLFad& x) { return ScalarValue::eval(x.val()); } }; //! Specialization of %StringName to SLFad types template struct StringName< Fad::SLFad > { static std::string eval() { std::stringstream ss; ss << "Sacado::Fad::SLFad< " << StringName::eval() << ", " << Num << " >"; return ss.str(); } }; //! Specialization of %IsEqual to SLFad types template struct IsEqual< Fad::SLFad > { SACADO_INLINE_FUNCTION static bool eval(const Fad::SLFad& x, const Fad::SLFad& y) { return x.isEqualTo(y); } }; //! Specialization of %IsStaticallySized to SLFad types template struct IsStaticallySized< Fad::SLFad > { static const bool value = false; }; //! Specialization of %IsStaticallySized to SLFad types template struct IsStaticallySized< const Fad::SLFad > { static const bool value = false; }; } // namespace Sacado // // Define Teuchos traits classes // // Promotion traits #ifdef HAVE_SACADO_TEUCHOSNUMERICS #include "Teuchos_PromotionTraits.hpp" namespace Teuchos { template struct PromotionTraits< Sacado::Fad::SLFad, Sacado::Fad::SLFad > { typedef typename Sacado::Promote< Sacado::Fad::SLFad, Sacado::Fad::SLFad >::type promote; }; template struct PromotionTraits< Sacado::Fad::SLFad, R > { typedef typename Sacado::Promote< Sacado::Fad::SLFad, R >::type promote; }; template struct PromotionTraits< L, Sacado::Fad::SLFad > { public: typedef typename Sacado::Promote< L, Sacado::Fad::SLFad >::type promote; }; } #endif // Scalar traits #ifdef HAVE_SACADO_TEUCHOSCORE #include "Sacado_Fad_ScalarTraitsImp.hpp" namespace Teuchos { template struct ScalarTraits< Sacado::Fad::SLFad > : public Sacado::Fad::ScalarTraitsImp< Sacado::Fad::SLFad > {}; } #endif // Serialization traits #ifdef HAVE_SACADO_TEUCHOSCOMM #include "Sacado_Fad_SerializationTraitsImp.hpp" namespace Teuchos { template struct SerializationTraits > : public Sacado::Fad::SerializationTraitsImp< Ordinal, Sacado::Fad::SLFad > {}; template struct ValueTypeSerializer > : public Sacado::Fad::SerializerImp< Ordinal, Sacado::Fad::SLFad, ValueTypeSerializer > { typedef Sacado::Fad::SLFad FadType; typedef ValueTypeSerializer ValueSerializer; typedef Sacado::Fad::SerializerImp< Ordinal,FadType,ValueSerializer> Base; ValueTypeSerializer(const Teuchos::RCP& vs, Ordinal sz = 0) : Base(vs, sz) {} }; } #endif // KokkosComm #if defined(HAVE_SACADO_KOKKOS) && defined(HAVE_SACADO_TEUCHOSKOKKOSCOMM) && defined(HAVE_SACADO_VIEW_SPEC) && !defined(SACADO_DISABLE_FAD_VIEW_SPEC) #include "KokkosExp_View_Fad.hpp" #endif #endif // SACADO_NEW_FAD_DESIGN_IS_DEFAULT #endif // SACADO_FAD_SFADTRAITS_HPP