]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Utilize the C++11 constructors of std::[io]stream taking a std::string. 6529/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Tue, 8 May 2018 09:18:18 +0000 (17:18 +0800)
committerWolfgang Bangerth <bangerth@colostate.edu>
Tue, 8 May 2018 10:45:24 +0000 (18:45 +0800)
Previously, we had widely used the constructors that take a char* and for that needed
to call the '.c_str()' function of std::string. This is now no longer necessary in C++11.

33 files changed:
examples/step-10/step-10.cc
examples/step-12/step-12.cc
examples/step-18/step-18.cc
examples/step-19/step-19.cc
examples/step-23/step-23.cc
examples/step-24/step-24.cc
examples/step-25/step-25.cc
examples/step-26/step-26.cc
examples/step-27/step-27.cc
examples/step-28/step-28.cc
examples/step-29/step-29.cc
examples/step-30/step-30.cc
examples/step-32/step-32.cc
examples/step-33/step-33.cc
examples/step-34/step-34.cc
examples/step-35/step-35.cc
examples/step-37/step-37.cc
examples/step-38/step-38.cc
examples/step-39/step-39.cc
examples/step-40/step-40.cc
examples/step-41/step-41.cc
examples/step-42/step-42.cc
examples/step-43/step-43.cc
examples/step-45/step-45.cc
examples/step-47/step-47.cc
examples/step-48/step-48.cc
examples/step-50/step-50.cc
examples/step-51/step-51.cc
examples/step-52/step-52.cc
examples/step-53/step-53.cc
examples/step-54/step-54.cc
examples/step-55/step-55.cc
examples/step-7/step-7.cc

index dee12d256184796774f23388eee5ab1bd9ea8767..935a287a30a9b716bc1a9e053350430f4108fca0 100644 (file)
@@ -140,7 +140,7 @@ namespace Step10
                                    + "_mapping_q_"
                                    + Utilities::to_string(degree)
                                    + ".dat";
-            std::ofstream gnuplot_file (filename.c_str());
+            std::ofstream gnuplot_file (filename);
 
             // Then write out the triangulation to this file. The last
             // argument of the function is a pointer to a mapping object. This
