From: bangerth Date: Fri, 27 Sep 2013 13:10:22 +0000 (+0000) Subject: Move initialization of obstacle into constructor of main class. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1701a782d4ef61a05aa15d0dcf2744b40902ec8e;p=dealii-svn.git Move initialization of obstacle into constructor of main class. git-svn-id: https://svn.dealii.org/trunk@30984 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 bcb91e5fce..022d0f8891 100644 --- a/deal.II/examples/step-42/step-42.cc +++ b/deal.II/examples/step-42/step-42.cc @@ -702,7 +702,6 @@ namespace Step42 }; typename RefinementStrategy::value refinement_strategy; unsigned int n_cycles; - std::string obstacle_filename; std::string output_dir; bool transfer_solution; std::string base_mesh; @@ -715,8 +714,8 @@ namespace Step42 // above. As before, we will write everything template - PlasticityContactProblem::PlasticityContactProblem ( - const ParameterHandler &prm) + PlasticityContactProblem:: + PlasticityContactProblem (const ParameterHandler &prm) : mpi_communicator(MPI_COMM_WORLD), triangulation(mpi_communicator), @@ -746,7 +745,12 @@ namespace Step42 throw ExcNotImplemented(); n_cycles = prm.get_integer("number of cycles"); - obstacle_filename = prm.get("obstacle filename"); + const std::string obstacle_filename = prm.get("obstacle filename"); + if (obstacle_filename != "") + obstacle.reset (new EquationData::ChineseObstacle(obstacle_filename, (base_mesh == "box" ? 1.0 : 0.5))); + else + obstacle.reset (new EquationData::SphereObstacle((base_mesh == "box" ? 1.0 : 0.5))); + output_dir = prm.get("output directory"); if (output_dir != "" && *(output_dir.rbegin()) != '/') output_dir += "/"; @@ -1944,13 +1948,6 @@ namespace Step42 void PlasticityContactProblem::run () { - if (obstacle_filename != "") - obstacle.reset (new EquationData::ChineseObstacle(obstacle_filename, (base_mesh == "box" ? 1.0 : 0.5))); - else - obstacle.reset (new EquationData::SphereObstacle((base_mesh == "box" ? 1.0 : 0.5))); - - - computing_timer.reset(); for (cycle = 0; cycle < n_cycles; ++cycle) {