From: Wolfgang Bangerth Date: Mon, 22 Jun 2009 15:25:20 +0000 (+0000) Subject: Deal with the potential. Read parameters from file. X-Git-Tag: v8.0.0~7599 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf22752dc037a0989f5c71617a55c39be7130409;p=dealii.git Deal with the potential. Read parameters from file. git-svn-id: https://svn.dealii.org/trunk@18951 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-36/step-36.cc b/deal.II/examples/step-36/step-36.cc index 9045ff7b01..7282b86472 100644 --- a/deal.II/examples/step-36/step-36.cc +++ b/deal.II/examples/step-36/step-36.cc @@ -53,7 +53,7 @@ template class EigenvalueProblem { public: - EigenvalueProblem (); + EigenvalueProblem (const std::string &prm_file); void run (); private: @@ -79,7 +79,7 @@ class EigenvalueProblem // @sect4{EigenvalueProblem::EigenvalueProblem} template -EigenvalueProblem::EigenvalueProblem () +EigenvalueProblem::EigenvalueProblem (const std::string &prm_file) : fe (1), dof_handler (triangulation) @@ -91,6 +91,8 @@ EigenvalueProblem::EigenvalueProblem () parameters.declare_entry ("Potential", "0", Patterns::Anything(), "A functional description of the potential."); + + parameters.read_input (prm_file); } @@ -123,7 +125,7 @@ void EigenvalueProblem::assemble_system () FEValues fe_values (fe, quadrature_formula, update_values | update_gradients | - update_JxW_values); + update_quadrature_points | update_JxW_values); const unsigned int dofs_per_cell = fe.dofs_per_cell; const unsigned int n_q_points = quadrature_formula.size(); @@ -139,6 +141,7 @@ void EigenvalueProblem::assemble_system () "x,y,z"), parameters.get ("Potential"), typename FunctionParser::ConstMap()); + std::vector potential_values (n_q_points); ConstraintMatrix constraints; VectorTools::interpolate_boundary_values (dof_handler, @@ -156,13 +159,20 @@ void EigenvalueProblem::assemble_system () cell_stiffness_matrix = 0; cell_mass_matrix = 0; + potential.value_list (fe_values.get_quadrature_points(), + potential_values); + for (unsigned int q_point=0; q_point laplace_problem_2d; - laplace_problem_2d.run (); + EigenvalueProblem<2> problem ("step-36.prm"); + problem.run (); } catch (std::exception &exc) {