index 377deb456083789eaef28edbeb44775d274b703f..85a08cfd344f0d0ead5f7f1ae7007a65a7576a90 100644 (file)
@@ -571,7 +571,7 @@ namespace Step12
     {
       const std::string filename = "grid-" + std::to_string(cycle) + ".eps";
       deallog << "Writing grid to <" << filename << ">" << std::endl;
-      std::ofstream eps_output (filename.c_str());
+      std::ofstream eps_output (filename);
 
       GridOut grid_out;
       grid_out.write_eps (triangulation, eps_output);
@@ -581,7 +581,7 @@ namespace Step12
     {
       const std::string filename = "sol-" + std::to_string(cycle) + ".gnuplot";
       deallog << "Writing solution to <" << filename << ">" << std::endl;
-      std::ofstream gnuplot_output (filename.c_str());
+      std::ofstream gnuplot_output (filename);
 
       DataOut<dim> data_out;
       data_out.attach_dof_handler (dof_handler);
index ca443dff8e9cb172e3f8b5f1d135905f26434267..6c097f45f3a391164bd0e146b700a845af534e55 100644 (file)
@@ -1333,7 +1333,7 @@ namespace Step18
 
     // With the so-completed filename, let us open a file and write the data
     // we have generated into it:
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
     data_out.write_vtu (output);
 
     // The record files must be written only once and not by each processor,
@@ -1353,7 +1353,7 @@ namespace Step18
         visit_master_filename = ("solution-" +
                                  Utilities::int_to_string(timestep_no,4) +
                                  ".visit");
-        std::ofstream visit_master (visit_master_filename.c_str());
+        std::ofstream visit_master (visit_master_filename);
         DataOutBase::write_visit_record (visit_master, filenames);
 
         // Similarly, we write the paraview .pvtu:
@@ -1361,7 +1361,7 @@ namespace Step18
         pvtu_master_filename = ("solution-" +
                                 Utilities::int_to_string(timestep_no,4) +
                                 ".pvtu");
-        std::ofstream pvtu_master (pvtu_master_filename.c_str());
+        std::ofstream pvtu_master (pvtu_master_filename);
         data_out.write_pvtu_record (pvtu_master, filenames);
 
         // Finally, we write the paraview record, that references all .pvtu files and
index 405f55f75d8d99c391cdb0056edfb810160f28eb..7dcc3b2f93a30083fc9d95110d4545b17787a8c5 100644 (file)
@@ -372,7 +372,7 @@ namespace Step19
     DataOutReader<dim,spacedim> merged_data;
 
     {
-      std::ifstream input (input_file_names[0].c_str());
+      std::ifstream input (input_file_names[0]);
       AssertThrow (input, ExcIO());
 
       merged_data.read (input);
@@ -382,7 +382,7 @@ namespace Step19
     // object, and then merge that into the first object declared above:
     for (unsigned int i=1; i<input_file_names.size(); ++i)
       {
-        std::ifstream input (input_file_names[i].c_str());
+        std::ifstream input (input_file_names[i]);
         AssertThrow (input, ExcIO());
 
         DataOutReader<dim,spacedim> additional_data;
@@ -398,7 +398,7 @@ namespace Step19
     // the command line. Note that this ensures that if the library acquires
     // the ability to output in other output formats, this program will be
     // able to make use of this ability without having to be changed!
-    std::ofstream output_stream (output_file.c_str());
+    std::ofstream output_stream (output_file);
     AssertThrow (output_stream, ExcIO());
 
     const DataOutBase::OutputFormat format
@@ -436,7 +436,7 @@ namespace Step19
     AssertThrow (input_file_names.size() > 0,
                  ExcMessage ("No input files specified."));
 
-    std::ifstream input(input_file_names[0].c_str());
+    std::ifstream input(input_file_names[0]);
     AssertThrow (input, ExcIO());
 
     const std::pair<unsigned int, unsigned int>
index 7fc666c068144f3de20964c11736f6171282e39d..c38e3b75e69523ea1b3c66b7e01c8a33c7764ecb 100644 (file)
@@ -459,7 +459,7 @@ namespace Step23
     const std::string filename = "solution-" +
                                  Utilities::int_to_string (timestep_number, 3) +
                                  ".gnuplot";
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
     data_out.write_gnuplot (output);
   }
 
index ec58e5ad16f199494bdc98819d6e592df5a41cb0..497cd74b250d25be43d3ff41d8ca5aacc7481694 100644 (file)
@@ -459,7 +459,7 @@ namespace Step24
     const std::string filename =  "solution-" +
                                   Utilities::int_to_string (timestep_number, 3) +
                                   ".gnuplot";
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
     data_out.write_gnuplot (output);
   }
 
index 1ad752881e21ccd2bd7aa943aeb87c84782fc9af..1f9462df7adf553caee179cc89e6c4779a4decd0 100644 (file)
@@ -579,7 +579,7 @@ namespace Step25
                                   Utilities::int_to_string (timestep_number, 3) +
                                   ".vtk";
 
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
     data_out.write_vtk (output);
   }
 
index ef6c9c65985a56096dc0b7c9f4299e056bf846ee..c5dbd996e0f1a600b31d76aa3612fa308c5b1006 100644 (file)
@@ -309,7 +309,7 @@ namespace Step26
     const std::string filename = "solution-"
                                  + Utilities::int_to_string(timestep_number, 3) +
                                  ".vtk";
-    std::ofstream output(filename.c_str());
+    std::ofstream output(filename);
     data_out.write_vtk(output);
   }
 
index 7584c6aaf895aceda1ebfa96049148ce6d2a82e5..3dd1d5f9681280a0168df2f22d4a2b9e1fb25ce7 100644 (file)
@@ -474,7 +474,7 @@ namespace Step27
       const std::string filename = "solution-" +
                                    Utilities::int_to_string (cycle, 2) +
                                    ".vtk";
-      std::ofstream output (filename.c_str());
+      std::ofstream output (filename);
       data_out.write_vtk (output);
     }
 
