From 07af8c667d15e3c79a9ea255f77bccdcc8382556 Mon Sep 17 00:00:00 2001 From: bangerth Date: Mon, 23 Sep 2013 13:39:34 +0000 Subject: [PATCH] Minor edits. git-svn-id: https://svn.dealii.org/trunk@30892 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-42/step-42.cc | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/deal.II/examples/step-42/step-42.cc b/deal.II/examples/step-42/step-42.cc index 717b2a5384..37f3257cf9 100644 --- a/deal.II/examples/step-42/step-42.cc +++ b/deal.II/examples/step-42/step-42.cc @@ -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 obstacle_data; @@ -155,8 +151,8 @@ namespace Step42 // to provide the proper value of the obstacle. template double - Input::hv ( - int i, int j) + Input::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 double - Input::obstacle_function ( - double x, double y) + Input::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 void - Input::read_obstacle ( - const char* name) + Input::read_obstacle (const std::string name) { - std::ifstream f(name); + std::ifstream f(name.c_str()); std::string temp; f >> temp >> nx >> ny; -- 2.39.5