Windows does not define M_PI, so we need this for MSVC.
#include <deal.II/distributed/tria.h>
#include <deal.II/distributed/grid_refinement.h>
+#include <cmath>
#include <fstream>
#include <iostream>
const double R_x = p[0];
const double R_y = p[1];
- values[0] = -1.0L/2.0L*(-2*sqrt(25.0 + 4*pow(M_PI, 2)) + 10.0)*exp(R_x*(-2*sqrt(25.0 + 4*pow(M_PI, 2)) + 10.0)) - 0.4*pow(M_PI, 2)*exp(R_x*(-sqrt(25.0 + 4*pow(M_PI, 2)) + 5.0))*cos(2*R_y*M_PI) + 0.1*pow(-sqrt(25.0 + 4*pow(M_PI, 2)) + 5.0, 2)*exp(R_x*(-sqrt(25.0 + 4*pow(M_PI, 2)) + 5.0))*cos(2*R_y*M_PI);
- values[1] = 0.2*M_PI*(-sqrt(25.0 + 4*pow(M_PI, 2)) + 5.0)*exp(R_x*(-sqrt(25.0 + 4*pow(M_PI, 2)) + 5.0))*sin(2*R_y*M_PI) - 0.05*pow(-sqrt(25.0 + 4*pow(M_PI, 2)) + 5.0, 3)*exp(R_x*(-sqrt(25.0 + 4*pow(M_PI, 2)) + 5.0))*sin(2*R_y*M_PI)/M_PI;
+ const double pi = numbers::PI;
+ const double pi2 = pi*pi;
+ values[0] = -1.0L/2.0L*(-2*sqrt(25.0 + 4*pi2) + 10.0)*exp(R_x*(-2*sqrt(25.0 + 4*pi2) + 10.0)) - 0.4*pi2*exp(R_x*(-sqrt(25.0 + 4*pi2) + 5.0))*cos(2*R_y*pi) + 0.1*pow(-sqrt(25.0 + 4*pi2) + 5.0, 2)*exp(R_x*(-sqrt(25.0 + 4*pi2) + 5.0))*cos(2*R_y*pi);
+ values[1] = 0.2*pi*(-sqrt(25.0 + 4*pi2) + 5.0)*exp(R_x*(-sqrt(25.0 + 4*pi2) + 5.0))*sin(2*R_y*pi) - 0.05*pow(-sqrt(25.0 + 4*pi2) + 5.0, 3)*exp(R_x*(-sqrt(25.0 + 4*pi2) + 5.0))*sin(2*R_y*pi)/pi;
values[2] = 0;
}
const double R_x = p[0];
const double R_y = p[1];
- values[0] = -exp(R_x*(-sqrt(25.0 + 4*pow(M_PI, 2)) + 5.0))*cos(2*R_y*M_PI) + 1;
- values[1] = (1.0L/2.0L)*(-sqrt(25.0 + 4*pow(M_PI, 2)) + 5.0)*exp(R_x*(-sqrt(25.0 + 4*pow(M_PI, 2)) + 5.0))*sin(2*R_y*M_PI)/M_PI;
- values[2] = -1.0L/2.0L*exp(R_x*(-2*sqrt(25.0 + 4*pow(M_PI, 2)) + 10.0)) - 2.0*(-6538034.74494422 + 0.0134758939981709*exp(4*sqrt(25.0 + 4*pow(M_PI, 2))))/(-80.0*exp(3*sqrt(25.0 + 4*pow(M_PI, 2))) + 16.0*sqrt(25.0 + 4*pow(M_PI, 2))*exp(3*sqrt(25.0 + 4*pow(M_PI, 2)))) - 1634508.68623606*exp(-3.0*sqrt(25.0 + 4*pow(M_PI, 2)))/(-10.0 + 2.0*sqrt(25.0 + 4*pow(M_PI, 2))) + (-0.00673794699908547*exp(sqrt(25.0 + 4*pow(M_PI, 2))) + 3269017.37247211*exp(-3*sqrt(25.0 + 4*pow(M_PI, 2))))/(-8*sqrt(25.0 + 4*pow(M_PI, 2)) + 40.0) + 0.00336897349954273*exp(1.0*sqrt(25.0 + 4*pow(M_PI, 2)))/(-10.0 + 2.0*sqrt(25.0 + 4*pow(M_PI, 2)));
+ const double pi = numbers::PI;
+ const double pi2 = pi*pi;
+ values[0] = -exp(R_x*(-sqrt(25.0 + 4*pi2) + 5.0))*cos(2*R_y*pi) + 1;
+ values[1] = (1.0L/2.0L)*(-sqrt(25.0 + 4*pi2) + 5.0)*exp(R_x*(-sqrt(25.0 + 4*pi2) + 5.0))*sin(2*R_y*pi)/pi;
+ values[2] = -1.0L/2.0L*exp(R_x*(-2*sqrt(25.0 + 4*pi2) + 10.0)) - 2.0*(-6538034.74494422 + 0.0134758939981709*exp(4*sqrt(25.0 + 4*pi2)))/(-80.0*exp(3*sqrt(25.0 + 4*pi2)) + 16.0*sqrt(25.0 + 4*pi2)*exp(3*sqrt(25.0 + 4*pi2))) - 1634508.68623606*exp(-3.0*sqrt(25.0 + 4*pi2))/(-10.0 + 2.0*sqrt(25.0 + 4*pi2)) + (-0.00673794699908547*exp(sqrt(25.0 + 4*pi2)) + 3269017.37247211*exp(-3*sqrt(25.0 + 4*pi2)))/(-8*sqrt(25.0 + 4*pi2) + 40.0) + 0.00336897349954273*exp(1.0*sqrt(25.0 + 4*pi2))/(-10.0 + 2.0*sqrt(25.0 + 4*pi2));
}
// floating point errors might place it slightly outside
// this range. It is therefore necessary to correct for it
const Number phi =
- (tmp_2 <= -1.0 ? Number(M_PI/3.0) :
+ (tmp_2 <= -1.0 ? Number(numbers::PI/3.0) :
(tmp_2 >= 1.0 ? Number(0.0) :
std::acos(tmp_2)/3.0));
= { {
static_cast<Number>(q + 2.0*p*std::cos(phi)),
static_cast<Number>(0.0),
- static_cast<Number>(q + 2.0*p*std::cos(phi + (2.0/3.0*M_PI)))
+ static_cast<Number>(q + 2.0*p*std::cos(phi + (2.0/3.0*numbers::PI)))
}
};
// Use the identity tr(T) = eig1 + eig2 + eig3
#include <deal.II/lac/sparsity_pattern.h>
#include <deal.II/lac/sparse_matrix.h>
+#include <deal.II/base/numbers.h>
#include <deal.II/base/function.h>
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/lac/constraint_matrix.h>
MappingQ1Eulerian<2> mapping_euler (deformation, *dof_handler_def);
// Try rotating the elements
- for (double rotat = 0; rotat < 2 * M_PI; rotat += 0.25 * M_PI)
+ for (double rotat = 0; rotat < 2 * numbers::PI; rotat += 0.25 * numbers::PI)
{
// Rotate element
VectorTools::project (*dof_handler_def, hn_constraints_def,
#include <deal.II/lac/sparsity_pattern.h>
#include <deal.II/lac/sparse_matrix.h>
+#include <deal.II/base/numbers.h>
#include <deal.II/base/function.h>
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/lac/constraint_matrix.h>
unsigned int test_out = 0;
// Try rotating the elements
- for (double rotat = 0; rotat < 2 * M_PI; rotat += 0.25 * M_PI)
+ for (double rotat = 0; rotat < 2 * numbers::PI; rotat += 0.25 * numbers::PI)
{
// Rotate element
VectorTools::project (*dof_handler_def, hn_constraints_def,
#include <deal.II/lac/sparsity_pattern.h>
#include <deal.II/lac/sparse_matrix.h>
+#include <deal.II/base/numbers.h>
#include <deal.II/base/function.h>
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/lac/constraint_matrix.h>
deallog << buf;
// Try rotating the elements
- for (double rotat = 0; rotat < 2 * M_PI; rotat += 0.25 * M_PI)
+ for (double rotat = 0; rotat < 2 * numbers::PI; rotat += 0.25 * numbers::PI)
{
// Rotate element
VectorTools::project (dof_handler_def, hn_constraints_def,
#include <deal.II/base/index_set.h>
#include <deal.II/base/mpi.h>
#include <deal.II/base/multithread_info.h>
+#include <deal.II/base/numbers.h>
#include <deal.II/base/quadrature_lib.h>
#include <deal.II/base/utilities.h>
static const unsigned int fe_order = 4;
static const dealii::types::boundary_id boundary_id = 0;
static const dealii::types::manifold_id cubic_manifold_id = 1;
-static const double pi = M_PI;
+static const double pi = numbers::PI;
// ----------------------------------------------------------------------------
// Manufactured solution and manufactured forcing
#include "../tests.h"
+#include <deal.II/base/numbers.h>
#include <deal.II/base/point.h>
#include <deal.II/base/symmetric_tensor.h>
#include <deal.II/base/tensor.h>
deallog << std::setprecision(3);
deallog.attach(logfile);
- const double deg_to_rad = M_PI/180.0;
+ const double deg_to_rad = numbers::PI/180.0;
// 2-d
{