index fb1cd29136e8d2560025f259b553c8b787c79dbe..87efdc13dda33142b901058f6b1650a61db66638 100644 (file)
@@ -1153,7 +1153,7 @@ namespace Step28
     data_out.add_data_vector (solution, "solution");
     data_out.build_patches ();
 
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
     data_out.write_vtu (output);
   }
 
index 66e7d7b7dc33498a7cf0dcb2d52c6571f2a47ad6..9cc11cda531c9ae71154475230b8aee1053bf8fc 100644 (file)
@@ -863,7 +863,7 @@ namespace Step29
     const std::string filename = output_file +
                                  data_out.default_suffix();
 
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
 
     // The solution vectors $v$ and $w$ are added to the DataOut object in the
     // usual way:
index b67f895e65317c3742f063eb9dd5083f1ff5faff..b82663e6c9de4d7c321ee85aa25ad0db9731149f 100644 (file)
@@ -875,7 +875,7 @@ namespace Step30
 
     filename += refine_type + ".eps";
     std::cout << "Writing grid to <" << filename << ">..." << std::endl;
-    std::ofstream eps_output (filename.c_str());
+    std::ofstream eps_output (filename);
 
     GridOut grid_out;
     grid_out.write_eps (triangulation, eps_output);
@@ -886,7 +886,7 @@ namespace Step30
 
     filename += refine_type + ".gnuplot";
     std::cout << "Writing grid to <" << filename << ">..." << std::endl;
-    std::ofstream gnuplot_grid_output (filename.c_str());
+    std::ofstream gnuplot_grid_output (filename);
 
     grid_out.write_gnuplot (triangulation, gnuplot_grid_output);
 
@@ -897,7 +897,7 @@ namespace Step30
     filename += refine_type + ".gnuplot";
     std::cout << "Writing solution to <" << filename << ">..."
               << std::endl;
-    std::ofstream gnuplot_output (filename.c_str());
+    std::ofstream gnuplot_output (filename);
 
     DataOut<dim> data_out;
     data_out.attach_dof_handler (dof_handler);
index b30614739ce8cbfe0791e390aa50b2a8330daf00..9018bb525cd9415ec95b28afb5723e06dfbe7273 100644 (file)
@@ -1032,13 +1032,13 @@ namespace Step32
     ParameterHandler prm;
     BoussinesqFlowProblem<dim>::Parameters::declare_parameters (prm);
 
-    std::ifstream parameter_file (parameter_filename.c_str());
+    std::ifstream parameter_file (parameter_filename);
 
     if (!parameter_file)
       {
         parameter_file.close ();
 
-        std::ofstream parameter_out (parameter_filename.c_str());
+        std::ofstream parameter_out (parameter_filename);
         prm.print_parameters (parameter_out,
                               ParameterHandler::Text);
 
@@ -3404,7 +3404,7 @@ namespace Step32
                                   Utilities::int_to_string
                                   (triangulation.locally_owned_subdomain(), 4) +
                                   ".vtu");
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
     data_out.write_vtu (output);
 
 
@@ -3428,14 +3428,14 @@ namespace Step32
         pvtu_master_filename = ("solution-" +
                                 Utilities::int_to_string (out_index, 5) +
                                 ".pvtu");
-        std::ofstream pvtu_master (pvtu_master_filename.c_str());
+        std::ofstream pvtu_master (pvtu_master_filename);
         data_out.write_pvtu_record (pvtu_master, filenames);
 
         const std::string
         visit_master_filename = ("solution-" +
                                  Utilities::int_to_string (out_index, 5) +
                                  ".visit");
-        std::ofstream visit_master (visit_master_filename.c_str());
+        std::ofstream visit_master (visit_master_filename);
         DataOutBase::write_visit_record (visit_master, filenames);
       }
 
index c26ef8389dbb880d45fc2b27353450561e28316a..d608e947684ea027bfd68ce1627ee43f2cdbe724 100644 (file)
@@ -2305,7 +2305,7 @@ namespace Step33
     std::string filename = "solution-" +
                            Utilities::int_to_string (output_file_number, 3) +
                            ".vtk";
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
     data_out.write_vtk (output);
 
     ++output_file_number;
