]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add AD number static asserts for FullMatrix and Vector classes. 6943/head
authorJean-Paul Pelteret <jppelteret@gmail.com>
Sat, 21 Jul 2018 14:41:04 +0000 (16:41 +0200)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Sat, 21 Jul 2018 15:37:27 +0000 (17:37 +0200)
include/deal.II/lac/full_matrix.h
include/deal.II/lac/vector.h

index fc2cb0f76ab9252f811d7e47e95399833daa25ef..77600face8f67d7292e0bb83f5fd8ca490f44582 100644 (file)
@@ -23,6 +23,8 @@
 #include <deal.II/base/table.h>
 #include <deal.II/base/tensor.h>
 
+#include <deal.II/differentiation/ad/ad_number_traits.h>
+
 #include <deal.II/lac/exceptions.h>
 #include <deal.II/lac/identity_matrix.h>
 
@@ -68,6 +70,12 @@ template <typename number>
 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<number>::value,
+    "The FullMatrix class does not support auto-differentiable numbers.");
+
   /**
    * A type of used to index into this container.
    */
index 13c67eeaaa8944585fafa45b94d9bd65bc447ea6..a6dfa1cdc9e8584fe143dcb7f43a2a0709560572 100644 (file)
@@ -24,6 +24,8 @@
 #include <deal.II/base/logstream.h>
 #include <deal.II/base/subscriptor.h>
 
+#include <deal.II/differentiation/ad/ad_number_traits.h>
+
 #include <deal.II/lac/vector_operation.h>
 #include <deal.II/lac/vector_type_traits.h>
 
@@ -108,6 +110,12 @@ template <typename Number>
 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<Number>::value,
+    "The Vector class does not support auto-differentiable numbers.");
+
   /**
    * Declare standard types used in all containers. These types parallel those
    * in the <tt>C++</tt> standard libraries <tt>vector<...></tt> class.

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.