// @HEADER // ***************************************************************************** // Sacado Package // // Copyright 2006 NTESS and the Sacado contributors. // SPDX-License-Identifier: LGPL-2.1-or-later // ***************************************************************************** // @HEADER #ifndef SACADO_TAYLOR_DTAYLORTRAITS_HPP #define SACADO_TAYLOR_DTAYLORTRAITS_HPP #include "Sacado_Traits.hpp" // Forward declarations namespace Sacado { namespace Tay { template class CacheTaylor; template class Expr; } } namespace Sacado { //! Specialization of %Promote to CacheTaylor types SACADO_AD_PROMOTE_SPEC( Tay, CacheTaylor ) //! Specialization of %Promote to Expr types SACADO_EXPR_PROMOTE_SPEC( Tay ) //! Specialization of %ScalarType to DFad types template struct ScalarType< Tay::CacheTaylor > { typedef typename ScalarType::type type; }; //! Specialization of %ValueType to DFad types template struct ValueType< Tay::CacheTaylor > { typedef T type; }; //! Specialization of %IsADType to DFad types template struct IsADType< Tay::CacheTaylor > { static const bool value = true; }; //! Specialization of %IsADType to DFad types template struct IsScalarType< Tay::CacheTaylor > { static const bool value = false; }; //! Specialization of %Value to DFad types template struct Value< Tay::CacheTaylor > { typedef typename ValueType< Tay::CacheTaylor >::type value_type; static const value_type& eval(const Tay::CacheTaylor& x) { return x.val(); } }; //! Specialization of %ScalarValue to CacheTaylor types template struct ScalarValue< Tay::CacheTaylor > { typedef typename ValueType< Tay::CacheTaylor >::type value_type; typedef typename ScalarType< Tay::CacheTaylor >::type scalar_type; static const scalar_type& eval(const Tay::CacheTaylor& x) { return ScalarValue::eval(x.val()); } }; //! Specialization of %StringName to CacheTaylor types template struct StringName< Tay::CacheTaylor > { static std::string eval() { return std::string("Sacado::Tay::CacheTaylor< ") + StringName::eval() + " >"; } }; //! Specialization of %IsEqual to Taylor types template struct IsEqual< Tay::CacheTaylor > { static bool eval(const Tay::CacheTaylor& x, const Tay::CacheTaylor& y) { return x.isEqualTo(y); } }; //! Specialization of %IsStaticallySized to Taylor types template struct IsStaticallySized< Tay::CacheTaylor > { 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::Tay::CacheTaylor, Sacado::Tay::CacheTaylor > { typedef typename Sacado::Promote< Sacado::Tay::CacheTaylor, Sacado::Tay::CacheTaylor >::type promote; }; //! Specialization of %Teuchos::PromotionTraits to DFad types template struct PromotionTraits< Sacado::Tay::CacheTaylor, R > { typedef typename Sacado::Promote< Sacado::Tay::CacheTaylor, R >::type promote; }; //! Specialization of %Teuchos::PromotionTraits to DFad types template struct PromotionTraits< L, Sacado::Tay::CacheTaylor > { public: typedef typename Sacado::Promote< L, Sacado::Tay::CacheTaylor >::type promote; }; } #endif // Scalar traits #ifdef HAVE_SACADO_TEUCHOSCORE #include "Sacado_Tay_ScalarTraitsImp.hpp" namespace Teuchos { template struct ScalarTraits< Sacado::Tay::CacheTaylor > : public Sacado::Tay::ScalarTraitsImp< Sacado::Tay::CacheTaylor > {}; } #endif // Serialization traits #ifdef HAVE_SACADO_TEUCHOSCOMM #include "Sacado_Tay_SerializationTraitsImp.hpp" namespace Teuchos { template struct SerializationTraits > : public Sacado::Tay::SerializationTraitsImp< Ordinal, Sacado::Tay::CacheTaylor > {}; template struct ValueTypeSerializer > : public Sacado::Tay::SerializerImp< Ordinal, Sacado::Tay::CacheTaylor, ValueTypeSerializer > { typedef Sacado::Tay::CacheTaylor TayType; typedef ValueTypeSerializer ValueSerializer; typedef Sacado::Tay::SerializerImp< Ordinal,TayType,ValueSerializer> Base; ValueTypeSerializer(const Teuchos::RCP& vs, Ordinal sz = 0) : Base(vs, sz) {} }; } #endif #endif // SACADO_TAYLOR_DTAYLORTRAITS_HPP