From fb35aff75db0229db20bb608ef24278334c4bfe7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Sat, 11 Feb 2006 21:35:46 +0000 Subject: [PATCH] . git-svn-id: https://svn.dealii.org/trunk@12321 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/examples/step-20/step-20.cc | 66 ++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 21 deletions(-) diff --git a/deal.II/examples/step-20/step-20.cc b/deal.II/examples/step-20/step-20.cc index 02397b2fac..da7758fdc8 100644 --- a/deal.II/examples/step-20/step-20.cc +++ b/deal.II/examples/step-20/step-20.cc @@ -842,7 +842,7 @@ void MixedLaplaceProblem::compute_errors () const // do NOT use QGauss here! QTrapez<1> q_trapez; - QIterated quadrature (q_trapez, 5); + QIterated quadrature (q_trapez, degree+2); { const ComponentSelectFunction mask (dim, 1., dim+1); VectorTools::integrate_difference (dof_handler, solution, exact_solution, @@ -860,26 +860,12 @@ void MixedLaplaceProblem::compute_errors () const tmp, quadrature, VectorTools::L2_norm, &mask); - u_l2_error = std::sqrt (u_l2_error*u_l2_error + + u_l2_error = std::sqrt (u_l2_error * u_l2_error + tmp.l2_norm() * tmp.l2_norm()); } -// double u_h1_error = 0; -// for (unsigned int d=0; d mask(d, 1., dim+1); -// VectorTools::integrate_difference (dof_handler, solution, exact_solution, -// tmp, QGauss(degree+1), -// VectorTools::H1_seminorm, -// &mask); -// u_h1_error = std::sqrt (u_h1_error*u_h1_error + -// tmp.l2_norm() * tmp.l2_norm()); -// } - - std::cout << "Errors: ||e_p||_L2 = " << p_l2_error << ", ||e_u||_L2 = " << u_l2_error -// << ", |e_u|_H1 = " << u_h1_error << std::endl; } @@ -891,7 +877,6 @@ void MixedLaplaceProblem::output_results () const data_out.attach_dof_handler (dof_handler); data_out.add_data_vector (solution, "solution"); - data_out.add_data_vector (system_rhs, "rhs"); data_out.build_patches (degree+1); @@ -906,7 +891,8 @@ void MixedLaplaceProblem::output_results () const template void MixedLaplaceProblem::run () { - std::cout << "Solving problem in " << dim << " space dimensions." << std::endl; + std::cout << "Solving problem in " << dim + << " space dimensions." << std::endl; make_grid_and_dofs(); assemble_system (); @@ -916,12 +902,50 @@ void MixedLaplaceProblem::run () } + // @sect3{The ``main'' function} + + // The main function we stole from + // step-6 instead of step-4. It is + // almost equal to the one in step-6 + // (apart from the changed class + // names, of course), the only + // exception is that we pass the + // degree of the finite element space + // to the constructor of the mixed + // laplace problem. int main () { - deallog.depth_console (0); + try + { + deallog.depth_console (0); - MixedLaplaceProblem<2> mixed_laplace_problem (0); - mixed_laplace_problem.run (); + MixedLaplaceProblem<2> mixed_laplace_problem(0); + mixed_laplace_problem.run (); + } + catch (std::exception &exc) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Exception on processing: " << std::endl + << exc.what() << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + + return 1; + } + catch (...) + { + std::cerr << std::endl << std::endl + << "----------------------------------------------------" + << std::endl; + std::cerr << "Unknown exception!" << std::endl + << "Aborting!" << std::endl + << "----------------------------------------------------" + << std::endl; + return 1; + } return 0; } -- 2.39.5