]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move a check that's only valid when an AD tape exists
authorJean-Paul Pelteret <jppelteret@gmail.com>
Fri, 5 Oct 2018 13:54:53 +0000 (15:54 +0200)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Fri, 5 Oct 2018 13:54:53 +0000 (15:54 +0200)
source/differentiation/ad/ad_helpers.cc

index c50a2d92c374a703e1f73914f1efb101e307bf07..befa9e89ad896b402ffd0528dbbc640ca82430cb 100644 (file)
@@ -521,8 +521,6 @@ namespace Differentiation
                  ExcMessage("Invalid tape index"));
           Assert(tape_index < numbers::max_tape_index,
                  ExcMessage("Tape index exceeds maximum allowable value"));
-          Assert(is_registered_tape(tape_index),
-                 ExcMessage("Tape number not registered"));
           active_tape_index = tape_index;
           reset_registered_independent_variables();
 
@@ -531,6 +529,8 @@ namespace Differentiation
           // current data structure have not been marked as dependents
           if (read_mode == true)
             {
+              Assert(is_registered_tape(tape_index),
+                     ExcMessage("Tape number not registered"));
               reset_registered_dependent_variables(true);
               Assert(n_registered_dependent_variables() ==
                        n_dependent_variables(),

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.