]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Adol-C advanced branching: Fix Tensor
authorJean-Paul Pelteret <jppelteret@gmail.com>
Fri, 27 Apr 2018 00:46:39 +0000 (02:46 +0200)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Fri, 27 Apr 2018 17:21:59 +0000 (19:21 +0200)
include/deal.II/base/tensor.h

index 7ad948b63b846b6241d97a2fb10b2a54e0d83de0..2a16e8657b457114016ca94c817d46a4bc9bbb06 100644 (file)
@@ -833,7 +833,13 @@ template <typename OtherNumber>
 inline
 bool Tensor<0,dim,Number>::operator == (const Tensor<0,dim,OtherNumber> &p) const
 {
-  return (value == p.value);
+#ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING
+  Assert(!(std::is_same<Number,adouble>::value || std::is_same<OtherNumber,adouble>::value),
+         ExcMessage("The Tensor equality operator for Adol-C taped numbers has not yet "
+                    "been extended to support advanced branching."));
+#endif
+
+  return numbers::values_are_equal(value,p.value);
 }
 
 
@@ -1141,8 +1147,7 @@ inline DEAL_II_ALWAYS_INLINE
 Tensor<rank_,dim,Number> &
 Tensor<rank_,dim,Number>::operator = (const Number &d)
 {
-  Assert (d == internal::NumberType<Number>::value(0.0),
-          ExcMessage ("Only assignment with zero is allowed"));
+  Assert (numbers::value_is_zero(d), ExcMessage ("Only assignment with zero is allowed"));
   (void) d;
 
   for (unsigned int i=0; i<dim; ++i)

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.