@@ -2332,7 +2332,7 @@ namespace Step33
       GridIn<dim> grid_in;
       grid_in.attach_triangulation(triangulation);
 
-      std::ifstream input_file(parameters.mesh_filename.c_str());
+      std::ifstream input_file(parameters.mesh_filename);
       Assert (input_file, ExcFileNotOpen(parameters.mesh_filename.c_str()));
 
       grid_in.read_ucd(input_file);
index 02bbd62e4472b5431fa34864f74143c798d1d920..81b375ef0d589a560ff4a2b0423a638b35953527 100644 (file)
@@ -1002,7 +1002,7 @@ namespace Step34
 
     const std::string
     filename = Utilities::int_to_string(dim) + "d_external.vtk";
-    std::ofstream file(filename.c_str());
+    std::ofstream file(filename);
 
     data_out.write_vtk(file);
   }
@@ -1030,7 +1030,7 @@ namespace Step34
                              "d_boundary_solution_" +
                              Utilities::int_to_string(cycle) +
                              ".vtk" );
-    std::ofstream file(filename.c_str());
+    std::ofstream file(filename);
 
     dataout.write_vtk(file);
 
index c38655f2038cc20724934d92abd199136404fee5..755bbcb377982a429e56e9b528b8a320a069724a 100644 (file)
@@ -709,7 +709,7 @@ namespace Step35
 
     {
       std::string filename = "nsbench2.inp";
-      std::ifstream file (filename.c_str());
+      std::ifstream file (filename);
       Assert (file, ExcFileNotOpen (filename.c_str()));
       grid_in.read_ucd (file);
     }
@@ -1354,9 +1354,9 @@ namespace Step35
                               DataOut<dim>::type_dof_data,
                               component_interpretation);
     data_out.build_patches (deg + 1);
-    std::ofstream output (("solution-" +
-                           Utilities::int_to_string (step, 5) +
-                           ".vtk").c_str());
+    std::ofstream output ("solution-" +
+                          Utilities::int_to_string (step, 5) +
+                          ".vtk");
     data_out.write_vtk (output);
   }
 
index 2f503cf8008e606fc7bd7a0d4ed0ad1c2d6707a6..421e29a2aeb40b9c6119b7de2c36d759def5138b 100644 (file)
@@ -1146,7 +1146,7 @@ namespace Step37
                                  + ".vtu");
 
         std::string master_name = "solution-" + Utilities::to_string(cycle) + ".pvtu";
-        std::ofstream master_output (master_name.c_str());
+        std::ofstream master_output (master_name);
         data_out.write_pvtu_record (master_output, filenames);
       }
   }
index e8ed60460e1825da13e99f138dd09cca642589c0..a26305bdd2c490587db68777f3f24e8ba9fe0d1e 100644 (file)
@@ -496,7 +496,7 @@ namespace Step38
     std::string filename ("solution-");
     filename += static_cast<char>('0'+spacedim);
     filename += "d.vtk";
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
     data_out.write_vtk (output);
   }
 
index 7b5ddef70d38819d09526fe54c82827705a10e04..81a84479f96d4b6d1105fe14cbab528f7a1c7197 100644 (file)
@@ -871,7 +871,7 @@ namespace Step39
 
     deallog << "Writing solution to <" << filename << ">..."
             << std::endl << std::endl;
-    std::ofstream gnuplot_output (filename.c_str());
+    std::ofstream gnuplot_output (filename);
 
     DataOut<dim> data_out;
     data_out.attach_dof_handler (dof_handler);
index d4ac20a7a4db078a741b722767e654e012512f5c..e0f519ea8e03443301ae3c88597b879511c148dd 100644 (file)
@@ -597,7 +597,7 @@ namespace Step40
                                   "." +
                                   Utilities::int_to_string
                                   (triangulation.locally_owned_subdomain(), 4));
-    std::ofstream output ((filename + ".vtu").c_str());
+    std::ofstream output ((filename + ".vtu"));
     data_out.write_vtu (output);
 
     // The last step is to write a "master record" that lists for the
