]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add various std:: and other things to get the testsuite C++ compatible.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 22 May 2001 09:53:20 +0000 (09:53 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 22 May 2001 09:53:20 +0000 (09:53 +0000)
git-svn-id: https://svn.dealii.org/trunk@4691 0785d39b-7218-0410-832d-ea1e28bc413d

tests/lac/block_matrices.cc
tests/lac/block_vector.cc
tests/lac/full_matrix.cc
tests/lac/mg.cc
tests/lac/mgbase.cc
tests/lac/solver.cc
tests/lac/sparse_ilu.cc
tests/lac/sparsity_pattern.cc
tests/lac/testmatrix.cc
tests/lac/testmatrix.h
tests/lac/vector-vector.cc

index 633cc5a8af373cbb160b19c6185654cfd85dc38b..6813863354451609f3f565038c9923e61c961e87 100644 (file)
@@ -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<bool> t(29, false);
+      std::vector<bool> 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<double> src;
-  vector<unsigned int> src_sizes (2);
+  std::vector<unsigned int> src_sizes (2);
   src_sizes[0] = 10;
   src_sizes[1] = 19;
   src.reinit (src_sizes);
 
   BlockVector<double> dst;
-  vector<unsigned int> dst_sizes (3);
+  std::vector<unsigned int> 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<double> t(29, 0);
+      std::vector<double> 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;
index e6fc18834299069d775a60873b2215ad0d9c69e1..618f55ebc1ce1e76e632476a3e7d4ac38dc47e2b 100644 (file)
@@ -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<unsigned int> ivector(4);
+  std::vector<unsigned int> 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;
index 89fa61884a6c164784a352fc1a6f9f57b41ad939..ea3d7fa15fefc592ac565adaa23c59b375d55e9b 100644 (file)
@@ -40,8 +40,8 @@ void random_matrix(FullMatrix<double>& 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);
index fca71d6209cd8544e8f0ad1ee23c88b01ce45f63..8e68395c6741e2b1cb5361efbff27c5b9694e47a 100644 (file)
@@ -33,7 +33,7 @@
 #define ACCURACY 1.e-5
 
 // template<class VECTOR>
-// 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<SolverCG<>,
 
 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<SparsityPattern>  structure(maxlevel+1);
+      std::vector<SparsityPattern>  structure(maxlevel+1);
       MGLevelObject<SparseMatrix<double> > 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);
     }
 }
index 4a88f1167234baa3525c1feb40bf8deb5406e8d6..aa6756b5ddab95a77a87e46d0ceda16ad84d96a2 100644 (file)
@@ -89,7 +89,7 @@ class MGTest
 
 int main()
 {
-  ofstream logfile("mgbase.output");
+  std::ofstream logfile("mgbase.output");
   deallog.attach(logfile);
   deallog.depth_console(0);
 
index 81945602bdcda72ada1cbb91b720ea24fe73bcbd..84ef074e844a7876f2307d6650ff6a71a89bb0fe 100644 (file)
@@ -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;
        }
     };
 };
index 0863ee4ad4d6c975869136a09fda35644391b38d..fb29d2d17679945a9177833c37463d5be4d0e1bb 100644 (file)
@@ -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);
index c74182b8bf56ac72b65e0fac7d835987bc90a5e2..0eae668de2ef8e9b6f9d1eba4369cdb043dd3e5e 100644 (file)
@@ -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);
index 81b857fdc55a60cae16a3a75d3e0fcf78d976c26..7220583398deb4a891558f528ab2e39e1e7e2e02 100644 (file)
@@ -93,7 +93,7 @@ FDMatrix::laplacian(SparseMatrix<number>& A) const
 
 template<typename number>
 void
-FDMatrix::gnuplot_print(ostream& s, const Vector<number>& V) const
+FDMatrix::gnuplot_print(std::ostream& s, const Vector<number>& V) const
 {
    for(unsigned int i=0;i<=ny-2;i++)
     {
@@ -113,7 +113,7 @@ FDMatrix::gnuplot_print(ostream& s, const Vector<number>& V) const
 template void FDMatrix::laplacian(SparseMatrix<long double>&) const;
 template void FDMatrix::laplacian(SparseMatrix<double>&) const;
 template void FDMatrix::laplacian(SparseMatrix<float>&) const;
-template void FDMatrix::gnuplot_print(ostream& s, const Vector<long double>& V) const;
-template void FDMatrix::gnuplot_print(ostream& s, const Vector<double>& V) const;
-template void FDMatrix::gnuplot_print(ostream& s, const Vector<float>& V) const;
+template void FDMatrix::gnuplot_print(std::ostream& s, const Vector<long double>& V) const;
+template void FDMatrix::gnuplot_print(std::ostream& s, const Vector<double>& V) const;
+template void FDMatrix::gnuplot_print(std::ostream& s, const Vector<float>& V) const;
 
index f3f3518d82fda679ec1aac5aeea3098cd4f3615b..78952e3b3c690fb44b64a52ef194857cc95b51fc 100644 (file)
@@ -28,7 +28,7 @@ class FDMatrix
     void laplacian(SparseMatrix<number>&) const;
 
     template <typename number>
-    void gnuplot_print(ostream&, const Vector<number>&) const;
+    void gnuplot_print(std::ostream&, const Vector<number>&) const;
     
   private:
                                     /**
index b717e1f99efa52ddc92f726ba91422ac99239f36..bbb6f511458d1df9a46ee7edd968be055d3ea7e2 100644 (file)
@@ -88,13 +88,13 @@ void check_vectors (Vector<number1> &d1, Vector<number2> &d2)
 
   sum = 0.;
   for (unsigned int i=0;i<N;++i)
-    sum += fabs(2.-.5*i);
+    sum += std::fabs(2.-.5*i);
   deallog << d3.l1_norm() << '\t' << sum << std::endl;
 
   sum = 0.;
   for (unsigned int i=0;i<N;++i)
     {
-      double t = fabs(2.-.5*i);
+      double t = std::fabs(2.-.5*i);
       if (t>sum) sum = t;
     }
   deallog << d3.linfty_norm() << '\t' << sum << std::endl;
@@ -145,8 +145,8 @@ void check_vectors (Vector<number1> &d1, Vector<number2> &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);

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.