]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix Functions::Monomial::gradient 1052/head
authorangelrca <angel.rcarballo@udc.es>
Mon, 29 Jun 2015 09:26:33 +0000 (11:26 +0200)
committerangelrca <angel.rcarballo@udc.es>
Mon, 29 Jun 2015 09:26:33 +0000 (11:26 +0200)
source/base/function_lib.cc

index 1ff631533a7033f3c2e22994c4481cc17002b33c..6abfcbe38db5d646e02d2116cb740998b2e1b388 100644 (file)
@@ -2146,12 +2146,21 @@ namespace Functions
       {
         double prod = 1;
         for (unsigned int s=0; s<dim; ++s)
-          prod *= (s==d
-                   ?
-                   exponents[s] * std::pow(p[s], exponents[s]-1)
-                   :
-                   std::pow(p[s], exponents[s]));
-
+          {
+            if ((s==d) && (exponents[s] == 0) && (p[s] == 0))
+              {
+                prod = 0;
+                break;
+              }
+            else
+              {
+                prod *= (s==d
+                         ?
+                         exponents[s] * std::pow(p[s], exponents[s]-1)
+                         :
+                         std::pow(p[s], exponents[s]));
+              }
+          }
         r[d] = prod;
       }
 

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.