From c1b71860d90b4e8dc95c61855afe352e412ea0e0 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 10 Feb 2010 21:24:37 +0000 Subject: [PATCH] Use the same coefficient as in step-6. git-svn-id: https://svn.dealii.org/trunk@20545 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-16/step-16.cc | 52 ++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 16 deletions(-) diff --git a/deal.II/examples/step-16/step-16.cc b/deal.II/examples/step-16/step-16.cc index 1326e013e9..71206d98bd 100644 --- a/deal.II/examples/step-16/step-16.cc +++ b/deal.II/examples/step-16/step-16.cc @@ -277,11 +277,11 @@ void LaplaceProblem::setup_system () template void LaplaceProblem::assemble_system () { - QGauss quadrature_formula(1+degree); + const QGauss quadrature_formula(degree+1); FEValues fe_values (fe, quadrature_formula, - update_values | update_gradients | - update_quadrature_points | update_JxW_values); + update_values | update_gradients | + 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(); @@ -291,7 +291,10 @@ void LaplaceProblem::assemble_system () std::vector local_dof_indices (dofs_per_cell); - typename DoFHandler::active_cell_iterator + const Coefficient coefficient; + std::vector coefficient_values (n_q_points); + + typename MGDoFHandler::active_cell_iterator cell = mg_dof_handler.begin_active(), endc = mg_dof_handler.end(); for (; cell!=endc; ++cell) @@ -300,16 +303,22 @@ void LaplaceProblem::assemble_system () cell_rhs = 0; fe_values.reinit (cell); + + coefficient.value_list (fe_values.get_quadrature_points(), + coefficient_values); + for (unsigned int q_point=0; q_pointget_dof_indices (local_dof_indices); @@ -382,6 +391,9 @@ void LaplaceProblem::assemble_multigrid () boundary_interface_constraints[level].close (); } + const Coefficient coefficient; + std::vector coefficient_values (n_q_points); + typename MGDoFHandler::cell_iterator cell = mg_dof_handler.begin(), endc = mg_dof_handler.end(); @@ -393,17 +405,19 @@ void LaplaceProblem::assemble_multigrid () // by update flags above. fe_values.reinit (cell); + coefficient.value_list (fe_values.get_quadrature_points(), + coefficient_values); + // This is exactly the // integration loop of the cell // matrix above. for (unsigned int q_point=0; q_point::solve () << std::endl; } + + template void LaplaceProblem::refine_grid () { @@ -552,6 +568,8 @@ void LaplaceProblem::refine_grid () triangulation.execute_coarsening_and_refinement (); } + + template void LaplaceProblem::output_results (const unsigned int cycle) const { @@ -570,6 +588,8 @@ void LaplaceProblem::output_results (const unsigned int cycle) const data_out.write_vtk (output); } + + template void LaplaceProblem::run () { -- 2.39.5