32 #include <type_traits> 34 #include "Teuchos_UnitTestHarness.hpp" 35 #include "Teuchos_UnitTestRepository.hpp" 36 #include "Teuchos_GlobalMPISession.hpp" 37 #include "Teuchos_TestingHelpers.hpp" 42 #include "Sacado_mpl_apply.hpp" 44 template <
typename uq_type,
typename expr_type>
46 using Sacado::Promote;
49 typedef typename Sacado::ValueType<uq_type>::type
value_type;
50 typedef typename Sacado::ScalarType<uq_type>::type
scalar_type;
53 is_same<
typename Promote<uq_type,uq_type>::type, uq_type >::
value,
54 "Promote<uq_type,uq_type>::type != uq_type");
57 is_same<
typename Promote<uq_type,value_type>::type, uq_type >::
value,
58 "Promote<uq_type,value_type>::type != uq_type");
61 is_same<
typename Promote<value_type,uq_type>::type, uq_type >::
value,
62 "Promote<value_type,uq_type>::type != uq_type");
65 is_same<
typename Promote<uq_type,scalar_type>::type, uq_type >::
value,
66 "Promote<uq_type,scalar_type>::type != uq_type");
69 is_same<
typename Promote<scalar_type,uq_type>::type, uq_type >::
value,
70 "Promote<scalar_type,uq_type>::type != uq_type");
73 is_same<
typename Promote<uq_type,expr_type>::type, uq_type >::
value,
74 "Promote<expr_type,uq_type>::type != uq_type");
77 is_same<
typename Promote<expr_type,uq_type>::type, uq_type >::
value,
78 "Promote<expr_type,uq_type>::type != uq_type");
81 is_same<
typename Promote<scalar_type,expr_type>::type, uq_type >::
value,
82 "Promote<scalar_type,uq_type>::type != uq_type");
85 is_same<
typename Promote<expr_type,scalar_type>::type, uq_type >::
value,
86 "Promote<expr_type,scalar_type>::type != uq_type");
89 is_same<
typename Promote<value_type,expr_type>::type, uq_type >::
value,
90 "Promote<value_type,uq_type>::type != uq_type");
93 is_same<
typename Promote<expr_type,value_type>::type, uq_type >::
value,
94 "Promote<expr_type,value_type>::type != uq_type");
101 template <
typename uq_type,
typename expr1_type,
typename expr2_type>
103 using Sacado::Promote;
107 is_same<
typename Promote<expr1_type,expr2_type>::type, uq_type >::
value,
108 "Promote<expr1_type,expr2_type>::type != uq_type");
115 template <
typename uq_type>
121 typedef decltype(std::declval<uq_type>()*std::declval<uq_type>()) bi_expr_type;
122 bool res1 = testUQExprPromote<uq_type,bi_expr_type>();
127 typedef decltype(-std::declval<uq_type>()) un_expr_type;
128 bool res2 = testUQExprPromote<uq_type,un_expr_type>();
130 bool res3 = testUQExprPromote2<uq_type,bi_expr_type,un_expr_type>();
132 return res1 && res2 && res3;
135 template <
typename uq_type>
137 using Sacado::Promote;
139 typedef Sacado::Fad::DFad<uq_type> fad_uq_type;
141 bool res1 = testUQPromote<uq_type>();
142 bool res2 = testUQPromote<fad_uq_type>();
144 typedef decltype(std::declval<uq_type>()*std::declval<uq_type>()) uq_expr_type;
145 typedef decltype(-std::declval<fad_uq_type>()) fad_uq_expr_type;
147 is_same<
typename Promote<uq_expr_type,fad_uq_expr_type>::type, fad_uq_type >::
value,
148 "Promote<uq_expr_type,fad_uq_expr_type>::type != fad_uq_type");
155 success = testPromote<UQ>();
158 typedef Kokkos::DefaultExecutionSpace
device;
160 #ifdef HAVE_STOKHOS_PCE_SCALAR_TYPE 166 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Promote, Promote, orthog_poly_type )
172 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Promote, Promote, et_orthog_poly_type )
179 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Promote, Promote, kokkos_pce_type )
182 #ifdef HAVE_STOKHOS_ENSEMBLE_SCALAR_TYPE 189 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( Promote, Promote, kokkos_mp_type )
193 Teuchos::GlobalMPISession mpiSession(&argc, &
argv);
194 return Teuchos::UnitTestRepository::runUnitTestsFromMain(argc,
argv);
Stokhos::StandardStorage< int, double > storage_type
Statically allocated storage class.
SparseArrayIterator< index_iterator, value_iterator >::value_reference value(const SparseArrayIterator< index_iterator, value_iterator > &it)