From: Wolfgang Bangerth Date: Tue, 22 May 2001 09:46:27 +0000 (+0000) Subject: Add various std:: and other things to get the testsuite C++ compatible. X-Git-Tag: v8.0.0~19105 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51a16462dd0bf04cf2ee322cd06cdbb9716eb21c;p=dealii.git Add various std:: and other things to get the testsuite C++ compatible. git-svn-id: https://svn.dealii.org/trunk@4689 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/base/auto_derivative_function.cc b/tests/base/auto_derivative_function.cc index fa9f55dc2d..a8cbfdfd90 100644 --- a/tests/base/auto_derivative_function.cc +++ b/tests/base/auto_derivative_function.cc @@ -111,7 +111,7 @@ void ExactSinExp::vector_gradient (const Point &p, int main(int, char) { - ofstream logfile("auto_derivative_function.output"); + std::ofstream logfile("auto_derivative_function.output"); logfile.precision(4); deallog.attach(logfile); deallog.depth_console(0); @@ -131,7 +131,7 @@ int main(int, char) { formula=AutoDerivativeFunction::get_formula_of_order(order); auto_function.set_formula(formula); - deallog << "order=" << order << ", formula=" << formula << endl; + deallog << "order=" << order << ", formula=" << formula << std::endl; ConvergenceTable history; unsigned int factor=1; diff --git a/tests/base/logtest.cc b/tests/base/logtest.cc index 0d8aa3db45..73d9a04f0b 100644 --- a/tests/base/logtest.cc +++ b/tests/base/logtest.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -15,9 +15,10 @@ #include #include + int main() { - ofstream logfile("logtest.output"); + std::ofstream logfile("logtest.output"); deallog.attach(logfile); deallog.depth_console(0); diff --git a/tests/base/polynomial_test.cc b/tests/base/polynomial_test.cc index 572fe41008..ba6bb47ade 100644 --- a/tests/base/polynomial_test.cc +++ b/tests/base/polynomial_test.cc @@ -13,6 +13,7 @@ #include #include +#include #include #include @@ -22,7 +23,7 @@ bool equals_delta_ij(double value, unsigned int i, unsigned int j) { double eps=1e-14; - if ((i==j && fabs(value-1) values(1); + std::vector values(1); deallog << "LagrangeEquidistant polynoms:" << std::endl; for (unsigned int order=1; order<=4; ++order) { @@ -81,12 +82,12 @@ int main(int, char) deallog << std::endl << "Test derivatives computed by the Horner scheme:" << std::endl; LagrangeEquidistant pol(4, 2); - vector v_horner(6); + std::vector v_horner(6); for (unsigned int i=0; i<=10; ++i) { double xi=i*0.1; deallog << "x=" << xi << ", all derivatives: "; - vector v_exact(6); + std::vector v_exact(6); v_exact[0]=64.0*xi*xi*xi*xi-128.0*xi*xi*xi+76.0*xi*xi-12.0*xi; v_exact[1]=256.0*xi*xi*xi-384.0*xi*xi+152.0*xi-12.0; @@ -102,7 +103,7 @@ int main(int, char) { // deallog << "v_horner[i]=" << v_horner[i] // << " v_exact[i]=" << v_exact[i] << std::endl; - if (fabs(v_horner[i]-v_exact[i])>1e-12) + if (std::fabs(v_horner[i]-v_exact[i])>1e-12) ok=false; } @@ -117,17 +118,17 @@ int main(int, char) if (true) { deallog << std::endl << "Derivatives of a polynomial of degree 0 (a constant function)." << std::endl; - vector a_const(1,1.); + std::vector a_const(1,1.); const Polynomial pol_const(a_const); - vector exact_values(5,0.); + std::vector exact_values(5,0.); exact_values[0]=1.; - vector computed_values(5); + std::vector computed_values(5); pol_const.value(0.24, computed_values); bool ok=true; for (unsigned int i=0; i1e-15) + if (std::fabs(computed_values[i]-exact_values[i])>1e-15) ok=false; } @@ -146,7 +147,7 @@ int main(int, char) deallog << "2D Example:" << std::endl; unsigned int p=3, n_tensor_pols=(p+1)*(p+1); - vector > pols; + std::vector > pols; for (unsigned int i=0; i<=p; ++i) pols.push_back(LagrangeEquidistant(p, i)); @@ -169,9 +170,9 @@ int main(int, char) Tensor<1,2> grad=tp_pol.compute_grad(i, point); Tensor<2,2> grad_grad=tp_pol.compute_grad_grad(i, point); - vector vs(n_tensor_pols); - vector > grads(n_tensor_pols); - vector > grad_grads(n_tensor_pols); + std::vector vs(n_tensor_pols); + std::vector > grads(n_tensor_pols); + std::vector > grad_grads(n_tensor_pols); tp_pol.compute(point, vs, grads, grad_grads); diff --git a/tests/base/quadrature_test.cc b/tests/base/quadrature_test.cc index 50be5eece8..b6c7253c0c 100644 --- a/tests/base/quadrature_test.cc +++ b/tests/base/quadrature_test.cc @@ -21,7 +21,7 @@ template void -fill_vector (vector *>& quadratures) +fill_vector (std::vector *>& quadratures) { quadratures.push_back (new QGauss2()); quadratures.push_back (new QGauss3()); @@ -42,13 +42,13 @@ fill_vector (vector *>& quadratures) template void -check_cells (vector*>& quadratures) +check_cells (std::vector*>& quadratures) { for (unsigned int n=0; n& quadrature = *quadratures[n]; - const vector > &points=quadrature.get_points(); - const vector &weights=quadrature.get_weights(); + const std::vector > &points=quadrature.get_points(); + const std::vector &weights=quadrature.get_weights(); deallog << "Quadrature no." << n << " (" << typeid(*quadratures[n]).name() << ")"; @@ -109,7 +109,7 @@ check_cells (vector*>& quadratures) template void -check_faces (vector*>& quadratures, bool sub) +check_faces (const std::vector*>& quadratures, const bool sub) { if (sub) deallog.push("subfaces"); @@ -177,13 +177,13 @@ check_faces (vector*>& quadratures, bool sub) int main(int,char) { - ofstream logfile("quadrature_test.output"); + std::ofstream logfile("quadrature_test.output"); deallog.attach(logfile); deallog.depth_console(0); - vector *> q1; - vector *> q2; - vector *> q3; + std::vector *> q1; + std::vector *> q2; + std::vector *> q3; fill_vector (q1); fill_vector (q2); fill_vector (q3); diff --git a/tests/base/reference.cc b/tests/base/reference.cc index 3c84db90fe..1b54a605a5 100644 --- a/tests/base/reference.cc +++ b/tests/base/reference.cc @@ -44,10 +44,10 @@ public: int main() { - ofstream logfile("reference.output"); + std::ofstream logfile("reference.output"); deallog.attach(logfile); deallog.depth_console(0); - cerr = logfile; + std::cerr = logfile; Test a("A"); const Test b("B"); SmartPointer r=&a; diff --git a/tests/base/tensor.cc b/tests/base/tensor.cc index 862152c124..80ea42b3bf 100644 --- a/tests/base/tensor.cc +++ b/tests/base/tensor.cc @@ -20,7 +20,7 @@ int main () { - ofstream logfile("tensor.output"); + std::ofstream logfile("tensor.output"); logfile.precision(3); deallog.attach(logfile); deallog.depth_console(0); diff --git a/tests/base/timer.cc b/tests/base/timer.cc index 376e80b8a0..3ed423716d 100644 --- a/tests/base/timer.cc +++ b/tests/base/timer.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -15,6 +15,7 @@ #include #include #include +#include // compute the ratio of two measurements and compare to // the expected value. @@ -22,7 +23,7 @@ void compare (double t1, double t2, double ratio) { double r = t2/t1; - double d = fabs(r-ratio) / ratio; + double d = std::fabs(r-ratio) / ratio; // relative error < 10%? if (d <= .1) @@ -50,7 +51,7 @@ void burn (unsigned int n) int main () { - ofstream logfile("timer.output"); + std::ofstream logfile("timer.output"); deallog.attach(logfile); deallog.depth_console(0);