@@ -619,9 +619,9 @@ namespace Step40
                                Utilities::int_to_string (i, 4) +
                                ".vtu");
 
-        std::ofstream master_output (("solution-" +
-                                      Utilities::int_to_string (cycle, 2) +
-                                      ".pvtu").c_str());
+        std::ofstream master_output ("solution-" +
+                                     Utilities::int_to_string (cycle, 2) +
+                                     ".pvtu");
         data_out.write_pvtu_record (master_output, filenames);
       }
   }
index 948caed7afbb8dcbc6c0f790f5aa2eaad594cd90..7b40fff7d101c87735e27b62b105b31b7e937734 100644 (file)
@@ -601,9 +601,9 @@ namespace Step41
 
     data_out.build_patches ();
 
-    std::ofstream output_vtk ((std::string("output_") +
-                               Utilities::int_to_string (iteration, 3) +
-                               ".vtk").c_str ());
+    std::ofstream output_vtk (std::string("output_") +
+                              Utilities::int_to_string (iteration, 3) +
+                              ".vtk");
     data_out.write_vtk (output_vtk);
   }
 
index c85bc0621a7946c94b428c18b6a8e3a8828ceac2..e0577f7e446686a9cdeaaa304e02b573e3710e1d 100644 (file)
@@ -478,7 +478,7 @@ namespace Step42
       nx(0),
       ny(0)
     {
-      std::ifstream f(name.c_str());
+      std::ifstream f(name);
       AssertThrow (f, ExcMessage (std::string("Can't read from file <") +
                                   name + ">!"));
 
@@ -2055,7 +2055,7 @@ namespace Step42
       (output_dir + filename_base + "-"
        + Utilities::int_to_string(triangulation.locally_owned_subdomain(), 4));
 
-    std::ofstream output_vtu((filename + ".vtu").c_str());
+    std::ofstream output_vtu((filename + ".vtu"));
     data_out.write_vtu(output_vtu);
     pcout << output_dir + filename_base << ".pvtu" << std::endl;
 
@@ -2068,10 +2068,10 @@ namespace Step42
                               Utilities::int_to_string(i, 4) +
                               ".vtu");
 
-        std::ofstream pvtu_master_output((output_dir + filename_base + ".pvtu").c_str());
+        std::ofstream pvtu_master_output((output_dir + filename_base + ".pvtu"));
         data_out.write_pvtu_record(pvtu_master_output, filenames);
 
-        std::ofstream visit_master_output((output_dir + filename_base + ".visit").c_str());
+        std::ofstream visit_master_output((output_dir + filename_base + ".visit"));
         DataOutBase::write_visit_record(visit_master_output, filenames);
       }
 
index b66fb7827d681617c087d828b8057613f692a6e9..43785e623c7ae9dbd86334025e5cc955b4aab4a6 100644 (file)
@@ -1843,7 +1843,7 @@ namespace Step43
 
     std::string filename = "solution-" +
                            Utilities::int_to_string (timestep_number, 5) + ".vtu";
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
     data_out.write_vtu (output);
   }
 
index 17427d670bdac307284d86dc18da6d09cf52cb7f..1b708bde6b76f8909fe006d04554c3c602ad0229 100644 (file)
@@ -691,7 +691,7 @@ namespace Step45
         pvtu_master_filename = ("solution-" +
                                 Utilities::int_to_string (refinement_cycle, 2) +
                                 ".pvtu");
-        std::ofstream pvtu_master (pvtu_master_filename.c_str());
+        std::ofstream pvtu_master (pvtu_master_filename);
         data_out.write_pvtu_record (pvtu_master, filenames);
       }
   }
index 08ba0d2afa46be1bd3c7c6fbcd9c5c27cba847e4..5e431f88bcf2e056cb6990d42c33ac4e0345b468 100644 (file)
@@ -591,7 +591,7 @@ namespace Step47
         //std::endl; std::cout << F << std::endl;
 
         std::string filename = "vertices.dat";
-        std::ofstream output (filename.c_str());
+        std::ofstream output (filename);
         output << "#vertices of xfem subcells" << std::endl;
         output << v0(0) << "   " << v0(1) << std::endl;
         output << v1(0) << "   " << v1(1) << std::endl;
