// @HEADER // ***************************************************************************** // Sacado Package // // Copyright 2006 NTESS and the Sacado contributors. // SPDX-License-Identifier: LGPL-2.1-or-later // // *********************************************************************** // // The forward-mode AD classes in Sacado are a derivative work of the // expression template classes in the Fad package by Nicolas Di Cesare. // The following banner is included in the original Fad source code: // // ************ DO NOT REMOVE THIS BANNER **************** // // Nicolas Di Cesare // http://www.ann.jussieu.fr/~dicesare // // CEMRACS 98 : C++ courses, // templates : new C++ techniques // for scientific computing // //******************************************************** // // NumericalTraits class to illustrate TRAITS // //******************************************************** // @HEADER #ifndef SACADO_FAD_VIEWFADTRAITS_HPP #define SACADO_FAD_VIEWFADTRAITS_HPP #include "Sacado_ConfigDefs.h" #ifdef SACADO_NEW_FAD_DESIGN_IS_DEFAULT #include "Sacado_Fad_Exp_GeneralFadTraits.hpp" #else #include "Sacado_Traits.hpp" // Forward declarations namespace Sacado { namespace Fad { template class ViewFad; } } namespace Sacado { //! Specialization of %Promote to ViewFad types SACADO_VFAD_PROMOTE_SPEC( Fad ) //! Specialization of %ScalarType to ViewFad types template struct ScalarType< Fad::ViewFad > { typedef typename Fad::ViewFad::ScalarT type; }; //! Specialization of %ValueType to ViewFad types template struct ValueType< Fad::ViewFad > { typedef ValueT type; }; //! Specialization of %IsADType to ViewFad types template struct IsADType< Fad::ViewFad > { static const bool value = true; }; //! Specialization of %IsScalarType to ViewFad types template struct IsScalarType< Fad::ViewFad > { static const bool value = false; }; //! Specialization of %IsSimdType to ViewFad types template struct IsSimdType< Fad::ViewFad > { static const bool value = IsSimdType::value; }; //! Specialization of %Value to ViewFad types template struct Value< Fad::ViewFad > { typedef typename ValueType< Fad::ViewFad >::type value_type; SACADO_INLINE_FUNCTION static const value_type& eval(const Fad::ViewFad& x) { return x.val(); } }; //! Specialization of %ScalarValue to ViewFad types template struct ScalarValue< Fad::ViewFad > { typedef typename ValueType< Fad::ViewFad >::type value_type; typedef typename ScalarType< Fad::ViewFad >::type scalar_type; SACADO_INLINE_FUNCTION static const scalar_type& eval(const Fad::ViewFad& x) { return ScalarValue::eval(x.val()); } }; //! Specialization of %StringName to ViewFad types template struct StringName< Fad::ViewFad > { static std::string eval() { return std::string("Sacado::Fad::ViewFad< ") + StringName::eval() + " >"; } }; //! Specialization of %IsEqual to ViewFad types template struct IsEqual< Fad::ViewFad > { SACADO_INLINE_FUNCTION static bool eval(const Fad::ViewFad& x, const Fad::ViewFad& y) { return x.isEqualTo(y); } }; //! Specialization of %IsStaticallySized to ViewFad types template struct IsStaticallySized< Fad::ViewFad > { static const bool value = false; }; } // namespace Sacado // ViewFad is not a proper scalar type, so we don't define any of the // Teuchos traits classes #endif // SACADO_NEW_FAD_DESIGN_IS_DEFAULT #endif // SACADO_FAD_DFADTRAITS_HPP