From 99edea03f4e75fd72faf5a4d1b1286af9e3bc2e0 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Sat, 21 Jul 2018 16:41:04 +0200 Subject: [PATCH] Add AD number static asserts for FullMatrix and Vector classes. --- include/deal.II/lac/full_matrix.h | 8 ++++++++ include/deal.II/lac/vector.h | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/include/deal.II/lac/full_matrix.h b/include/deal.II/lac/full_matrix.h index fc2cb0f76a..77600face8 100644 --- a/include/deal.II/lac/full_matrix.h +++ b/include/deal.II/lac/full_matrix.h @@ -23,6 +23,8 @@ #include #include +#include + #include #include @@ -68,6 +70,12 @@ template class FullMatrix : public Table<2, number> { public: + // The assertion in full_matrix.templates.h for whether or not a number is + // finite is not compatible for AD number types. + static_assert( + !Differentiation::AD::is_ad_number::value, + "The FullMatrix class does not support auto-differentiable numbers."); + /** * A type of used to index into this container. */ diff --git a/include/deal.II/lac/vector.h b/include/deal.II/lac/vector.h index 13c67eeaaa..a6dfa1cdc9 100644 --- a/include/deal.II/lac/vector.h +++ b/include/deal.II/lac/vector.h @@ -24,6 +24,8 @@ #include #include +#include + #include #include @@ -108,6 +110,12 @@ template class Vector : public Subscriptor { public: + // The assertion in vector.templates.h for whether or not a number is + // finite is not compatible for AD number types. + static_assert( + !Differentiation::AD::is_ad_number::value, + "The Vector class does not support auto-differentiable numbers."); + /** * Declare standard types used in all containers. These types parallel those * in the C++ standard libraries vector<...> class. -- 2.39.5