@@ -718,7 +718,7 @@ namespace Step47
         //std::cout << "Pos " << Pos << std::endl; std::cout << A <<
         //std::endl; std::cout << B << std::endl;
         std::string filename = "vertices.dat";
-        std::ofstream output (filename.c_str());
+        std::ofstream output (filename);
         output << "#vertices of xfem subcells" << std::endl;
         output << A(0) << "   " << A(1) << std::endl;
         output << B(0) << "   " << B(1) << std::endl;
@@ -987,7 +987,7 @@ namespace Step47
     filename += ('0' + cycle);
     filename += ".vtk";
 
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
 
     Postprocessor<dim> postprocessor;
     DataOut<dim,hp::DoFHandler<dim> > data_out;
index b30a9e79aa9dfebd75eccebc2098ce97151cddb5..56e6d13d65626cca0ee52d5b7de47580d02ad412 100644 (file)
@@ -486,9 +486,9 @@ namespace Step48
     const std::string filename =
       "solution-" + Utilities::int_to_string (timestep_number, 3);
 
-    std::ofstream output ((filename +
-                           "." + Utilities::int_to_string (Utilities::MPI::
-                                                           this_mpi_process(MPI_COMM_WORLD),4) + ".vtu").c_str());
+    std::ofstream output (filename +
+                          "." + Utilities::int_to_string (Utilities::MPI::
+                                                          this_mpi_process(MPI_COMM_WORLD),4) + ".vtu");
     data_out.write_vtu (output);
 
     if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
@@ -502,7 +502,7 @@ namespace Step48
                                Utilities::int_to_string (i, 4) +
                                ".vtu");
 
-        std::ofstream master_output ((filename + ".pvtu").c_str());
+        std::ofstream master_output ((filename + ".pvtu"));
         data_out.write_pvtu_record (master_output, filenames);
       }
   }
index b3b72678412dde1985c1a57a0c9530df450eb037..5d1b2ca59179d0c1a4dda448873e495695d3ca3c 100644 (file)
@@ -877,7 +877,7 @@ namespace Step50
                                   Utilities::int_to_string
                                   (triangulation.locally_owned_subdomain(), 4) +
                                   ".vtu");
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
     data_out.write_vtu (output);
 
     if (Utilities::MPI::this_mpi_process(MPI_COMM_WORLD) == 0)
@@ -893,14 +893,14 @@ namespace Step50
         pvtu_master_filename = ("solution-" +
                                 Utilities::int_to_string (cycle, 5) +
                                 ".pvtu");
-        std::ofstream pvtu_master (pvtu_master_filename.c_str());
+        std::ofstream pvtu_master (pvtu_master_filename);
         data_out.write_pvtu_record (pvtu_master, filenames);
 
         const std::string
         visit_master_filename = ("solution-" +
                                  Utilities::int_to_string (cycle, 5) +
                                  ".visit");
-        std::ofstream visit_master (visit_master_filename.c_str());
+        std::ofstream visit_master (visit_master_filename);
         DataOutBase::write_visit_record (visit_master, filenames);
 
         std::cout << "   wrote " << pvtu_master_filename << std::endl;
index 81f3a17e86317cfe3485c60a1adb183678fc2fad..2352760087540281d2616c2880f051af7ddb7d6f 100644 (file)
@@ -1204,7 +1204,7 @@ namespace Step51
     filename += "-q" + Utilities::int_to_string(fe.degree,1);
     filename += "-" + Utilities::int_to_string(cycle,2);
     filename += ".vtk";
-    std::ofstream output (filename.c_str());
+    std::ofstream output (filename);
 
     DataOut<dim> data_out;
 
@@ -1235,7 +1235,7 @@ namespace Step51
     face_out += "-q" + Utilities::int_to_string(fe.degree,1);
     face_out += "-" + Utilities::int_to_string(cycle,2);
     face_out += ".vtk";
-    std::ofstream face_output (face_out.c_str());
+    std::ofstream face_output (face_out);
 
 // The <code>DataOutFaces</code> class works analogously to the <code>DataOut</code>
 // class when we have a <code>DoFHandler</code> that defines the solution on
