From: Wolfgang Bangerth Date: Tue, 22 May 2001 09:53:20 +0000 (+0000) Subject: Add various std:: and other things to get the testsuite C++ compatible. X-Git-Tag: v8.0.0~19103 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ac8fb14bf1c108784884bf6555ecccf5363504a;p=dealii.git Add various std:: and other things to get the testsuite C++ compatible. git-svn-id: https://svn.dealii.org/trunk@4691 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/lac/block_matrices.cc b/tests/lac/block_matrices.cc index 633cc5a8af..6813863354 100644 --- a/tests/lac/block_matrices.cc +++ b/tests/lac/block_matrices.cc @@ -24,8 +24,8 @@ void test () { - ofstream logfile("block_matrices.output"); - logfile.setf(ios::fixed); + std::ofstream logfile("block_matrices.output"); + logfile.setf(std::ios::fixed); logfile.precision(2); deallog.attach(logfile); deallog.depth_console(0); @@ -78,7 +78,7 @@ void test () { // first count the number of // elements in each row - vector t(29, false); + std::vector t(29, false); for (unsigned int i=0; i<10; ++i) t[(row*5+i*9)%29] = true; // if we are in the third block @@ -145,13 +145,13 @@ void test () // and see what we can get after // vmults: BlockVector src; - vector src_sizes (2); + std::vector src_sizes (2); src_sizes[0] = 10; src_sizes[1] = 19; src.reinit (src_sizes); BlockVector dst; - vector dst_sizes (3); + std::vector dst_sizes (3); dst_sizes[0] = 2; dst_sizes[1] = 7; dst_sizes[2] = 10; @@ -164,7 +164,7 @@ void test () // now check what came out for (unsigned int row=0; row<19; ++row) { - vector t(29, 0); + std::vector t(29, 0); // first check which elements // in this row exist for (unsigned int i=0; i<10; ++i) @@ -200,12 +200,12 @@ int main () { test (); } - catch (exception &e) + catch (std::exception &e) { - cerr << std::endl << std::endl + std::cerr << std::endl << std::endl << "----------------------------------------------------" << std::endl; - cerr << "Exception on processing: " << e.what() << std::endl + std::cerr << "Exception on processing: " << e.what() << std::endl << "Aborting!" << std::endl << "----------------------------------------------------" << std::endl; @@ -214,10 +214,10 @@ int main () } catch (...) { - cerr << std::endl << std::endl + std::cerr << std::endl << std::endl << "----------------------------------------------------" << std::endl; - cerr << "Unknown exception!" << std::endl + std::cerr << "Unknown exception!" << std::endl << "Aborting!" << std::endl << "----------------------------------------------------" << std::endl; diff --git a/tests/lac/block_vector.cc b/tests/lac/block_vector.cc index e6fc188342..618f55ebc1 100644 --- a/tests/lac/block_vector.cc +++ b/tests/lac/block_vector.cc @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 2000 by the deal.II authors +// Copyright (C) 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 @@ -23,7 +23,7 @@ void test () { deallog.push("BlockIndices"); - vector ivector(4); + std::vector ivector(4); ivector[0] = 3; ivector[1] = 0; ivector[2] = 1; @@ -109,23 +109,23 @@ void test () int main () { - ofstream logfile("block_vector.output"); - logfile.setf(ios::fixed); + std::ofstream logfile("block_vector.output"); + logfile.setf(std::ios::fixed); logfile.precision(3); deallog.attach(logfile); deallog.depth_console(0); - cerr = logfile; + std::cerr = logfile; try { test (); } - catch (exception &e) + catch (std::exception &e) { - cerr << std::endl << std::endl + std::cerr << std::endl << std::endl << "----------------------------------------------------" << std::endl; - cerr << "Exception on processing: " << e.what() << std::endl + std::cerr << "Exception on processing: " << e.what() << std::endl << "Aborting!" << std::endl << "----------------------------------------------------" << std::endl; @@ -134,10 +134,10 @@ int main () } catch (...) { - cerr << std::endl << std::endl + std::cerr << std::endl << std::endl << "----------------------------------------------------" << std::endl; - cerr << "Unknown exception!" << std::endl + std::cerr << "Unknown exception!" << std::endl << "Aborting!" << std::endl << "----------------------------------------------------" << std::endl; diff --git a/tests/lac/full_matrix.cc b/tests/lac/full_matrix.cc index 89fa61884a..ea3d7fa15f 100644 --- a/tests/lac/full_matrix.cc +++ b/tests/lac/full_matrix.cc @@ -40,8 +40,8 @@ void random_matrix(FullMatrix& A) int main () { - ofstream logfile("full_matrix.output"); - logfile.setf(ios::fixed); + std::ofstream logfile("full_matrix.output"); + logfile.setf(std::ios::fixed); logfile.precision(3); deallog.attach(logfile); deallog.depth_console(0); diff --git a/tests/lac/mg.cc b/tests/lac/mg.cc index fca71d6209..8e68395c67 100644 --- a/tests/lac/mg.cc +++ b/tests/lac/mg.cc @@ -33,7 +33,7 @@ #define ACCURACY 1.e-5 // template -// void print_vector(ostream& s, const VECTOR& v) +// void print_vector(std::ostream& s, const VECTOR& v) // { // const unsigned int n = (unsigned int)(sqrt(v.size())+.3); // unsigned int k=0; @@ -97,7 +97,7 @@ typedef MGCoarseGridLACIteration, int main() { - ofstream logfile("mg.output"); + std::ofstream logfile("mg.output"); deallog.attach(logfile); deallog.depth_console(0); @@ -128,7 +128,7 @@ for (unsigned int level = 0; level <= maxlevel; ++level) deallog << "Level " << level << " size " << size << std::endl; // Make matrix - vector structure(maxlevel+1); + std::vector structure(maxlevel+1); MGLevelObject > A(minlevel,maxlevel); FDMatrix testproblem(size, size); @@ -168,7 +168,7 @@ for (unsigned int level = 0; level <= maxlevel; ++level) f = 1.;//(size*size); solver.solve(A[level], u, f, precondition); - ofstream out("T"); + std::ofstream out("T"); testproblem.gnuplot_print(out,u); } } diff --git a/tests/lac/mgbase.cc b/tests/lac/mgbase.cc index 4a88f11672..aa6756b5dd 100644 --- a/tests/lac/mgbase.cc +++ b/tests/lac/mgbase.cc @@ -89,7 +89,7 @@ class MGTest int main() { - ofstream logfile("mgbase.output"); + std::ofstream logfile("mgbase.output"); deallog.attach(logfile); deallog.depth_console(0); diff --git a/tests/lac/solver.cc b/tests/lac/solver.cc index 81945602bd..84ef074e84 100644 --- a/tests/lac/solver.cc +++ b/tests/lac/solver.cc @@ -40,8 +40,8 @@ check_method( SOLVER& solver, const MATRIX& A, int main() { - ofstream logfile("solver.output"); - logfile.setf(ios::fixed); + std::ofstream logfile("solver.output"); + logfile.setf(std::ios::fixed); logfile.precision(2); deallog.attach(logfile); deallog.depth_console(0); @@ -118,9 +118,9 @@ int main() { check_method(cg,A,u,f,prec_sor); } - catch (exception& e) + catch (std::exception& e) { - deallog << e.what() << endl; + deallog << e.what() << std::endl; } check_method(bicgstab,A,u,f,prec_sor); @@ -128,9 +128,9 @@ int main() deallog.pop(); } - catch (exception& e) + catch (std::exception& e) { - cerr << e.what() << endl; + std::cerr << e.what() << std::endl; } }; }; diff --git a/tests/lac/sparse_ilu.cc b/tests/lac/sparse_ilu.cc index 0863ee4ad4..fb29d2d176 100644 --- a/tests/lac/sparse_ilu.cc +++ b/tests/lac/sparse_ilu.cc @@ -29,8 +29,8 @@ int main() { - ofstream logfile("sparse_ilu.output"); - logfile.setf(ios::fixed); + std::ofstream logfile("sparse_ilu.output"); + logfile.setf(std::ios::fixed); logfile.precision(3); deallog.attach(logfile); deallog.depth_console(0); diff --git a/tests/lac/sparsity_pattern.cc b/tests/lac/sparsity_pattern.cc index c74182b8bf..0eae668de2 100644 --- a/tests/lac/sparsity_pattern.cc +++ b/tests/lac/sparsity_pattern.cc @@ -23,8 +23,8 @@ int main () { - ofstream logfile("sparsity_pattern.output"); - logfile.setf(ios::fixed); + std::ofstream logfile("sparsity_pattern.output"); + logfile.setf(std::ios::fixed); logfile.precision(3); deallog.attach(logfile); deallog.depth_console(0); diff --git a/tests/lac/testmatrix.cc b/tests/lac/testmatrix.cc index 81b857fdc5..7220583398 100644 --- a/tests/lac/testmatrix.cc +++ b/tests/lac/testmatrix.cc @@ -93,7 +93,7 @@ FDMatrix::laplacian(SparseMatrix& A) const template void -FDMatrix::gnuplot_print(ostream& s, const Vector& V) const +FDMatrix::gnuplot_print(std::ostream& s, const Vector& V) const { for(unsigned int i=0;i<=ny-2;i++) { @@ -113,7 +113,7 @@ FDMatrix::gnuplot_print(ostream& s, const Vector& V) const template void FDMatrix::laplacian(SparseMatrix&) const; template void FDMatrix::laplacian(SparseMatrix&) const; template void FDMatrix::laplacian(SparseMatrix&) const; -template void FDMatrix::gnuplot_print(ostream& s, const Vector& V) const; -template void FDMatrix::gnuplot_print(ostream& s, const Vector& V) const; -template void FDMatrix::gnuplot_print(ostream& s, const Vector& V) const; +template void FDMatrix::gnuplot_print(std::ostream& s, const Vector& V) const; +template void FDMatrix::gnuplot_print(std::ostream& s, const Vector& V) const; +template void FDMatrix::gnuplot_print(std::ostream& s, const Vector& V) const; diff --git a/tests/lac/testmatrix.h b/tests/lac/testmatrix.h index f3f3518d82..78952e3b3c 100644 --- a/tests/lac/testmatrix.h +++ b/tests/lac/testmatrix.h @@ -28,7 +28,7 @@ class FDMatrix void laplacian(SparseMatrix&) const; template - void gnuplot_print(ostream&, const Vector&) const; + void gnuplot_print(std::ostream&, const Vector&) const; private: /** diff --git a/tests/lac/vector-vector.cc b/tests/lac/vector-vector.cc index b717e1f99e..bbb6f51145 100644 --- a/tests/lac/vector-vector.cc +++ b/tests/lac/vector-vector.cc @@ -88,13 +88,13 @@ void check_vectors (Vector &d1, Vector &d2) sum = 0.; for (unsigned int i=0;isum) sum = t; } deallog << d3.linfty_norm() << '\t' << sum << std::endl; @@ -145,8 +145,8 @@ void check_vectors (Vector &d1, Vector &d2) int main() { - ofstream logfile("vector-vector.output"); - logfile.setf(ios::fixed); + std::ofstream logfile("vector-vector.output"); + logfile.setf(std::ios::fixed); logfile.precision(2); deallog.attach(logfile); deallog.depth_console(0);