]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add static_asserts for complex-valued cases. 5757/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Thu, 18 Jan 2018 18:18:45 +0000 (11:18 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Thu, 18 Jan 2018 18:20:05 +0000 (11:20 -0700)
include/deal.II/lac/vector_operations_internal.h

index 517ef3f76edeafbb8655c4403d985ae5c7e87e13..a485ab6d280a9fe016a0e99fb74a3f076b0da1ab 100644 (file)
@@ -719,6 +719,17 @@ namespace internal
         VectorizedArray<Number> x, y;
         x.load(X+i);
         y.load(Y+i);
+
+        // the following operation in VectorizedArray does an element-wise
+        // scalar product without taking into account complex values and
+        // the need to take the complex-conjugate of one argument. this
+        // may be a bug, but because all VectorizedArray classes only
+        // work on real scalars, it doesn't really matter very much.
+        // in any case, assert that we really don't get here for
+        // complex-valued objects
+        static_assert (numbers::NumberTraits<Number>::is_complex == false,
+                       "This operation is not correctly implemented for "
+                       "complex-valued objects.");
         return x * y;
       }
 
@@ -867,6 +878,17 @@ namespace internal
         // may only load from W after storing in X because the pointers might
         // point to the same memory
         w.load(W+i);
+
+        // the following operation in VectorizedArray does an element-wise
+        // scalar product without taking into account complex values and
+        // the need to take the complex-conjugate of one argument. this
+        // may be a bug, but because all VectorizedArray classes only
+        // work on real scalars, it doesn't really matter very much.
+        // in any case, assert that we really don't get here for
+        // complex-valued objects
+        static_assert (numbers::NumberTraits<Number>::is_complex == false,
+                       "This operation is not correctly implemented for "
+                       "complex-valued objects.");
         return x * w;
       }
 

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.