From 64e0d819928e897d549c093ff3aacf75975289c8 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Fri, 3 Nov 2017 20:15:41 +0100 Subject: [PATCH] Add tests for number traits classes: Sacado --- tests/sacado/ad_number_traits_01.cc | 108 +++++++++++++++ tests/sacado/ad_number_traits_01.output | 6 + tests/sacado/ad_number_traits_02a.cc | 114 ++++++++++++++++ tests/sacado/ad_number_traits_02a.output | 123 +++++++++++++++++ tests/sacado/ad_number_traits_02b.cc | 114 ++++++++++++++++ tests/sacado/ad_number_traits_02b.output | 123 +++++++++++++++++ tests/sacado/ad_number_traits_02c.cc | 124 +++++++++++++++++ tests/sacado/ad_number_traits_02c.output | 123 +++++++++++++++++ ...er_traits_02c.output.cmplx_rad_advar_error | 63 +++++++++ tests/sacado/ad_number_traits_02d.cc | 126 ++++++++++++++++++ tests/sacado/ad_number_traits_02d.output | 123 +++++++++++++++++ ...er_traits_02d.output.cmplx_rad_advar_error | 63 +++++++++ tests/sacado/ad_number_traits_03.cc | 125 +++++++++++++++++ tests/sacado/ad_number_traits_03.output | 16 +++ 14 files changed, 1351 insertions(+) create mode 100644 tests/sacado/ad_number_traits_01.cc create mode 100644 tests/sacado/ad_number_traits_01.output create mode 100644 tests/sacado/ad_number_traits_02a.cc create mode 100644 tests/sacado/ad_number_traits_02a.output create mode 100644 tests/sacado/ad_number_traits_02b.cc create mode 100644 tests/sacado/ad_number_traits_02b.output create mode 100644 tests/sacado/ad_number_traits_02c.cc create mode 100644 tests/sacado/ad_number_traits_02c.output create mode 100644 tests/sacado/ad_number_traits_02c.output.cmplx_rad_advar_error create mode 100644 tests/sacado/ad_number_traits_02d.cc create mode 100644 tests/sacado/ad_number_traits_02d.output create mode 100644 tests/sacado/ad_number_traits_02d.output.cmplx_rad_advar_error create mode 100644 tests/sacado/ad_number_traits_03.cc create mode 100644 tests/sacado/ad_number_traits_03.output diff --git a/tests/sacado/ad_number_traits_01.cc b/tests/sacado/ad_number_traits_01.cc new file mode 100644 index 0000000000..5e51651897 --- /dev/null +++ b/tests/sacado/ad_number_traits_01.cc @@ -0,0 +1,108 @@ +// --------------------------------------------------------------------- +// +// 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 Sacado number traits combinations are constructible + +#include "../tests.h" +#include +#include + +//# include + +#include +#include +#include + +using namespace dealii; +namespace AD = Differentiation::AD; + +int main () +{ + initlog(); + + // --- Sacado::Fad::DFad --- + AD::NumberTraits(); + AD::NumberTraits,AD::NumberTypes::sacado_dfad>(); + AD::NumberTraits(); + AD::NumberTraits,AD::NumberTypes::sacado_dfad>(); + + AD::ADNumberTraits >(); + AD::ADNumberTraits > >(); + AD::ADNumberTraits >(); + AD::ADNumberTraits > >(); + AD::NumberTraits,AD::NumberTypes::sacado_dfad>(); + AD::NumberTraits >,AD::NumberTypes::sacado_dfad>(); + AD::NumberTraits,AD::NumberTypes::sacado_dfad>(); + AD::NumberTraits >,AD::NumberTypes::sacado_dfad>(); + deallog << "Sacado::Fad::DFad OK" << std::endl; + + // --- Nested Sacado::Fad::DFad --- + AD::NumberTraits(); + AD::NumberTraits,AD::NumberTypes::sacado_dfad_dfad>(); + AD::NumberTraits(); + AD::NumberTraits,AD::NumberTypes::sacado_dfad_dfad>(); + + AD::ADNumberTraits > >(); + AD::ADNumberTraits > > >(); + AD::ADNumberTraits > >(); + AD::ADNumberTraits > > >(); + AD::NumberTraits >,AD::NumberTypes::sacado_dfad_dfad>(); + AD::NumberTraits > >,AD::NumberTypes::sacado_dfad_dfad>(); + AD::NumberTraits >,AD::NumberTypes::sacado_dfad_dfad>(); + AD::NumberTraits > >,AD::NumberTypes::sacado_dfad_dfad>(); + deallog << "Nested Sacado::Fad::DFad OK" << std::endl; + + // --- Sacado::Rad::ADvar --- + AD::NumberTraits(); + AD::NumberTraits(); + + AD::ADNumberTraits >(); + AD::ADNumberTraits >(); + AD::NumberTraits,AD::NumberTypes::sacado_rad>(); + AD::NumberTraits,AD::NumberTypes::sacado_rad>(); + +#ifdef DEAL_II_WITH_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + AD::NumberTraits,AD::NumberTypes::sacado_rad>(); + AD::NumberTraits,AD::NumberTypes::sacado_rad>(); + + AD::ADNumberTraits > >(); + AD::ADNumberTraits > >(); + AD::NumberTraits >,AD::NumberTypes::sacado_rad>(); + AD::NumberTraits >,AD::NumberTypes::sacado_rad>(); +#endif + deallog << "Sacado::Rad::ADvar OK" << std::endl; + + // --- Nested Sacado::Rad::ADvar --- + AD::NumberTraits(); + AD::NumberTraits(); + + AD::ADNumberTraits > >(); + AD::ADNumberTraits > >(); + AD::NumberTraits >,AD::NumberTypes::sacado_rad_dfad>(); + AD::NumberTraits >,AD::NumberTypes::sacado_rad_dfad>(); + +#ifdef DEAL_II_WITH_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + AD::NumberTraits >,AD::NumberTypes::sacado_rad_dfad>(); + AD::NumberTraits >,AD::NumberTypes::sacado_rad_dfad>(); + + AD::ADNumberTraits > > >(); + AD::ADNumberTraits > > >(); + AD::NumberTraits > >,AD::NumberTypes::sacado_rad_dfad>(); + AD::NumberTraits > >,AD::NumberTypes::sacado_rad_dfad>(); +#endif + deallog << "Sacado::Rad::ADvar OK" << std::endl; + deallog << "OK" << std::endl; +} diff --git a/tests/sacado/ad_number_traits_01.output b/tests/sacado/ad_number_traits_01.output new file mode 100644 index 0000000000..c05f031e89 --- /dev/null +++ b/tests/sacado/ad_number_traits_01.output @@ -0,0 +1,6 @@ + +DEAL::Sacado::Fad::DFad OK +DEAL::Nested Sacado::Fad::DFad OK +DEAL::Sacado::Rad::ADvar OK +DEAL::Sacado::Rad::ADvar OK +DEAL::OK diff --git a/tests/sacado/ad_number_traits_02a.cc b/tests/sacado/ad_number_traits_02a.cc new file mode 100644 index 0000000000..7230716267 --- /dev/null +++ b/tests/sacado/ad_number_traits_02a.cc @@ -0,0 +1,114 @@ +// --------------------------------------------------------------------- +// +// 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 Sacado number traits return the correct information +// Sacado::Fad::DFad + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include + +using namespace dealii; +namespace AD = Differentiation::AD; + +template +void print_info () +{ + deallog + << "type_code: " + << static_cast::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::value << std::endl; + deallog << "is_sacado_number: " << AD::is_sacado_number::value << std::endl; + deallog << "is_taped_ad_number: " << AD::is_taped_ad_number::value << std::endl; + deallog << "is_tapeless_ad_number: " << AD::is_tapeless_ad_number::value << std::endl; +} + +int main () +{ + initlog(); + + deallog.push("NumberTraits"); + + deallog.push("float"); + print_info >(); + deallog.pop(); + + deallog.push("std::complex"); + print_info,AD::NumberTypes::sacado_dfad> >(); + deallog.pop(); + + deallog.push("double"); + print_info >(); + deallog.pop(); + + deallog.push("std::complex"); + print_info,AD::NumberTypes::sacado_dfad> >(); + deallog.pop(); + + deallog.push("Sacado::Fad::DFad"); + print_info,AD::NumberTypes::sacado_dfad> >(); + deallog.pop(); + + deallog.push("std::complex< Sacado::Fad::DFad >"); + print_info >,AD::NumberTypes::sacado_dfad> >(); + deallog.pop(); + + deallog.push("Sacado::Fad::DFad"); + print_info,AD::NumberTypes::sacado_dfad> >(); + deallog.pop(); + + deallog.push("std::complex< Sacado::Fad::DFad >"); + print_info >,AD::NumberTypes::sacado_dfad> >(); + deallog.pop(); + + deallog.pop(); // NumberTraits + + deallog << std::endl; + + deallog.push("ADNumberTraits"); + + deallog.push("Sacado::Fad::DFad"); + print_info > >(); + deallog.pop(); + + deallog.push("std::complex< Sacado::Fad::DFad >"); + print_info > > >(); + deallog.pop(); + + deallog.push("Sacado::Fad::DFad"); + print_info > >(); + deallog.pop(); + + deallog.push("std::complex< Sacado::Fad::DFad >"); + print_info > > >(); + deallog.pop(); + + deallog.pop(); // ADNumberTraits + + deallog << "OK" << std::endl; +} diff --git a/tests/sacado/ad_number_traits_02a.output b/tests/sacado/ad_number_traits_02a.output new file mode 100644 index 0000000000..24e71362d0 --- /dev/null +++ b/tests/sacado/ad_number_traits_02a.output @@ -0,0 +1,123 @@ + +DEAL:NumberTraits:float::type_code: 2 +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_sacado_number: 1 +DEAL:NumberTraits:float::is_taped_ad_number: 0 +DEAL:NumberTraits:float::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex::type_code: 2 +DEAL:NumberTraits:std::complex::is_taped: 0 +DEAL:NumberTraits:std::complex::is_tapeless: 1 +DEAL:NumberTraits:std::complex::is_real_valued: 0 +DEAL:NumberTraits:std::complex::is_complex_valued: 1 +DEAL:NumberTraits:std::complex::n_supported_derivative_levels: 1 +DEAL:NumberTraits:std::complex::is_ad_number: 1 +DEAL:NumberTraits:std::complex::is_sacado_number: 1 +DEAL:NumberTraits:std::complex::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex::is_tapeless_ad_number: 1 +DEAL:NumberTraits:double::type_code: 2 +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_sacado_number: 1 +DEAL:NumberTraits:double::is_taped_ad_number: 0 +DEAL:NumberTraits:double::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex::type_code: 2 +DEAL:NumberTraits:std::complex::is_taped: 0 +DEAL:NumberTraits:std::complex::is_tapeless: 1 +DEAL:NumberTraits:std::complex::is_real_valued: 0 +DEAL:NumberTraits:std::complex::is_complex_valued: 1 +DEAL:NumberTraits:std::complex::n_supported_derivative_levels: 1 +DEAL:NumberTraits:std::complex::is_ad_number: 1 +DEAL:NumberTraits:std::complex::is_sacado_number: 1 +DEAL:NumberTraits:std::complex::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::type_code: 2 +DEAL:NumberTraits:Sacado::Fad::DFad::is_taped: 0 +DEAL:NumberTraits:Sacado::Fad::DFad::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Fad::DFad::n_supported_derivative_levels: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Fad::DFad::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::type_code: 2 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_taped: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_tapeless: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_real_valued: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_complex_valued: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::n_supported_derivative_levels: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_sacado_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::type_code: 2 +DEAL:NumberTraits:Sacado::Fad::DFad::is_taped: 0 +DEAL:NumberTraits:Sacado::Fad::DFad::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Fad::DFad::n_supported_derivative_levels: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Fad::DFad::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::type_code: 2 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_taped: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_tapeless: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_real_valued: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_complex_valued: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::n_supported_derivative_levels: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_sacado_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad >::is_tapeless_ad_number: 1 +DEAL:: +DEAL:ADNumberTraits:Sacado::Fad::DFad::type_code: 2 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad::n_supported_derivative_levels: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::type_code: 2 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_taped: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_tapeless: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_real_valued: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_complex_valued: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::n_supported_derivative_levels: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_sacado_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::type_code: 2 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad::n_supported_derivative_levels: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::type_code: 2 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_taped: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_tapeless: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_real_valued: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_complex_valued: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::n_supported_derivative_levels: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_sacado_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad >::is_tapeless_ad_number: 1 +DEAL::OK diff --git a/tests/sacado/ad_number_traits_02b.cc b/tests/sacado/ad_number_traits_02b.cc new file mode 100644 index 0000000000..46a2dca06d --- /dev/null +++ b/tests/sacado/ad_number_traits_02b.cc @@ -0,0 +1,114 @@ +// --------------------------------------------------------------------- +// +// 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 Sacado number traits return the correct information +// Nested Sacado::Fad::DFad + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include + +using namespace dealii; +namespace AD = Differentiation::AD; + +template +void print_info () +{ + deallog + << "type_code: " + << static_cast::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::value << std::endl; + deallog << "is_sacado_number: " << AD::is_sacado_number::value << std::endl; + deallog << "is_taped_ad_number: " << AD::is_taped_ad_number::value << std::endl; + deallog << "is_tapeless_ad_number: " << AD::is_tapeless_ad_number::value << std::endl; +} + +int main () +{ + initlog(); + + deallog.push("NumberTraits"); + + deallog.push("float"); + print_info >(); + deallog.pop(); + + deallog.push("std::complex"); + print_info,AD::NumberTypes::sacado_dfad_dfad> >(); + deallog.pop(); + + deallog.push("double"); + print_info >(); + deallog.pop(); + + deallog.push("std::complex"); + print_info,AD::NumberTypes::sacado_dfad_dfad> >(); + deallog.pop(); + + deallog.push("Sacado::Fad::DFad< Sacado::Fad::DFad >"); + print_info >,AD::NumberTypes::sacado_dfad_dfad> >(); + deallog.pop(); + + deallog.push("std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >"); + print_info > >,AD::NumberTypes::sacado_dfad_dfad> >(); + deallog.pop(); + + deallog.push("Sacado::Fad::DFad< Sacado::Fad::DFad >"); + print_info >,AD::NumberTypes::sacado_dfad_dfad> >(); + deallog.pop(); + + deallog.push("std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >"); + print_info > >,AD::NumberTypes::sacado_dfad_dfad> >(); + deallog.pop(); + + deallog.pop(); // NumberTraits + + deallog << std::endl; + + deallog.push("ADNumberTraits"); + + deallog.push("Sacado::Fad::DFad< Sacado::Fad::DFad >"); + print_info > > >(); + deallog.pop(); + + deallog.push("std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >"); + print_info > > > >(); + deallog.pop(); + + deallog.push("Sacado::Fad::DFad"); + print_info > > >(); + deallog.pop(); + + deallog.push("std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >"); + print_info > > > >(); + deallog.pop(); + + deallog.pop(); // ADNumberTraits + + deallog << "OK" << std::endl; +} diff --git a/tests/sacado/ad_number_traits_02b.output b/tests/sacado/ad_number_traits_02b.output new file mode 100644 index 0000000000..eeb61e71d0 --- /dev/null +++ b/tests/sacado/ad_number_traits_02b.output @@ -0,0 +1,123 @@ + +DEAL:NumberTraits:float::type_code: 3 +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: 2 +DEAL:NumberTraits:float::is_ad_number: 1 +DEAL:NumberTraits:float::is_sacado_number: 1 +DEAL:NumberTraits:float::is_taped_ad_number: 0 +DEAL:NumberTraits:float::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex::type_code: 3 +DEAL:NumberTraits:std::complex::is_taped: 0 +DEAL:NumberTraits:std::complex::is_tapeless: 1 +DEAL:NumberTraits:std::complex::is_real_valued: 0 +DEAL:NumberTraits:std::complex::is_complex_valued: 1 +DEAL:NumberTraits:std::complex::n_supported_derivative_levels: 2 +DEAL:NumberTraits:std::complex::is_ad_number: 1 +DEAL:NumberTraits:std::complex::is_sacado_number: 1 +DEAL:NumberTraits:std::complex::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex::is_tapeless_ad_number: 1 +DEAL:NumberTraits:double::type_code: 3 +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: 2 +DEAL:NumberTraits:double::is_ad_number: 1 +DEAL:NumberTraits:double::is_sacado_number: 1 +DEAL:NumberTraits:double::is_taped_ad_number: 0 +DEAL:NumberTraits:double::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex::type_code: 3 +DEAL:NumberTraits:std::complex::is_taped: 0 +DEAL:NumberTraits:std::complex::is_tapeless: 1 +DEAL:NumberTraits:std::complex::is_real_valued: 0 +DEAL:NumberTraits:std::complex::is_complex_valued: 1 +DEAL:NumberTraits:std::complex::n_supported_derivative_levels: 2 +DEAL:NumberTraits:std::complex::is_ad_number: 1 +DEAL:NumberTraits:std::complex::is_sacado_number: 1 +DEAL:NumberTraits:std::complex::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::type_code: 3 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_taped: 0 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::n_supported_derivative_levels: 2 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::type_code: 3 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_taped: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_tapeless: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_real_valued: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_complex_valued: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::n_supported_derivative_levels: 2 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_sacado_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::type_code: 3 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_taped: 0 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::n_supported_derivative_levels: 2 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::type_code: 3 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_taped: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_tapeless: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_real_valued: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_complex_valued: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::n_supported_derivative_levels: 2 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_sacado_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_tapeless_ad_number: 1 +DEAL:: +DEAL:ADNumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::type_code: 3 +DEAL:ADNumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::n_supported_derivative_levels: 2 +DEAL:ADNumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad< Sacado::Fad::DFad >::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::type_code: 3 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_taped: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_tapeless: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_real_valued: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_complex_valued: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::n_supported_derivative_levels: 2 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_sacado_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::type_code: 3 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad::n_supported_derivative_levels: 2 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Fad::DFad::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::type_code: 3 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_taped: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_tapeless: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_real_valued: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_complex_valued: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::n_supported_derivative_levels: 2 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_sacado_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Fad::DFad< Sacado::Fad::DFad > >::is_tapeless_ad_number: 1 +DEAL::OK diff --git a/tests/sacado/ad_number_traits_02c.cc b/tests/sacado/ad_number_traits_02c.cc new file mode 100644 index 0000000000..2027435333 --- /dev/null +++ b/tests/sacado/ad_number_traits_02c.cc @@ -0,0 +1,124 @@ +// --------------------------------------------------------------------- +// +// 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 Sacado number traits return the correct information +// Sacado::Rad::ADvar + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include + +using namespace dealii; +namespace AD = Differentiation::AD; + +template +void print_info () +{ + deallog + << "type_code: " + << static_cast::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::value << std::endl; + deallog << "is_sacado_number: " << AD::is_sacado_number::value << std::endl; + deallog << "is_taped_ad_number: " << AD::is_taped_ad_number::value << std::endl; + deallog << "is_tapeless_ad_number: " << AD::is_tapeless_ad_number::value << std::endl; +} + +int main () +{ + initlog(); + + deallog.push("NumberTraits"); + + deallog.push("float"); + print_info >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex"); + print_info,AD::NumberTypes::sacado_rad> >(); + deallog.pop(); +#endif + + deallog.push("double"); + print_info >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex"); + print_info,AD::NumberTypes::sacado_rad> >(); + deallog.pop(); +#endif + + deallog.push("Sacado::Rad::ADvar"); + print_info,AD::NumberTypes::sacado_rad> >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex< Sacado::Rad::ADvar >"); + print_info >,AD::NumberTypes::sacado_rad> >(); + deallog.pop(); +#endif + + deallog.push("Sacado::Rad::ADvar"); + print_info,AD::NumberTypes::sacado_rad> >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex< Sacado::Rad::ADvar >"); + print_info >,AD::NumberTypes::sacado_rad> >(); + deallog.pop(); +#endif + + deallog.pop(); // NumberTraits + deallog << std::endl; + deallog.push("ADNumberTraits"); + + deallog.push("Sacado::Rad::ADvar"); + print_info > >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex< Sacado::Rad::ADvar >"); + print_info > > >(); + deallog.pop(); +#endif + + deallog.push("Sacado::Rad::ADvar"); + print_info > >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex< Sacado::Rad::ADvar >"); + print_info > > >(); + deallog.pop(); +#endif + + deallog.pop(); // ADNumberTraits + + deallog << "OK" << std::endl; +} diff --git a/tests/sacado/ad_number_traits_02c.output b/tests/sacado/ad_number_traits_02c.output new file mode 100644 index 0000000000..2f05b28a7f --- /dev/null +++ b/tests/sacado/ad_number_traits_02c.output @@ -0,0 +1,123 @@ + +DEAL:NumberTraits:float::type_code: 4 +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_sacado_number: 1 +DEAL:NumberTraits:float::is_taped_ad_number: 0 +DEAL:NumberTraits:float::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex::type_code: 4 +DEAL:NumberTraits:std::complex::is_taped: 0 +DEAL:NumberTraits:std::complex::is_tapeless: 1 +DEAL:NumberTraits:std::complex::is_real_valued: 0 +DEAL:NumberTraits:std::complex::is_complex_valued: 1 +DEAL:NumberTraits:std::complex::n_supported_derivative_levels: 1 +DEAL:NumberTraits:std::complex::is_ad_number: 1 +DEAL:NumberTraits:std::complex::is_sacado_number: 1 +DEAL:NumberTraits:std::complex::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex::is_tapeless_ad_number: 1 +DEAL:NumberTraits:double::type_code: 4 +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_sacado_number: 1 +DEAL:NumberTraits:double::is_taped_ad_number: 0 +DEAL:NumberTraits:double::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex::type_code: 4 +DEAL:NumberTraits:std::complex::is_taped: 0 +DEAL:NumberTraits:std::complex::is_tapeless: 1 +DEAL:NumberTraits:std::complex::is_real_valued: 0 +DEAL:NumberTraits:std::complex::is_complex_valued: 1 +DEAL:NumberTraits:std::complex::n_supported_derivative_levels: 1 +DEAL:NumberTraits:std::complex::is_ad_number: 1 +DEAL:NumberTraits:std::complex::is_sacado_number: 1 +DEAL:NumberTraits:std::complex::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::type_code: 4 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_taped: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::n_supported_derivative_levels: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::type_code: 4 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_taped: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_real_valued: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_complex_valued: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::n_supported_derivative_levels: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::type_code: 4 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_taped: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::n_supported_derivative_levels: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::type_code: 4 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_taped: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_real_valued: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_complex_valued: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::n_supported_derivative_levels: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL:: +DEAL:ADNumberTraits:Sacado::Rad::ADvar::type_code: 4 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::n_supported_derivative_levels: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::type_code: 4 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_taped: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_real_valued: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_complex_valued: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::n_supported_derivative_levels: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::type_code: 4 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::n_supported_derivative_levels: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::type_code: 4 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_taped: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_real_valued: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_complex_valued: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::n_supported_derivative_levels: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL::OK diff --git a/tests/sacado/ad_number_traits_02c.output.cmplx_rad_advar_error b/tests/sacado/ad_number_traits_02c.output.cmplx_rad_advar_error new file mode 100644 index 0000000000..714b05562f --- /dev/null +++ b/tests/sacado/ad_number_traits_02c.output.cmplx_rad_advar_error @@ -0,0 +1,63 @@ + +DEAL:NumberTraits:float::type_code: 4 +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_sacado_number: 1 +DEAL:NumberTraits:float::is_taped_ad_number: 0 +DEAL:NumberTraits:float::is_tapeless_ad_number: 1 +DEAL:NumberTraits:double::type_code: 4 +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_sacado_number: 1 +DEAL:NumberTraits:double::is_taped_ad_number: 0 +DEAL:NumberTraits:double::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::type_code: 4 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_taped: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::n_supported_derivative_levels: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::type_code: 4 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_taped: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::n_supported_derivative_levels: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar::is_tapeless_ad_number: 1 +DEAL:: +DEAL:ADNumberTraits:Sacado::Rad::ADvar::type_code: 4 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::n_supported_derivative_levels: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::type_code: 4 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::n_supported_derivative_levels: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar::is_tapeless_ad_number: 1 +DEAL::OK diff --git a/tests/sacado/ad_number_traits_02d.cc b/tests/sacado/ad_number_traits_02d.cc new file mode 100644 index 0000000000..faa2af6382 --- /dev/null +++ b/tests/sacado/ad_number_traits_02d.cc @@ -0,0 +1,126 @@ +// --------------------------------------------------------------------- +// +// 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 Sacado number traits return the correct information +// Nested Sacado::Rad::ADvar + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include + +using namespace dealii; +namespace AD = Differentiation::AD; + +template +void print_info () +{ + deallog + << "type_code: " + << static_cast::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::value << std::endl; + deallog << "is_sacado_number: " << AD::is_sacado_number::value << std::endl; + deallog << "is_taped_ad_number: " << AD::is_taped_ad_number::value << std::endl; + deallog << "is_tapeless_ad_number: " << AD::is_tapeless_ad_number::value << std::endl; +} + +int main () +{ + initlog(); + + deallog.push("NumberTraits"); + + deallog.push("float"); + print_info >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex"); + print_info,AD::NumberTypes::sacado_rad_dfad> >(); + deallog.pop(); +#endif + + deallog.push("double"); + print_info >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex"); + print_info,AD::NumberTypes::sacado_rad_dfad> >(); + deallog.pop(); +#endif + + deallog.push("Sacado::Rad::ADvar >"); + print_info >,AD::NumberTypes::sacado_rad_dfad> >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex< Sacado::Rad::ADvar > >"); + print_info > >,AD::NumberTypes::sacado_rad_dfad> >(); + deallog.pop(); +#endif + + deallog.push("Sacado::Rad::ADvar >"); + print_info >,AD::NumberTypes::sacado_rad_dfad> >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex< Sacado::Rad::ADvar > >"); + print_info > >,AD::NumberTypes::sacado_rad_dfad> >(); + deallog.pop(); +#endif + + deallog.pop(); // NumberTraits + + deallog << std::endl; + + deallog.push("ADNumberTraits"); + + deallog.push("Sacado::Rad::ADvar >"); + print_info > > >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex< Sacado::Rad::ADvar > >"); + print_info > > > >(); + deallog.pop(); +#endif + + deallog.push("Sacado::Rad::ADvar >"); + print_info > > >(); + deallog.pop(); + +#ifdef DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD + deallog.push("std::complex< Sacado::Rad::ADvar > >"); + print_info > > > >(); + deallog.pop(); +#endif + + deallog.pop(); // ADNumberTraits + + deallog << "OK" << std::endl; +} diff --git a/tests/sacado/ad_number_traits_02d.output b/tests/sacado/ad_number_traits_02d.output new file mode 100644 index 0000000000..75fafd66fd --- /dev/null +++ b/tests/sacado/ad_number_traits_02d.output @@ -0,0 +1,123 @@ + +DEAL:NumberTraits:float::type_code: 5 +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: 2 +DEAL:NumberTraits:float::is_ad_number: 1 +DEAL:NumberTraits:float::is_sacado_number: 1 +DEAL:NumberTraits:float::is_taped_ad_number: 0 +DEAL:NumberTraits:float::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex::type_code: 5 +DEAL:NumberTraits:std::complex::is_taped: 0 +DEAL:NumberTraits:std::complex::is_tapeless: 1 +DEAL:NumberTraits:std::complex::is_real_valued: 0 +DEAL:NumberTraits:std::complex::is_complex_valued: 1 +DEAL:NumberTraits:std::complex::n_supported_derivative_levels: 2 +DEAL:NumberTraits:std::complex::is_ad_number: 1 +DEAL:NumberTraits:std::complex::is_sacado_number: 1 +DEAL:NumberTraits:std::complex::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex::is_tapeless_ad_number: 1 +DEAL:NumberTraits:double::type_code: 5 +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: 2 +DEAL:NumberTraits:double::is_ad_number: 1 +DEAL:NumberTraits:double::is_sacado_number: 1 +DEAL:NumberTraits:double::is_taped_ad_number: 0 +DEAL:NumberTraits:double::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex::type_code: 5 +DEAL:NumberTraits:std::complex::is_taped: 0 +DEAL:NumberTraits:std::complex::is_tapeless: 1 +DEAL:NumberTraits:std::complex::is_real_valued: 0 +DEAL:NumberTraits:std::complex::is_complex_valued: 1 +DEAL:NumberTraits:std::complex::n_supported_derivative_levels: 2 +DEAL:NumberTraits:std::complex::is_ad_number: 1 +DEAL:NumberTraits:std::complex::is_sacado_number: 1 +DEAL:NumberTraits:std::complex::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::type_code: 5 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_taped: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::n_supported_derivative_levels: 2 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::type_code: 5 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_taped: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_tapeless: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_real_valued: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_complex_valued: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::n_supported_derivative_levels: 2 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_sacado_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::type_code: 5 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_taped: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::n_supported_derivative_levels: 2 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::type_code: 5 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_taped: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_tapeless: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_real_valued: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_complex_valued: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::n_supported_derivative_levels: 2 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_ad_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_sacado_number: 1 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_taped_ad_number: 0 +DEAL:NumberTraits:std::complex< Sacado::Rad::ADvar > >::is_tapeless_ad_number: 1 +DEAL:: +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::type_code: 5 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::n_supported_derivative_levels: 2 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::type_code: 5 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_taped: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_tapeless: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_real_valued: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_complex_valued: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::n_supported_derivative_levels: 2 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_sacado_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::type_code: 5 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::n_supported_derivative_levels: 2 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::type_code: 5 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_taped: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_tapeless: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_real_valued: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_complex_valued: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::n_supported_derivative_levels: 2 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_ad_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_sacado_number: 1 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:std::complex< Sacado::Rad::ADvar > >::is_tapeless_ad_number: 1 +DEAL::OK diff --git a/tests/sacado/ad_number_traits_02d.output.cmplx_rad_advar_error b/tests/sacado/ad_number_traits_02d.output.cmplx_rad_advar_error new file mode 100644 index 0000000000..38016dbd17 --- /dev/null +++ b/tests/sacado/ad_number_traits_02d.output.cmplx_rad_advar_error @@ -0,0 +1,63 @@ + +DEAL:NumberTraits:float::type_code: 5 +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: 2 +DEAL:NumberTraits:float::is_ad_number: 1 +DEAL:NumberTraits:float::is_sacado_number: 1 +DEAL:NumberTraits:float::is_taped_ad_number: 0 +DEAL:NumberTraits:float::is_tapeless_ad_number: 1 +DEAL:NumberTraits:double::type_code: 5 +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: 2 +DEAL:NumberTraits:double::is_ad_number: 1 +DEAL:NumberTraits:double::is_sacado_number: 1 +DEAL:NumberTraits:double::is_taped_ad_number: 0 +DEAL:NumberTraits:double::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::type_code: 5 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_taped: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::n_supported_derivative_levels: 2 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::type_code: 5 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_taped: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_real_valued: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_complex_valued: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::n_supported_derivative_levels: 2 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:NumberTraits:Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL:: +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::type_code: 5 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::n_supported_derivative_levels: 2 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::type_code: 5 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_taped: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_tapeless: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_real_valued: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_complex_valued: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::n_supported_derivative_levels: 2 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_ad_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_sacado_number: 1 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_taped_ad_number: 0 +DEAL:ADNumberTraits:Sacado::Rad::ADvar >::is_tapeless_ad_number: 1 +DEAL::OK diff --git a/tests/sacado/ad_number_traits_03.cc b/tests/sacado/ad_number_traits_03.cc new file mode 100644 index 0000000000..25e1cccf9d --- /dev/null +++ b/tests/sacado/ad_number_traits_03.cc @@ -0,0 +1,125 @@ +// --------------------------------------------------------------------- +// +// 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 nested Sacado number extractors return the correct information + +#include "../tests.h" +#include +#include + +#include +#include +#include +#include + +using namespace dealii; +namespace AD = Differentiation::AD; + +template +Number func(const Number &a, const Number &b, const Number &c) +{ + const Number r = c*std::log(b+1.)/std::sin(a); + return r; +} + +template +void print(const Number &r, const Number &drda, const Number &drdb, + const Number &d2rda2, const Number &d2rdb2, + const Number &d2rdadb, const Number &d2rdbda) +{ + deallog + << " r = " << r + << std::endl + << " dr/da = " << drda + << std::endl + << " dr/db = " << drdb + << std::endl + << "d^2r/da^2 = " << d2rda2 + << std::endl + << "d^2r/db^2 = " << d2rdb2 + << std::endl + << "d^2r/dadb = " << d2rdadb + << std::endl + << "d^2r/dbda = " << d2rdbda + << std::endl; +} + +int main () +{ + initlog(); + + // Values of function arguments + const double a = M_PI/4; + const double b = 2.0; + const double c = 3.0; + + // Number of independent variables + const int num_deriv = 2; + + // Fad objects + Sacado::Fad::DFad< Sacado::Fad::DFad > afad(num_deriv, 0, a); + Sacado::Fad::DFad< Sacado::Fad::DFad > bfad(num_deriv, 1, b); + Sacado::Fad::DFad< Sacado::Fad::DFad > cfad = c; + + afad.val() = Sacado::Fad::DFad(num_deriv, 0, a); + bfad.val() = Sacado::Fad::DFad(num_deriv, 1, b); + + // AD typedefs + typedef Sacado::Fad::DFad< Sacado::Fad::DFad > ADNumberType; + typedef typename ADNumberType::value_type ADDerivativeType; + typedef typename ADNumberType::scalar_type ADScalarType; // == double + + // Compute function and derivative with AD + const ADNumberType rfad = func(afad, bfad, cfad); + + deallog.push("Native"); + { + // Extract value and derivatives + const double r = rfad.val().val(); // r + const double drda = rfad.dx(0).val(); // dr/da + const double drdb = rfad.dx(1).val(); // dr/db + const double d2rda2 = rfad.dx(0).dx(0); // d^2r/da^2 + const double d2rdadb = rfad.dx(0).dx(1); // d^2r/dadb + const double d2rdbda = rfad.dx(1).dx(0); // d^2r/dbda + const double d2rdb2 = rfad.dx(1).dx(1); // d^2/db^2 + + print(r,drda,drdb, + d2rda2,d2rdb2, + d2rdadb,d2rdbda); + } + deallog.pop(); + + deallog.push("Extracted"); + { + // Extract value and derivatives + const ADScalarType r = AD::internal::ExtractData::value(rfad); // r + const ADDerivativeType drda_ad = AD::internal::ExtractData::directional_derivative(rfad,0); + const ADDerivativeType drdb_ad = AD::internal::ExtractData::directional_derivative(rfad,1); + const ADScalarType drda = AD::internal::ExtractData::value(drda_ad); // dr/da + const ADScalarType drdb = AD::internal::ExtractData::value(drdb_ad); // dr/db + const ADScalarType d2rda2 = AD::internal::ExtractData::directional_derivative(drda_ad,0); // d^2r/da^2 + const ADScalarType d2rdadb = AD::internal::ExtractData::directional_derivative(drda_ad,1); // d^2r/dadb + const ADScalarType d2rdbda = AD::internal::ExtractData::directional_derivative(drdb_ad,0); // d^2r/dbda + const ADScalarType d2rdb2 = AD::internal::ExtractData::directional_derivative(drdb_ad,1); // d^2/db^2 + + print(r,drda,drdb, + d2rda2,d2rdb2, + d2rdadb,d2rdbda); + } + deallog.pop(); + + deallog << "OK" << std::endl; +} diff --git a/tests/sacado/ad_number_traits_03.output b/tests/sacado/ad_number_traits_03.output new file mode 100644 index 0000000000..ed0a90bcc6 --- /dev/null +++ b/tests/sacado/ad_number_traits_03.output @@ -0,0 +1,16 @@ + +DEAL:Native:: r = 4.66102 +DEAL:Native:: dr/da = -4.66102 +DEAL:Native:: dr/db = 1.41421 +DEAL:Native::d^2r/da^2 = 13.9831 +DEAL:Native::d^2r/db^2 = -0.471405 +DEAL:Native::d^2r/dadb = -1.41421 +DEAL:Native::d^2r/dbda = -1.41421 +DEAL:Extracted:: r = 4.66102 +DEAL:Extracted:: dr/da = -4.66102 +DEAL:Extracted:: dr/db = 1.41421 +DEAL:Extracted::d^2r/da^2 = 13.9831 +DEAL:Extracted::d^2r/db^2 = -0.471405 +DEAL:Extracted::d^2r/dadb = -1.41421 +DEAL:Extracted::d^2r/dbda = -1.41421 +DEAL::OK -- 2.39.5