From: Wolfgang Bangerth Date: Thu, 16 May 2013 12:44:16 +0000 (+0000) Subject: Move slightly forward. X-Git-Tag: v8.0.0~517 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1d37d64ed3d8600094feca7db8f6cb6026daff2;p=dealii.git Move slightly forward. git-svn-id: https://svn.dealii.org/trunk@29519 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/examples/step-26/step-26.cc b/deal.II/examples/step-26/step-26.cc index a4528ae963..0d4da01968 100644 --- a/deal.II/examples/step-26/step-26.cc +++ b/deal.II/examples/step-26/step-26.cc @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -172,8 +173,6 @@ namespace Step26 template void HeatEquation::setup_system() { -//TODO: we need to take care of constraints here! :-) - dof_handler.distribute_dofs(fe); std::cout << std::endl @@ -185,12 +184,17 @@ namespace Step26 << std::endl << std::endl; - sparsity_pattern.reinit(dof_handler.n_dofs(), - dof_handler.n_dofs(), - dof_handler.max_couplings_between_dofs()); + constraints.clear (); + DoFTools::make_hanging_node_constraints (dof_handler, + constraints); + constraints.close(); + + CompressedSparsityPattern c_sparsity(dof_handler.n_dofs()); DoFTools::make_sparsity_pattern(dof_handler, - sparsity_pattern); - sparsity_pattern.compress(); + c_sparsity, + constraints, + /*keep_constrained_dofs = */ true); + sparsity_pattern.copy_from(c_sparsity); mass_matrix.reinit(sparsity_pattern); laplace_matrix.reinit(sparsity_pattern); @@ -198,16 +202,18 @@ namespace Step26 MatrixCreator::create_mass_matrix(dof_handler, QGauss(fe.degree+1), - mass_matrix); + mass_matrix, + (const Function*)0, + constraints); MatrixCreator::create_laplace_matrix(dof_handler, QGauss(fe.degree+1), - laplace_matrix); + laplace_matrix, + (const Function*)0, + constraints); solution.reinit(dof_handler.n_dofs()); old_solution.reinit(dof_handler.n_dofs()); system_rhs.reinit(dof_handler.n_dofs()); - - constraints.close(); } @@ -223,6 +229,8 @@ namespace Step26 cg.solve(system_matrix, solution, system_rhs, preconditioner); + constraints.distribute(solution); + std::cout << " " << solver_control.last_step() << " CG iterations." << std::endl; } @@ -362,8 +370,8 @@ namespace Step26 template void HeatEquation::run() { - const unsigned int initial_global_refinement = (dim == 2 ? 4 : 2); - const unsigned int n_adaptive_pre_refinement_steps = 3; + const unsigned int initial_global_refinement = (dim == 2 ? 1 : 2); + const unsigned int n_adaptive_pre_refinement_steps = 1; GridGenerator::hyper_L (triangulation); triangulation.refine_global (initial_global_refinement); @@ -440,6 +448,8 @@ start_time_iteration: system_rhs); } + constraints.condense (system_rhs); + solve_time_step(); output_results();