]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use numbers::PI instead of hard coding macros.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 28 Jan 2010 17:10:07 +0000 (17:10 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Thu, 28 Jan 2010 17:10:07 +0000 (17:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@20470 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/flow_function.cc

index fe54a48dd705dcc726c2f1cabaf9b5437c875200..f26c846cf38ce0df074fe7a4f34faf062134daa8 100644 (file)
@@ -24,18 +24,6 @@ using namespace std;
 DEAL_II_NAMESPACE_OPEN
 
 
-// in strict ANSI C mode, the following constants are not defined by
-// default, so we do it ourselves
-#ifndef M_PI
-#  define      M_PI            3.14159265358979323846
-#endif
-
-#ifndef M_PI_2
-#  define      M_PI_2          1.57079632679489661923
-#endif
-
-
-
 namespace Functions
 {
 
@@ -559,7 +547,7 @@ namespace Functions
 
        if ((x<0) || (y<0))
          {
-           const double phi = std::atan2(y,-x)+M_PI;
+           const double phi = std::atan2(y,-x)+numbers::PI;
            const double r2 = x*x+y*y;
            const double rl = pow(r2,lambda/2.);
            const double rl1 = pow(r2,lambda/2.-.5);
@@ -595,7 +583,7 @@ namespace Functions
 
        if ((x<0) || (y<0))
          {
-           const double phi = std::atan2(y,-x)+M_PI;
+           const double phi = std::atan2(y,-x)+numbers::PI;
            const double r2 = x*x+y*y;
            const double r = sqrt(r2);
            const double rl = pow(r2,lambda/2.);
@@ -656,7 +644,7 @@ namespace Functions
                  stokes(stokes)
   {
     long double r2 = Reynolds/2.;
-    long double b = 4*M_PI*M_PI;
+    long double b = 4*numbers::PI*numbers::PI;
     long double l = -b/(r2+std::sqrt(r2*r2+b));
     lbda = l;
                                     // mean pressure for a domain
@@ -710,13 +698,13 @@ namespace Functions
        const double y = points[i](1);
 
        const double elx = std::exp(lbda*x);
-       const double cy = cos(2*M_PI*y);
-       const double sy = sin(2*M_PI*y);
+       const double cy = cos(2*numbers::PI*y);
+       const double sy = sin(2*numbers::PI*y);
 
                                         // u
        gradients[0][i][0] = -lbda*elx*cy;
        gradients[0][i][1] = 2. * numbers::PI*elx*sy;
-       gradients[1][i][0] = lbda*lbda/(2*M_PI)*elx*sy;
+       gradients[1][i][0] = lbda*lbda/(2*numbers::PI)*elx*sy;
        gradients[1][i][1] =lbda*elx*cy;
                                         // p
        gradients[2][i][0] = -lbda*elx*elx;

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.