]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Minor edits.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 23 Sep 2013 13:39:34 +0000 (13:39 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 23 Sep 2013 13:39:34 +0000 (13:39 +0000)
git-svn-id: https://svn.dealii.org/trunk@30892 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/examples/step-42/step-42.cc

index 717b2a5384622773c4d6ae1da420a87611408130..37f3257cf9973222bad8ceeb56ed7e1da5b06b5f 100644 (file)
@@ -114,10 +114,8 @@ namespace Step42
     class Input
     {
       public:
-        Input (
-            const char* _name)
+        Input (const std::string &name)
             :
-                name(_name),
                 mpi_communicator(MPI_COMM_WORLD),
                 pcout(std::cout,
                     (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)),
@@ -135,15 +133,13 @@ namespace Step42
             int i, int j);
 
         double
-        obstacle_function (
-            double x, double y);
+        obstacle_function (const double x,
+                                   const double y);
 
         void
-        read_obstacle (
-            const char* name);
+        read_obstacle (const std::string name);
 
       private:
-        const char* name;
         MPI_Comm mpi_communicator;
         ConditionalOStream pcout;
         std::vector<double> obstacle_data;
@@ -155,8 +151,8 @@ namespace Step42
 // to provide the proper value of the obstacle.
   template <int dim>
     double
-    Input<dim>::hv (
-        int i, int j)
+    Input<dim>::hv (const int i,
+                       const int j)
     {
       assert(i >= 0 && i < nx);
       assert(j >= 0 && j < ny);
@@ -167,8 +163,8 @@ namespace Step42
 // value in the point (x,y).
   template <int dim>
     double
-    Input<dim>::obstacle_function (
-        double x, double y)
+    Input<dim>::obstacle_function (const double x,
+                                      const double y)
     {
       int ix = (int) (x / hx);
       int iy = (int) (y / hy);
@@ -240,10 +236,9 @@ namespace Step42
 // obstacle_data. It will be used only in run ().
   template <int dim>
     void
-    Input<dim>::read_obstacle (
-        const char* name)
+    Input<dim>::read_obstacle (const std::string name)
     {
-      std::ifstream f(name);
+      std::ifstream f(name.c_str());
 
       std::string temp;
       f >> temp >> nx >> ny;

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.