index 99756c413f8cfb1ad5b9d8479a61ef4de325f1f0..7bd3009c6c112794186f4d329361d059ff7b5aed 100644 (file)
@@ -453,7 +453,7 @@ namespace Step52
     const std::string filename = "solution-" + method_name + "-" +
                                  Utilities::int_to_string (time_step, 3) +
                                  ".vtu";
-    std::ofstream output(filename.c_str());
+    std::ofstream output(filename);
     data_out.write_vtu(output);
   }
 
index 2898fdb2c36f9c07e994a20e12f5e6f05335a89f..02e8c15ce2619534c8914f2babc13791dc4a5d43 100644 (file)
@@ -453,7 +453,7 @@ namespace Step53
 
     // Having done this all, we can now output the mesh into a file of its own:
     const std::string filename = "mesh.vtu";
-    std::ofstream out (filename.c_str());
+    std::ofstream out (filename);
     GridOut grid_out;
     grid_out.write_vtu (triangulation, out);
   }
index d2e182e92cf4988854a4af6bfac5ed98bdea1e04..ba15f03589f7f4222a7fbb6fd3c28cb1443a4528 100644 (file)
@@ -225,7 +225,7 @@ namespace Step54
     // mesh from an external VTK file, and convert it to a deal triangulation.
     std::ifstream in;
 
-    in.open(initial_mesh_filename.c_str());
+    in.open(initial_mesh_filename);
 
     GridIn<2,3> gi;
     gi.attach_triangulation(tria);
@@ -363,7 +363,7 @@ namespace Step54
     const std::string filename = ( output_filename + "_" +
                                    Utilities::int_to_string(cycle) +
                                    ".vtk" );
-    std::ofstream logfile(filename.c_str());
+    std::ofstream logfile(filename);
     GridOut grid_out;
     grid_out.write_vtk(tria, logfile);
   }
index 2da991de8da589240db2b437c32e3d863e91f37b..364d056f7abbd32a7c4004a14adc55f6ebb377ca 100644 (file)
@@ -773,7 +773,7 @@ namespace Step55
                                   "." +
                                   Utilities::int_to_string
                                   (triangulation.locally_owned_subdomain(), 4));
-    std::ofstream output ((filename + ".vtu").c_str());
+    std::ofstream output ((filename + ".vtu"));
     data_out.write_vtu (output);
 
     if (Utilities::MPI::this_mpi_process(mpi_communicator) == 0)
@@ -788,9 +788,9 @@ namespace Step55
                                Utilities::int_to_string (i, 4) +
                                ".vtu");
 
-        std::ofstream master_output (("solution-" +
-                                      Utilities::int_to_string (cycle, 2) +
-                                      ".pvtu").c_str());
+        std::ofstream master_output ("solution-" +
+                                     Utilities::int_to_string (cycle, 2) +
+                                     ".pvtu");
         data_out.write_pvtu_record (master_output, filenames);
       }
   }
index 2801651f875f3a5c9716710bfafdfb1c7bd4c98e..e12e35ad4eeff7e5c1a21e98b71c3e23d5f7766b 100644 (file)
@@ -1081,7 +1081,7 @@ namespace Step7
     // appropriate for VTK output, open a file, and add the solution vector to
     // the object that will do the actual output:
     vtk_filename += ".vtk";
-    std::ofstream output (vtk_filename.c_str());
+    std::ofstream output (vtk_filename);
 
     DataOut<dim> data_out;
     data_out.attach_dof_handler (dof_handler);
@@ -1198,7 +1198,7 @@ namespace Step7
       }
 
     error_filename += ".tex";
-    std::ofstream error_table_file(error_filename.c_str());
+    std::ofstream error_table_file(error_filename);
 
     convergence_table.write_tex(error_table_file);
 
@@ -1283,7 +1283,7 @@ namespace Step7
           }
         conv_filename += ".tex";
 
-        std::ofstream table_file(conv_filename.c_str());
+        std::ofstream table_file(conv_filename);
         convergence_table.write_tex(table_file);
       }
   }

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.