]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add tests for number traits classes: Adol-C
authorJean-Paul Pelteret <jppelteret@gmail.com>
Fri, 3 Nov 2017 19:15:24 +0000 (20:15 +0100)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Thu, 16 Nov 2017 05:30:48 +0000 (06:30 +0100)
tests/adolc/ad_number_traits_01.cc [new file with mode: 0644]
tests/adolc/ad_number_traits_01.output [new file with mode: 0644]
tests/adolc/ad_number_traits_02a.cc [new file with mode: 0644]
tests/adolc/ad_number_traits_02a.output [new file with mode: 0644]
tests/adolc/ad_number_traits_02b.cc [new file with mode: 0644]
tests/adolc/ad_number_traits_02b.output [new file with mode: 0644]
tests/adolc/ad_number_traits_03.cc [new file with mode: 0644]
tests/adolc/ad_number_traits_03.output [new file with mode: 0644]

diff --git a/tests/adolc/ad_number_traits_01.cc b/tests/adolc/ad_number_traits_01.cc
new file mode 100644 (file)
index 0000000..a3af4fd
--- /dev/null
@@ -0,0 +1,59 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2016 - 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// Test that all of the Adol-C number traits combinations are constructible
+
+#include "../tests.h"
+#include <deal.II/differentiation/ad/ad_number_types.h>
+#include <deal.II/differentiation/ad/adolc_number_types.h>
+
+#include <complex>
+#include <fstream>
+#include <iomanip>
+
+using namespace dealii;
+namespace AD = Differentiation::AD;
+
+int main ()
+{
+  initlog();
+
+  // --- Taped ---
+  AD::NumberTraits<float,AD::NumberTypes::adolc_taped>();
+  AD::NumberTraits<std::complex<float>,AD::NumberTypes::adolc_taped>();
+  AD::NumberTraits<double,AD::NumberTypes::adolc_taped>();
+  AD::NumberTraits<std::complex<double>,AD::NumberTypes::adolc_taped>();
+
+  AD::ADNumberTraits<adouble>();
+  AD::ADNumberTraits<std::complex<adouble> >();
+  AD::NumberTraits<adouble,AD::NumberTypes::adolc_taped>();
+  AD::NumberTraits<std::complex<adouble>,AD::NumberTypes::adolc_taped>();
+  deallog << "Taped OK" << std::endl;
+
+  // --- Tapeless ---
+  AD::NumberTraits<float,AD::NumberTypes::adolc_tapeless>();
+  AD::NumberTraits<std::complex<float>,AD::NumberTypes::adolc_tapeless>();
+  AD::NumberTraits<double,AD::NumberTypes::adolc_tapeless>();
+  AD::NumberTraits<std::complex<double>,AD::NumberTypes::adolc_tapeless>();
+
+  AD::ADNumberTraits<adtl::adouble>();
+  AD::ADNumberTraits<std::complex<adtl::adouble> >();
+  AD::NumberTraits<adtl::adouble,AD::NumberTypes::adolc_tapeless>();
+  AD::NumberTraits<std::complex<adtl::adouble>,AD::NumberTypes::adolc_tapeless>();
+  deallog << "Tapeless OK" << std::endl;
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/adolc/ad_number_traits_01.output b/tests/adolc/ad_number_traits_01.output
new file mode 100644 (file)
index 0000000..3114cf7
--- /dev/null
@@ -0,0 +1,4 @@
+
+DEAL::Taped OK
+DEAL::Tapeless OK
+DEAL::OK
diff --git a/tests/adolc/ad_number_traits_02a.cc b/tests/adolc/ad_number_traits_02a.cc
new file mode 100644 (file)
index 0000000..9028c81
--- /dev/null
@@ -0,0 +1,98 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2016 - 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// Test that all of the Adol-C number traits return the correct information
+// ::adouble (Taped)
+
+#include "../tests.h"
+#include <deal.II/differentiation/ad/ad_number_types.h>
+#include <deal.II/differentiation/ad/adolc_number_types.h>
+
+#include <complex>
+#include <fstream>
+#include <iomanip>
+#include <type_traits>
+
+using namespace dealii;
+namespace AD = Differentiation::AD;
+
+template<typename NumberTraitsType>
+void print_info ()
+{
+  deallog
+      << "type_code: "
+      << static_cast<std::underlying_type<AD::NumberTypes>::type>(NumberTraitsType::type_code)
+      << std::endl;
+  deallog << "is_taped: " << NumberTraitsType::is_taped << std::endl;
+  deallog << "is_tapeless: " << NumberTraitsType::is_tapeless << std::endl;
+  deallog << "is_real_valued: " << NumberTraitsType::is_real_valued << std::endl;
+  deallog << "is_complex_valued: " << NumberTraitsType::is_complex_valued << std::endl;
+  deallog << "n_supported_derivative_levels: " << NumberTraitsType::n_supported_derivative_levels << std::endl;
+
+  deallog << "is_ad_number: " << AD::is_ad_number<typename NumberTraitsType::ad_type>::value << std::endl;
+  deallog << "is_adolc_number: " << AD::is_adolc_number<typename NumberTraitsType::ad_type>::value << std::endl;
+  deallog << "is_taped_ad_number: " << AD::is_taped_ad_number<typename NumberTraitsType::ad_type>::value << std::endl;
+  deallog << "is_tapeless_ad_number: " << AD::is_tapeless_ad_number<typename NumberTraitsType::ad_type>::value << std::endl;
+}
+
+int main ()
+{
+  initlog();
+
+  deallog.push("NumberTraits");
+
+  deallog.push("float");
+  print_info<AD::NumberTraits<float,AD::NumberTypes::adolc_taped> >();
+  deallog.pop();
+
+  deallog.push("std::complex<float>");
+  print_info<AD::NumberTraits<std::complex<float>,AD::NumberTypes::adolc_taped> >();
+  deallog.pop();
+
+  deallog.push("double");
+  print_info<AD::NumberTraits<double,AD::NumberTypes::adolc_taped> >();
+  deallog.pop();
+
+  deallog.push("std::complex<double>");
+  print_info<AD::NumberTraits<std::complex<double>,AD::NumberTypes::adolc_taped> >();
+  deallog.pop();
+
+  deallog.push("adouble");
+  print_info<AD::NumberTraits<adouble,AD::NumberTypes::adolc_taped> >();
+  deallog.pop();
+
+  deallog.push("std::complex<adouble>");
+  print_info<AD::NumberTraits<std::complex<adouble>,AD::NumberTypes::adolc_taped> >();
+  deallog.pop();
+
+  deallog.pop(); // NumberTraits
+
+  deallog << std::endl;
+
+  deallog.push("ADNumberTraits");
+
+  deallog.push("adouble");
+  print_info<AD::ADNumberTraits<adouble> >();
+  deallog.pop();
+
+  deallog.push("std::complex<adouble>");
+  print_info<AD::ADNumberTraits<std::complex<adouble> > >();
+  deallog.pop();
+
+  deallog.pop(); // ADNumberTraits
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/adolc/ad_number_traits_02a.output b/tests/adolc/ad_number_traits_02a.output
new file mode 100644 (file)
index 0000000..6220be7
--- /dev/null
@@ -0,0 +1,83 @@
+
+DEAL:NumberTraits:float::type_code: 0
+DEAL:NumberTraits:float::is_taped: 1
+DEAL:NumberTraits:float::is_tapeless: 0
+DEAL:NumberTraits:float::is_real_valued: 1
+DEAL:NumberTraits:float::is_complex_valued: 0
+DEAL:NumberTraits:float::n_supported_derivative_levels: 4294967295
+DEAL:NumberTraits:float::is_ad_number: 1
+DEAL:NumberTraits:float::is_adolc_number: 1
+DEAL:NumberTraits:float::is_taped_ad_number: 1
+DEAL:NumberTraits:float::is_tapeless_ad_number: 0
+DEAL:NumberTraits:std::complex<float>::type_code: 0
+DEAL:NumberTraits:std::complex<float>::is_taped: 1
+DEAL:NumberTraits:std::complex<float>::is_tapeless: 0
+DEAL:NumberTraits:std::complex<float>::is_real_valued: 0
+DEAL:NumberTraits:std::complex<float>::is_complex_valued: 1
+DEAL:NumberTraits:std::complex<float>::n_supported_derivative_levels: 4294967295
+DEAL:NumberTraits:std::complex<float>::is_ad_number: 1
+DEAL:NumberTraits:std::complex<float>::is_adolc_number: 1
+DEAL:NumberTraits:std::complex<float>::is_taped_ad_number: 1
+DEAL:NumberTraits:std::complex<float>::is_tapeless_ad_number: 0
+DEAL:NumberTraits:double::type_code: 0
+DEAL:NumberTraits:double::is_taped: 1
+DEAL:NumberTraits:double::is_tapeless: 0
+DEAL:NumberTraits:double::is_real_valued: 1
+DEAL:NumberTraits:double::is_complex_valued: 0
+DEAL:NumberTraits:double::n_supported_derivative_levels: 4294967295
+DEAL:NumberTraits:double::is_ad_number: 1
+DEAL:NumberTraits:double::is_adolc_number: 1
+DEAL:NumberTraits:double::is_taped_ad_number: 1
+DEAL:NumberTraits:double::is_tapeless_ad_number: 0
+DEAL:NumberTraits:std::complex<double>::type_code: 0
+DEAL:NumberTraits:std::complex<double>::is_taped: 1
+DEAL:NumberTraits:std::complex<double>::is_tapeless: 0
+DEAL:NumberTraits:std::complex<double>::is_real_valued: 0
+DEAL:NumberTraits:std::complex<double>::is_complex_valued: 1
+DEAL:NumberTraits:std::complex<double>::n_supported_derivative_levels: 4294967295
+DEAL:NumberTraits:std::complex<double>::is_ad_number: 1
+DEAL:NumberTraits:std::complex<double>::is_adolc_number: 1
+DEAL:NumberTraits:std::complex<double>::is_taped_ad_number: 1
+DEAL:NumberTraits:std::complex<double>::is_tapeless_ad_number: 0
+DEAL:NumberTraits:adouble::type_code: 0
+DEAL:NumberTraits:adouble::is_taped: 1
+DEAL:NumberTraits:adouble::is_tapeless: 0
+DEAL:NumberTraits:adouble::is_real_valued: 1
+DEAL:NumberTraits:adouble::is_complex_valued: 0
+DEAL:NumberTraits:adouble::n_supported_derivative_levels: 4294967295
+DEAL:NumberTraits:adouble::is_ad_number: 1
+DEAL:NumberTraits:adouble::is_adolc_number: 1
+DEAL:NumberTraits:adouble::is_taped_ad_number: 1
+DEAL:NumberTraits:adouble::is_tapeless_ad_number: 0
+DEAL:NumberTraits:std::complex<adouble>::type_code: 0
+DEAL:NumberTraits:std::complex<adouble>::is_taped: 1
+DEAL:NumberTraits:std::complex<adouble>::is_tapeless: 0
+DEAL:NumberTraits:std::complex<adouble>::is_real_valued: 0
+DEAL:NumberTraits:std::complex<adouble>::is_complex_valued: 1
+DEAL:NumberTraits:std::complex<adouble>::n_supported_derivative_levels: 4294967295
+DEAL:NumberTraits:std::complex<adouble>::is_ad_number: 1
+DEAL:NumberTraits:std::complex<adouble>::is_adolc_number: 1
+DEAL:NumberTraits:std::complex<adouble>::is_taped_ad_number: 1
+DEAL:NumberTraits:std::complex<adouble>::is_tapeless_ad_number: 0
+DEAL::
+DEAL:ADNumberTraits:adouble::type_code: 0
+DEAL:ADNumberTraits:adouble::is_taped: 1
+DEAL:ADNumberTraits:adouble::is_tapeless: 0
+DEAL:ADNumberTraits:adouble::is_real_valued: 1
+DEAL:ADNumberTraits:adouble::is_complex_valued: 0
+DEAL:ADNumberTraits:adouble::n_supported_derivative_levels: 4294967295
+DEAL:ADNumberTraits:adouble::is_ad_number: 1
+DEAL:ADNumberTraits:adouble::is_adolc_number: 1
+DEAL:ADNumberTraits:adouble::is_taped_ad_number: 1
+DEAL:ADNumberTraits:adouble::is_tapeless_ad_number: 0
+DEAL:ADNumberTraits:std::complex<adouble>::type_code: 0
+DEAL:ADNumberTraits:std::complex<adouble>::is_taped: 1
+DEAL:ADNumberTraits:std::complex<adouble>::is_tapeless: 0
+DEAL:ADNumberTraits:std::complex<adouble>::is_real_valued: 0
+DEAL:ADNumberTraits:std::complex<adouble>::is_complex_valued: 1
+DEAL:ADNumberTraits:std::complex<adouble>::n_supported_derivative_levels: 4294967295
+DEAL:ADNumberTraits:std::complex<adouble>::is_ad_number: 1
+DEAL:ADNumberTraits:std::complex<adouble>::is_adolc_number: 1
+DEAL:ADNumberTraits:std::complex<adouble>::is_taped_ad_number: 1
+DEAL:ADNumberTraits:std::complex<adouble>::is_tapeless_ad_number: 0
+DEAL::OK
diff --git a/tests/adolc/ad_number_traits_02b.cc b/tests/adolc/ad_number_traits_02b.cc
new file mode 100644 (file)
index 0000000..73b251f
--- /dev/null
@@ -0,0 +1,98 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2016 - 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// Test that all of the Adol-C number traits return the correct information
+// adtl::adouble (Tapeless)
+
+#include "../tests.h"
+#include <deal.II/differentiation/ad/ad_number_types.h>
+#include <deal.II/differentiation/ad/adolc_number_types.h>
+
+#include <complex>
+#include <fstream>
+#include <iomanip>
+#include <type_traits>
+
+using namespace dealii;
+namespace AD = Differentiation::AD;
+
+template<typename NumberTraitsType>
+void print_info ()
+{
+  deallog
+      << "type_code: "
+      << static_cast<std::underlying_type<AD::NumberTypes>::type>(NumberTraitsType::type_code)
+      << std::endl;
+  deallog << "is_taped: " << NumberTraitsType::is_taped << std::endl;
+  deallog << "is_tapeless: " << NumberTraitsType::is_tapeless << std::endl;
+  deallog << "is_real_valued: " << NumberTraitsType::is_real_valued << std::endl;
+  deallog << "is_complex_valued: " << NumberTraitsType::is_complex_valued << std::endl;
+  deallog << "n_supported_derivative_levels: " << NumberTraitsType::n_supported_derivative_levels << std::endl;
+
+  deallog << "is_ad_number: " << AD::is_ad_number<typename NumberTraitsType::ad_type>::value << std::endl;
+  deallog << "is_adolc_number: " << AD::is_adolc_number<typename NumberTraitsType::ad_type>::value << std::endl;
+  deallog << "is_taped_ad_number: " << AD::is_taped_ad_number<typename NumberTraitsType::ad_type>::value << std::endl;
+  deallog << "is_tapeless_ad_number: " << AD::is_tapeless_ad_number<typename NumberTraitsType::ad_type>::value << std::endl;
+}
+
+int main ()
+{
+  initlog();
+
+  deallog.push("NumberTraits");
+
+  deallog.push("float");
+  print_info<AD::NumberTraits<float,AD::NumberTypes::adolc_tapeless> >();
+  deallog.pop();
+
+  deallog.push("std::complex<float>");
+  print_info<AD::NumberTraits<std::complex<float>,AD::NumberTypes::adolc_tapeless> >();
+  deallog.pop();
+
+  deallog.push("double");
+  print_info<AD::NumberTraits<double,AD::NumberTypes::adolc_tapeless> >();
+  deallog.pop();
+
+  deallog.push("std::complex<double>");
+  print_info<AD::NumberTraits<std::complex<double>,AD::NumberTypes::adolc_tapeless> >();
+  deallog.pop();
+
+  deallog.push("adouble");
+  print_info<AD::NumberTraits<adtl::adouble,AD::NumberTypes::adolc_tapeless> >();
+  deallog.pop();
+
+  deallog.push("std::complex<adouble>");
+  print_info<AD::NumberTraits<std::complex<adtl::adouble>,AD::NumberTypes::adolc_tapeless> >();
+  deallog.pop();
+
+  deallog.pop(); // NumberTraits
+
+  deallog << std::endl;
+
+  deallog.push("ADNumberTraits");
+
+  deallog.push("adtl::adouble");
+  print_info<AD::ADNumberTraits<adtl::adouble> >();
+  deallog.pop();
+
+  deallog.push("std::complex<adtl::adouble>");
+  print_info<AD::ADNumberTraits<std::complex<adtl::adouble> > >();
+  deallog.pop();
+
+  deallog.pop(); // ADNumberTraits
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/adolc/ad_number_traits_02b.output b/tests/adolc/ad_number_traits_02b.output
new file mode 100644 (file)
index 0000000..318322e
--- /dev/null
@@ -0,0 +1,83 @@
+
+DEAL:NumberTraits:float::type_code: 1
+DEAL:NumberTraits:float::is_taped: 0
+DEAL:NumberTraits:float::is_tapeless: 1
+DEAL:NumberTraits:float::is_real_valued: 1
+DEAL:NumberTraits:float::is_complex_valued: 0
+DEAL:NumberTraits:float::n_supported_derivative_levels: 1
+DEAL:NumberTraits:float::is_ad_number: 1
+DEAL:NumberTraits:float::is_adolc_number: 1
+DEAL:NumberTraits:float::is_taped_ad_number: 0
+DEAL:NumberTraits:float::is_tapeless_ad_number: 1
+DEAL:NumberTraits:std::complex<float>::type_code: 1
+DEAL:NumberTraits:std::complex<float>::is_taped: 0
+DEAL:NumberTraits:std::complex<float>::is_tapeless: 1
+DEAL:NumberTraits:std::complex<float>::is_real_valued: 0
+DEAL:NumberTraits:std::complex<float>::is_complex_valued: 1
+DEAL:NumberTraits:std::complex<float>::n_supported_derivative_levels: 1
+DEAL:NumberTraits:std::complex<float>::is_ad_number: 1
+DEAL:NumberTraits:std::complex<float>::is_adolc_number: 1
+DEAL:NumberTraits:std::complex<float>::is_taped_ad_number: 0
+DEAL:NumberTraits:std::complex<float>::is_tapeless_ad_number: 1
+DEAL:NumberTraits:double::type_code: 1
+DEAL:NumberTraits:double::is_taped: 0
+DEAL:NumberTraits:double::is_tapeless: 1
+DEAL:NumberTraits:double::is_real_valued: 1
+DEAL:NumberTraits:double::is_complex_valued: 0
+DEAL:NumberTraits:double::n_supported_derivative_levels: 1
+DEAL:NumberTraits:double::is_ad_number: 1
+DEAL:NumberTraits:double::is_adolc_number: 1
+DEAL:NumberTraits:double::is_taped_ad_number: 0
+DEAL:NumberTraits:double::is_tapeless_ad_number: 1
+DEAL:NumberTraits:std::complex<double>::type_code: 1
+DEAL:NumberTraits:std::complex<double>::is_taped: 0
+DEAL:NumberTraits:std::complex<double>::is_tapeless: 1
+DEAL:NumberTraits:std::complex<double>::is_real_valued: 0
+DEAL:NumberTraits:std::complex<double>::is_complex_valued: 1
+DEAL:NumberTraits:std::complex<double>::n_supported_derivative_levels: 1
+DEAL:NumberTraits:std::complex<double>::is_ad_number: 1
+DEAL:NumberTraits:std::complex<double>::is_adolc_number: 1
+DEAL:NumberTraits:std::complex<double>::is_taped_ad_number: 0
+DEAL:NumberTraits:std::complex<double>::is_tapeless_ad_number: 1
+DEAL:NumberTraits:adouble::type_code: 1
+DEAL:NumberTraits:adouble::is_taped: 0
+DEAL:NumberTraits:adouble::is_tapeless: 1
+DEAL:NumberTraits:adouble::is_real_valued: 1
+DEAL:NumberTraits:adouble::is_complex_valued: 0
+DEAL:NumberTraits:adouble::n_supported_derivative_levels: 1
+DEAL:NumberTraits:adouble::is_ad_number: 1
+DEAL:NumberTraits:adouble::is_adolc_number: 1
+DEAL:NumberTraits:adouble::is_taped_ad_number: 0
+DEAL:NumberTraits:adouble::is_tapeless_ad_number: 1
+DEAL:NumberTraits:std::complex<adouble>::type_code: 1
+DEAL:NumberTraits:std::complex<adouble>::is_taped: 0
+DEAL:NumberTraits:std::complex<adouble>::is_tapeless: 1
+DEAL:NumberTraits:std::complex<adouble>::is_real_valued: 0
+DEAL:NumberTraits:std::complex<adouble>::is_complex_valued: 1
+DEAL:NumberTraits:std::complex<adouble>::n_supported_derivative_levels: 1
+DEAL:NumberTraits:std::complex<adouble>::is_ad_number: 1
+DEAL:NumberTraits:std::complex<adouble>::is_adolc_number: 1
+DEAL:NumberTraits:std::complex<adouble>::is_taped_ad_number: 0
+DEAL:NumberTraits:std::complex<adouble>::is_tapeless_ad_number: 1
+DEAL::
+DEAL:ADNumberTraits:adtl::adouble::type_code: 1
+DEAL:ADNumberTraits:adtl::adouble::is_taped: 0
+DEAL:ADNumberTraits:adtl::adouble::is_tapeless: 1
+DEAL:ADNumberTraits:adtl::adouble::is_real_valued: 1
+DEAL:ADNumberTraits:adtl::adouble::is_complex_valued: 0
+DEAL:ADNumberTraits:adtl::adouble::n_supported_derivative_levels: 1
+DEAL:ADNumberTraits:adtl::adouble::is_ad_number: 1
+DEAL:ADNumberTraits:adtl::adouble::is_adolc_number: 1
+DEAL:ADNumberTraits:adtl::adouble::is_taped_ad_number: 0
+DEAL:ADNumberTraits:adtl::adouble::is_tapeless_ad_number: 1
+DEAL:ADNumberTraits:std::complex<adtl::adouble>::type_code: 1
+DEAL:ADNumberTraits:std::complex<adtl::adouble>::is_taped: 0
+DEAL:ADNumberTraits:std::complex<adtl::adouble>::is_tapeless: 1
+DEAL:ADNumberTraits:std::complex<adtl::adouble>::is_real_valued: 0
+DEAL:ADNumberTraits:std::complex<adtl::adouble>::is_complex_valued: 1
+DEAL:ADNumberTraits:std::complex<adtl::adouble>::n_supported_derivative_levels: 1
+DEAL:ADNumberTraits:std::complex<adtl::adouble>::is_ad_number: 1
+DEAL:ADNumberTraits:std::complex<adtl::adouble>::is_adolc_number: 1
+DEAL:ADNumberTraits:std::complex<adtl::adouble>::is_taped_ad_number: 0
+DEAL:ADNumberTraits:std::complex<adtl::adouble>::is_tapeless_ad_number: 1
+DEAL::OK
diff --git a/tests/adolc/ad_number_traits_03.cc b/tests/adolc/ad_number_traits_03.cc
new file mode 100644 (file)
index 0000000..de3bb00
--- /dev/null
@@ -0,0 +1,80 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2016 - 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+// Test that all of the Adol-C number traits return the correct information
+
+#include "../tests.h"
+#include <deal.II/differentiation/ad.h>
+
+#include <complex>
+#include <fstream>
+#include <iomanip>
+#include <type_traits>
+
+using namespace dealii;
+namespace AD = Differentiation::AD;
+
+template <typename ADNumber>
+void print ()
+{
+  deallog << "is_ad_number: " << AD::is_ad_number<ADNumber>::value << std::endl;
+  deallog << "is_adolc_number: " << AD::is_adolc_number<ADNumber>::value << std::endl;
+  deallog << "is_taped_ad_number: " << AD::is_taped_ad_number<ADNumber>::value << std::endl;
+  deallog << "is_tapeless_ad_number: " << AD::is_tapeless_ad_number<ADNumber>::value << std::endl;
+
+  Assert(AD::is_ad_number<const ADNumber>::value == AD::is_ad_number<ADNumber>::value, ExcMessage("Error const"));
+  Assert(AD::is_adolc_number<const ADNumber>::value == AD::is_adolc_number<ADNumber>::value, ExcMessage("Error const"));
+  Assert(AD::is_taped_ad_number<const ADNumber>::value == AD::is_taped_ad_number<ADNumber>::value, ExcMessage("Error const"));
+  Assert(AD::is_tapeless_ad_number<const ADNumber>::value == AD::is_tapeless_ad_number<ADNumber>::value, ExcMessage("Error const"));
+
+  Assert(AD::is_ad_number<ADNumber &>::value == AD::is_ad_number<ADNumber>::value, ExcMessage("Error reference"));
+  Assert(AD::is_adolc_number<ADNumber &>::value == AD::is_adolc_number<ADNumber>::value, ExcMessage("Error reference"));
+  Assert(AD::is_taped_ad_number<ADNumber &>::value == AD::is_taped_ad_number<ADNumber>::value, ExcMessage("Error reference"));
+  Assert(AD::is_tapeless_ad_number<ADNumber &>::value == AD::is_tapeless_ad_number<ADNumber>::value, ExcMessage("Error reference"));
+
+  Assert(AD::is_ad_number<const ADNumber &>::value == AD::is_ad_number<ADNumber>::value, ExcMessage("Error const reference"));
+  Assert(AD::is_adolc_number<const ADNumber &>::value == AD::is_adolc_number<ADNumber>::value, ExcMessage("Error const reference"));
+  Assert(AD::is_taped_ad_number<const ADNumber &>::value == AD::is_taped_ad_number<ADNumber>::value, ExcMessage("Error const reference"));
+  Assert(AD::is_tapeless_ad_number<const ADNumber &>::value == AD::is_tapeless_ad_number<ADNumber>::value, ExcMessage("Error const reference"));
+
+  Assert(AD::is_ad_number<ADNumber&&>::value == AD::is_ad_number<ADNumber>::value, ExcMessage("Error rvalue"));
+  Assert(AD::is_adolc_number<ADNumber&&>::value == AD::is_adolc_number<ADNumber>::value, ExcMessage("Error rvalue"));
+  Assert(AD::is_taped_ad_number<ADNumber&&>::value == AD::is_taped_ad_number<ADNumber>::value, ExcMessage("Error rvalue"));
+  Assert(AD::is_tapeless_ad_number<ADNumber&&>::value == AD::is_tapeless_ad_number<ADNumber>::value, ExcMessage("Error rvalue"));
+}
+
+int main ()
+{
+  initlog();
+
+  deallog.push("adouble");
+  print<::adouble>();
+  deallog.pop();
+
+  deallog.push("std::complex<::adouble>");
+  print<std::complex<::adouble>>();
+  deallog.pop();
+
+  deallog.push("adtl::adouble");
+  print<adtl::adouble>();
+  deallog.pop();
+
+  deallog.push("std::complex<adtl::adouble>");
+  print<std::complex<adtl::adouble>>();
+  deallog.pop();
+
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/adolc/ad_number_traits_03.output b/tests/adolc/ad_number_traits_03.output
new file mode 100644 (file)
index 0000000..c974541
--- /dev/null
@@ -0,0 +1,18 @@
+
+DEAL:adouble::is_ad_number: 1
+DEAL:adouble::is_adolc_number: 1
+DEAL:adouble::is_taped_ad_number: 1
+DEAL:adouble::is_tapeless_ad_number: 0
+DEAL:std::complex<::adouble>::is_ad_number: 1
+DEAL:std::complex<::adouble>::is_adolc_number: 1
+DEAL:std::complex<::adouble>::is_taped_ad_number: 1
+DEAL:std::complex<::adouble>::is_tapeless_ad_number: 0
+DEAL:adtl::adouble::is_ad_number: 1
+DEAL:adtl::adouble::is_adolc_number: 1
+DEAL:adtl::adouble::is_taped_ad_number: 0
+DEAL:adtl::adouble::is_tapeless_ad_number: 1
+DEAL:std::complex<adtl::adouble>::is_ad_number: 1
+DEAL:std::complex<adtl::adouble>::is_adolc_number: 1
+DEAL:std::complex<adtl::adouble>::is_taped_ad_number: 0
+DEAL:std::complex<adtl::adouble>::is_tapeless_ad_number: 1
+DEAL::OK

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.