]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make things more C++ conformant.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 22 May 2001 11:54:30 +0000 (11:54 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 22 May 2001 11:54:30 +0000 (11:54 +0000)
git-svn-id: https://svn.dealii.org/trunk@4692 0785d39b-7218-0410-832d-ea1e28bc413d

tests/fe/derivatives.cc
tests/fe/internals.cc
tests/fe/performance.cc
tests/fe/shapes.cc
tests/fe/show_transfer.cc

index 9ebac5772996199e4b0f6532a572092be2d5a4b1..4fd4d326bcf6c98faccf44ef5f82e6b928b8a543 100644 (file)
@@ -132,9 +132,9 @@ void plot_FE_DGQ_shape_functions()
 int
 main()
 {
-  ofstream logfile ("derivatives.output");
+  std::ofstream logfile ("derivatives.output");
   logfile.precision (2);
-  logfile.setf(ios::fixed);  
+  logfile.setf(std::ios::fixed);  
   deallog.attach(logfile);
   deallog.depth_console(0);
   
index fe00ea48a54bea470f4969529aee69bdcae3a951..04a737a368a1e126054492390a3211424b5ec47e 100644 (file)
 
 template <int dim>
 inline void
-check_support (FiniteElement<dim>& finel, const char* name)
+check_support (const FiniteElement<dim>& finel, const char* name)
 {
   Triangulation<dim> tr;
   GridGenerator::hyper_cube(tr, 0., 1.);
   DoFHandler<dim> dof (tr);
   dof.distribute_dofs (finel);
 
-  cout << name << '<' << dim << '>' << " cell support points" << std::endl;
+  std::cout << name << '<' << dim << '>' << " cell support points" << std::endl;
   
-  vector<Point<dim> > cell_points (finel.dofs_per_cell);
-  finel.get_unit_support_points (cell_points);
+  const std::vector<Point<dim> > &cell_points = finel.get_unit_support_points ();
 
   for (unsigned int k=0;k<cell_points.size();++k)
-    cout << setprecision(3) << cell_points[k] << std::endl;
+    std::cout << std::setprecision(3) << cell_points[k] << std::endl;
   
-  vector<Point<dim-1> > face_points;
-  finel.get_unit_face_support_points (face_points);
-  const vector<double> dummy_weights (face_points.size());
+  const std::vector<Point<dim-1> > &face_points = finel.get_unit_face_support_points ();
+  const std::vector<double> dummy_weights (face_points.size());
   
   Quadrature<dim-1> q(face_points, dummy_weights);
   QProjector<dim> qp(q, false);
@@ -45,10 +43,10 @@ check_support (FiniteElement<dim>& finel, const char* name)
   unsigned int j=0;
   for (unsigned int i=0;i<GeometryInfo<dim>::faces_per_cell;++i)
     {
-      cout << name << '<' << dim << '>' << " face " << i << " support points" << std::endl;
+      std::cout << name << '<' << dim << '>' << " face " << i << " support points" << std::endl;
         
       for (unsigned int k=0;k<face_points.size();++k)
-       cout << setprecision(3) << qp.point(j++)
+       std::cout << std::setprecision(3) << qp.point(j++)
             << std::endl;
     }
 }
@@ -57,15 +55,15 @@ template <int dim>
 inline void
 check_matrices (FiniteElement<dim>& fe, const char* name)
 {
-  cout << name << '<' << dim << '>' << " constraint " << std::endl;
-  fe.constraints().print_formatted (cout, 7, false, 10, "~");
+  std::cout << name << '<' << dim << '>' << " constraint " << std::endl;
+  fe.constraints().print_formatted (std::cout, 7, false, 10, "~");
 
   for (unsigned int i=0;i<GeometryInfo<dim>::children_per_cell;++i)
     {
-      cout << name << '<' << dim << '>' << " restriction " << i << std::endl;
-      fe.restrict(i).print_formatted (cout, 3, false, 6, "~");
-      cout << name << '<' << dim << '>' << " embedding " << i << std::endl;
-      fe.prolongate(i).print_formatted (cout, 3, false, 6, "~");
+      std::cout << name << '<' << dim << '>' << " restriction " << i << std::endl;
+      fe.restrict(i).print_formatted (std::cout, 3, false, 6, "~");
+      std::cout << name << '<' << dim << '>' << " embedding " << i << std::endl;
+      fe.prolongate(i).print_formatted (std::cout, 3, false, 6, "~");
     }
 }
 
index 54b09855325db16b241189eaa02747fda4eeaf78..4cc3cbb3b5c2d93f0e418a45f6a43691f7068701 100644 (file)
@@ -49,22 +49,22 @@ void performance (Triangulation<dim>& tr,
 }
 
 template <int dim>
-void loop (vector<FiniteElement<dim> *> elements,
+void loop (std::vector<FiniteElement<dim> *> elements,
            const Mapping<dim>& mapping,
            Triangulation<dim>& tr)
 {
   QGauss<dim> gauss (4);
   
-  FiniteElement<dim>** elementp = elements.begin ();
-  FiniteElement<dim>** end = elements.end ();
+  typename std::vector<FiniteElement<dim> *>::iterator elementp = elements.begin ();
+  typename std::vector<FiniteElement<dim> *>::iterator end = elements.end ();
 
   for (;elementp != end; ++elementp)
     {
       const FiniteElement<dim>& element = **elementp;
 
       char dofs[20];
-      ostrstream ost (dofs, 19);
-      ost << element.n_dofs_per_cell() << ends;
+      std::ostrstream ost (dofs, 19);
+      ost << element.n_dofs_per_cell() << std::ends;
       
       deallog.push(dofs);
       
@@ -104,7 +104,7 @@ void loop (vector<FiniteElement<dim> *> elements,
 
 int main ()
 {
-  ofstream of ("performance.log");
+  std::ofstream of ("performance.log");
   deallog.attach (of);
   deallog.log_execution_time(true);
   deallog.log_time_differences(true);
@@ -116,7 +116,7 @@ int main ()
   MappingQ1<2> mapping;
   MappingQ<2> mappingq1(1);
   MappingQ<2> mappingq2(2);
-  vector<FiniteElement<2>*> el2d;
+  std::vector<FiniteElement<2>*> el2d;
   el2d.push_back (new FE_Q<2> (1));
   el2d.push_back (new FE_Q<2> (2));
   el2d.push_back (new FE_Q<2> (3));
index 1bde5701aa47258e02087e4710ae4cdbbe5d3136..b7da61371f3dacf5ce40f6d014189698be96e84d 100644 (file)
@@ -44,7 +44,7 @@ plot_shape_functions(Mapping<dim>& mapping,
   
   sprintf(fname, "Shapes%dd-%s.output", dim, name);
   std::ofstream gnuplot(fname);
-  gnuplot.setf(ios::fixed);
+  gnuplot.setf(std::ios::fixed);
   gnuplot.precision (PRECISION);
 
   unsigned int k=0;
@@ -99,8 +99,8 @@ plot_face_shape_functions(Mapping<dim>& mapping,
     | update_q_points));
 
   sprintf(fname, "ShapesFace%dd-%s.output", dim, name);
-  ofstream gnuplot(fname);
-  gnuplot.setf(ios::fixed);
+  std::ofstream gnuplot(fname);
+  gnuplot.setf(std::ios::fixed);
   gnuplot.precision (PRECISION);
   
   for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
@@ -184,7 +184,7 @@ void test_compute_functions (const Mapping<dim> &mapping,
        coincide=false;
 
   if (!coincide)
-    deallog << "Error in fe.shape_value for " << name << endl;
+    deallog << "Error in fe.shape_value for " << name << std::endl;
 
   coincide=true;
   for (unsigned int x=0; x<q.n_quadrature_points; ++x)
@@ -197,7 +197,7 @@ void test_compute_functions (const Mapping<dim> &mapping,
       }
 
   if (!coincide)
-    deallog << "Error in fe.shape_grad for " << name << endl;
+    deallog << "Error in fe.shape_grad for " << name << std::endl;
   
   coincide=true;
   double max_diff=0.;
@@ -218,8 +218,8 @@ void test_compute_functions (const Mapping<dim> &mapping,
       }
 
   if (!coincide)  
-    deallog << "Error in fe.shape_grad_grad for " << name << endl
-           << "max_diff=" << max_diff << endl;
+    deallog << "Error in fe.shape_grad_grad for " << name << std::endl
+           << "max_diff=" << max_diff << std::endl;
 }
 
 
@@ -297,9 +297,9 @@ void plot_FE_DGQ_shape_functions()
 int
 main()
 {
-  ofstream logfile ("shapes.output");
+  std::ofstream logfile ("shapes.output");
   logfile.precision (PRECISION);
-  logfile.setf(ios::fixed);  
+  logfile.setf(std::ios::fixed);  
   deallog.attach(logfile);
   deallog.depth_console(0);
   
index bfbae100e769fc0cc07b2c3e7a4627a0fe51de68..93b75d57193cb715c830ac88a9ac7a02f9bcf54e 100644 (file)
@@ -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
@@ -37,7 +37,7 @@ char fname[50];
 
 template<int dim>
 inline void
-print_matrix(ostream& of,
+print_matrix(std::ostream& of,
             Triangulation<dim>& tr,
             unsigned int level,
             const FiniteElement<dim>& finel,
@@ -75,7 +75,7 @@ main()
   GridGenerator::hyper_cube(tr, -1., 1.);
   tr.refine_global(2);
 
-  ofstream of("transfer.dat");
+  std::ofstream of("transfer.dat");
   
   TEST(1,FEQ1<2>);
   TEST(1,FEQ2<2>);

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.