16 #ifndef dealii_differentiation_ad_ad_drivers_h
17 #define dealii_differentiation_ad_ad_drivers_h
30 #ifdef DEAL_II_WITH_ADOLC
33 # include <adolc/internal/usrparms.h>
36 #endif // DEAL_II_WITH_ADOLC
59 "This function is called in a class that is expected to be specialized "
60 "for auto-differentiable numbers.");
67 "This function is only available if deal.II is compiled with ADOL-C.");
81 <<
"The number of derivative levels that this auto-differentiable number type supports is "
83 <<
", but to perform the intended operation the number must support at least "
84 << arg2 <<
" levels.");
93 template <
typename ADNumberType,
typename T =
void>
112 template <
typename ADNumberType,
typename T =
void>
128 std::numeric_limits<typename Types<ADNumberType>::tape_index>
::max();
149 template <
typename ADNumberType,
typename ScalarType,
typename T =
void>
253 const bool write_tapes_to_file);
258 std::vector<typename Types<ADNumberType>::tape_index>
368 reset(
const bool clear_registered_tapes);
379 print(std::ostream &stream)
const;
391 std::ostream & stream)
const;
412 const std::vector<ScalarType> &independent_variables)
const;
429 const std::vector<ScalarType> &independent_variables,
430 Vector<ScalarType> &
gradient)
const;
447 const std::vector<ScalarType> &independent_variables,
471 const unsigned int n_dependent_variables,
472 const std::vector<ScalarType> &independent_variables,
473 Vector<ScalarType> &
values)
const;
495 const unsigned int n_dependent_variables,
496 const std::vector<ScalarType> &independent_variables,
521 template <
typename ADNumberType,
typename ScalarType,
typename T =
void>
597 value(
const std::vector<ADNumberType> &dependent_variables)
const;
613 gradient(
const std::vector<ADNumberType> &independent_variables,
614 const std::vector<ADNumberType> &dependent_variables,
615 Vector<ScalarType> &
gradient)
const;
631 hessian(
const std::vector<ADNumberType> &independent_variables,
632 const std::vector<ADNumberType> &dependent_variables,
652 values(
const std::vector<ADNumberType> &dependent_variables,
653 Vector<ScalarType> &
values)
const;
673 jacobian(
const std::vector<ADNumberType> &independent_variables,
674 const std::vector<ADNumberType> &dependent_variables,
694 # ifdef DEAL_II_WITH_ADOLC
699 template <
typename ADNumberType>
702 typename std::enable_if<ADNumberTraits<ADNumberType>::type_code ==
703 NumberTypes::adolc_taped>::type>
721 template <
typename ADNumberType>
724 typename std::enable_if<ADNumberTraits<ADNumberType>::type_code ==
725 NumberTypes::adolc_taped>::type>
768 template <
typename ADNumberType>
772 typename std::enable_if<ADNumberTraits<ADNumberType>::type_code ==
773 NumberTypes::adolc_taped>::type>
815 const bool write_tapes_to_file);
817 std::vector<typename Types<ADNumberType>::tape_index>
834 reset(
const bool clear_registered_tapes);
837 print(std::ostream &stream)
const;
842 std::ostream & stream)
const;
853 const std::vector<scalar_type> &independent_variables)
const;
857 const std::vector<scalar_type> &independent_variables,
858 Vector<scalar_type> &
gradient)
const;
862 const std::vector<scalar_type> &independent_variables,
874 const unsigned int n_dependent_variables,
875 const std::vector<scalar_type> &independent_variables,
876 Vector<scalar_type> &
values)
const;
880 const unsigned int n_dependent_variables,
881 const std::vector<scalar_type> &independent_variables,
905 bool is_recording_flag;
934 mutable std::map<typename Types<ADNumberType>::tape_index,
int> status;
942 bool use_stored_taped_buffer_sizes;
975 template <
typename ADNumberType>
979 typename std::enable_if<ADNumberTraits<ADNumberType>::type_code ==
980 NumberTypes::adolc_taped>::type>
1015 std::vector<typename Types<ADNumberType>::tape_index>
1034 print(std::ostream &stream)
const;
1038 std::ostream &)
const;
1049 const std::vector<scalar_type> &)
const;
1053 const std::vector<scalar_type> &,
1054 Vector<scalar_type> &)
const;
1058 const std::vector<scalar_type> &,
1071 const std::vector<scalar_type> &,
1072 Vector<scalar_type> &)
const;
1077 const std::vector<scalar_type> &,
1083 # endif // DEAL_II_WITH_ADOLC
1093 template <
typename ADNumberType>
1094 struct TapedDrivers<
1097 typename std::enable_if<ADNumberTraits<ADNumberType>::type_code ==
1098 NumberTypes::adolc_taped>::type>
1134 const bool write_tapes_to_file);
1136 std::vector<typename Types<ADNumberType>::tape_index>
1153 reset(
const bool clear_registered_tapes);
1156 print(std::ostream &stream)
const;
1161 std::ostream & stream)
const;
1172 const std::vector<scalar_type> &independent_variables)
const;
1176 const std::vector<scalar_type> &independent_variables,
1177 Vector<scalar_type> &
gradient)
const;
1181 const std::vector<scalar_type> &independent_variables,
1193 const unsigned int n_dependent_variables,
1194 const std::vector<scalar_type> &independent_variables,
1195 Vector<scalar_type> &
values)
const;
1199 const unsigned int n_dependent_variables,
1200 const std::vector<scalar_type> &independent_variables,
1210 vector_float_to_double(
const std::vector<float> &in)
const;
1215 TapedDrivers<ADNumberType, double> taped_driver;
1227 template <
typename ADNumberType,
typename ScalarType>
1228 struct TapelessDrivers<
1231 typename std::enable_if<ADNumberTraits<ADNumberType>::type_code ==
1232 NumberTypes::sacado_rad ||
1233 ADNumberTraits<ADNumberType>::type_code ==
1234 NumberTypes::sacado_rad_dfad>::type>
1273 value(
const std::vector<ADNumberType> &dependent_variables)
const;
1276 gradient(
const std::vector<ADNumberType> &independent_variables,
1277 const std::vector<ADNumberType> &dependent_variables,
1278 Vector<ScalarType> &
gradient)
const;
1281 hessian(
const std::vector<ADNumberType> &independent_variables,
1282 const std::vector<ADNumberType> &dependent_variables,
1293 values(
const std::vector<ADNumberType> &dependent_variables,
1294 Vector<ScalarType> &
values)
const;
1297 jacobian(
const std::vector<ADNumberType> &independent_variables,
1298 const std::vector<ADNumberType> &dependent_variables,
1308 bool dependent_variable_marking_safe;
1317 template <
typename ADNumberType,
typename ScalarType>
1318 struct TapelessDrivers<
1321 typename std::enable_if<ADNumberTraits<ADNumberType>::type_code ==
1322 NumberTypes::adolc_tapeless ||
1323 ADNumberTraits<ADNumberType>::type_code ==
1324 NumberTypes::sacado_dfad ||
1325 ADNumberTraits<ADNumberType>::type_code ==
1326 NumberTypes::sacado_dfad_dfad>::type>
1365 value(
const std::vector<ADNumberType> &dependent_variables)
const;
1368 gradient(
const std::vector<ADNumberType> &independent_variables,
1369 const std::vector<ADNumberType> &dependent_variables,
1370 Vector<ScalarType> &
gradient)
const;
1373 hessian(
const std::vector<ADNumberType> &independent_variables,
1374 const std::vector<ADNumberType> &dependent_variables,
1385 values(
const std::vector<ADNumberType> &dependent_variables,
1386 Vector<ScalarType> &
values)
const;
1389 jacobian(
const std::vector<ADNumberType> &independent_variables,
1390 const std::vector<ADNumberType> &dependent_variables,
1400 bool dependent_variable_marking_safe;