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_DFADTRAITS_HPP
00052 #define SACADO_ELRFAD_DFADTRAITS_HPP
00053
00054 #include "Sacado_Traits.hpp"
00055
00056
00057 namespace Sacado {
00058 namespace ELRFad {
00059 template <typename T1, typename T2> class DFad;
00060 }
00061 }
00062
00063 namespace Sacado {
00064
00066 template <typename ValueT, typename ScalarT>
00067 struct Promote< ELRFad::DFad<ValueT,ScalarT>, ELRFad::DFad<ValueT,ScalarT> > {
00068 typedef ELRFad::DFad<ValueT,ScalarT> type;
00069 };
00070
00072 template <typename ValueT, typename ScalarT, typename R>
00073 struct Promote< ELRFad::DFad<ValueT,ScalarT>, R > {
00074 typedef typename ValueType< ELRFad::DFad<ValueT,ScalarT> >::type value_type_l;
00075 typedef typename ValueType<R>::type value_type_r;
00076 typedef typename Promote<value_type_l,value_type_r>::type value_type;
00077
00078 typedef ELRFad::DFad<value_type,ScalarT> type;
00079 };
00080
00082 template <typename L, typename ValueT, typename ScalarT>
00083 struct Promote< L, ELRFad::DFad<ValueT, ScalarT> > {
00084 public:
00085
00086 typedef typename ValueType<L>::type value_type_l;
00087 typedef typename ValueType< ELRFad::DFad<ValueT,ScalarT> >::type value_type_r;
00088 typedef typename Promote<value_type_l,value_type_r>::type value_type;
00089
00090 typedef ELRFad::DFad<value_type,ScalarT> type;
00091 };
00092
00094 template <typename ValueT, typename ScalarT>
00095 struct ScalarType< ELRFad::DFad<ValueT,ScalarT> > {
00096 typedef ScalarT type;
00097 };
00098
00100 template <typename ValueT, typename ScalarT>
00101 struct ValueType< ELRFad::DFad<ValueT,ScalarT> > {
00102 typedef ValueT type;
00103 };
00104
00106 template <typename ValueT, typename ScalarT>
00107 struct ScalarValueType< ELRFad::DFad<ValueT,ScalarT> > {
00108 typedef typename ScalarValueType< ValueT >::type type;
00109 };
00110
00112 template <typename ValueT, typename ScalarT>
00113 struct IsADType< ELRFad::DFad<ValueT,ScalarT> > {
00114 static const bool value = true;
00115 };
00116
00118 template <typename ValueT, typename ScalarT>
00119 struct IsScalarType< ELRFad::DFad<ValueT,ScalarT> > {
00120 static const bool value = false;
00121 };
00122
00124 template <typename ValueT, typename ScalarT>
00125 struct Value< ELRFad::DFad<ValueT,ScalarT> > {
00126 typedef typename ValueType< ELRFad::DFad<ValueT,ScalarT> >::type value_type;
00127 static const value_type& eval(const ELRFad::DFad<ValueT,ScalarT>& x) {
00128 return x.val(); }
00129 };
00130
00131 }
00132
00133 #endif // SACADO_ELRFAD_DFADTRAITS_HPP