00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 #ifndef SACADO_ELRFAD_SFADTRAITS_HPP
00052 #define SACADO_ELRFAD_SFADTRAITS_HPP
00053
00054 #include "Sacado_Traits.hpp"
00055
00056
00057 namespace Sacado {
00058 namespace ELRFad {
00059 template <typename T1, int Num, typename T2> class SFad;
00060 }
00061 }
00062
00063 namespace Sacado {
00064
00066 template <typename ValueT, int Num, typename ScalarT>
00067 struct Promote< ELRFad::SFad<ValueT,Num,ScalarT>,
00068 ELRFad::SFad<ValueT,Num,ScalarT> > {
00069 typedef ELRFad::SFad<ValueT,Num,ScalarT> type;
00070 };
00071
00073 template <typename ValueT, int Num, typename ScalarT, typename R>
00074 struct Promote< ELRFad::SFad<ValueT,Num,ScalarT>, R > {
00075 typedef typename ValueType< ELRFad::SFad<ValueT,Num,ScalarT> >::type value_type_l;
00076 typedef typename ValueType<R>::type value_type_r;
00077 typedef typename Promote<value_type_l,value_type_r>::type value_type;
00078
00079 typedef ELRFad::SFad<value_type,Num,ScalarT> type;
00080 };
00081
00083 template <typename L, typename ValueT, int Num, typename ScalarT>
00084 struct Promote< L, ELRFad::SFad<ValueT, Num, ScalarT> > {
00085 public:
00086
00087 typedef typename ValueType<L>::type value_type_l;
00088 typedef typename ValueType< ELRFad::SFad<ValueT,Num,ScalarT> >::type value_type_r;
00089 typedef typename Promote<value_type_l,value_type_r>::type value_type;
00090
00091 typedef ELRFad::SFad<value_type,Num,ScalarT> type;
00092 };
00093
00095 template <typename ValueT, int Num, typename ScalarT>
00096 struct ScalarType< ELRFad::SFad<ValueT,Num,ScalarT> > {
00097 typedef ScalarT type;
00098 };
00099
00101 template <typename ValueT, int Num, typename ScalarT>
00102 struct ValueType< ELRFad::SFad<ValueT,Num,ScalarT> > {
00103 typedef ValueT type;
00104 };
00105
00107 template <typename ValueT, int Num, typename ScalarT>
00108 struct ScalarValueType< ELRFad::SFad<ValueT,Num,ScalarT> > {
00109 typedef typename ScalarValueType< ValueT >::type type;
00110 };
00111
00113 template <typename ValueT, int Num, typename ScalarT>
00114 struct IsADType< ELRFad::SFad<ValueT,Num,ScalarT> > {
00115 static const bool value = true;
00116 };
00117
00119 template <typename ValueT, int Num, typename ScalarT>
00120 struct IsScalarType< ELRFad::SFad<ValueT,Num,ScalarT> > {
00121 static const bool value = false;
00122 };
00123
00125 template <typename ValueT, int Num, typename ScalarT>
00126 struct Value< ELRFad::SFad<ValueT,Num,ScalarT> > {
00127 typedef typename ValueType< ELRFad::SFad<ValueT,Num,ScalarT> >::type value_type;
00128 static const value_type& eval(const ELRFad::SFad<ValueT,Num,ScalarT>& x) {
00129 return x.val(); }
00130 };
00131
00132 }
00133
00134 #endif // SACADO_ELRFAD_SFADTRAITS_HPP