From: Timo Heister Date: Thu, 18 Apr 2013 19:24:10 +0000 (+0000) Subject: step-42: take over patch for obstacle reading X-Git-Tag: v8.0.0~657 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bbc79943a9e2e8d44804ea276747d64aff84ab37;p=dealii.git step-42: take over patch for obstacle reading git-svn-id: https://svn.dealii.org/trunk@29335 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-42/step-42.cc b/deal.II/examples/step-42/step-42.cc index c85e1d08d7..de28338a59 100644 --- a/deal.II/examples/step-42/step-42.cc +++ b/deal.II/examples/step-42/step-42.cc @@ -214,26 +214,19 @@ namespace Step42 template void Input::read_obstacle (const char* name) { - int SZ = 100000; - FILE* fp = fopen (name, "r"); - char* hlp_str = new char[SZ]; - double hlp; - - fscanf (fp, "%s", hlp_str); - fscanf (fp, "%d", &nx); - fscanf (fp, "%d", &ny); + std::ifstream f(name); + std::string temp; + f >> temp >> nx >> ny; assert(nx>0 && ny>0); for (int k=0; k> val; + obstacle_data.push_back(val); } - fclose (fp); - delete[] hlp_str; - hx = 1.0/(nx - 1); hy = 1.0/(ny - 1); @@ -491,7 +484,8 @@ namespace Step42 Obstacle (std_cxx1x::shared_ptr > const &_input, bool _use_read_obstacle) : Function(dim), input_obstacle_copy(_input), - use_read_obstacle(_use_read_obstacle) {}; + use_read_obstacle(_use_read_obstacle) + {} virtual double value (const Point &p, const unsigned int component = 0) const;