From 5563c1d0a193b610815f791b8f5f39fa5de71b75 Mon Sep 17 00:00:00 2001 From: Ryan Grove Date: Fri, 20 May 2016 08:38:48 -0400 Subject: [PATCH] const additions + indent --- examples/step-55/step-55.cc | 67 ++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/examples/step-55/step-55.cc b/examples/step-55/step-55.cc index 54a4df6584..66c13f1961 100644 --- a/examples/step-55/step-55.cc +++ b/examples/step-55/step-55.cc @@ -114,7 +114,7 @@ namespace Step55 Solution<2>::value (const Point<2> &p, const unsigned int component) const { - Assert (component <= dim, ExcIndexRange(component,0,dim+1)); + Assert (component <= dim, ExcIndexRange(component,0,dim+1)); using numbers::PI; const double x = p(0); @@ -135,7 +135,7 @@ namespace Step55 Solution<3>::value (const Point<3> &p, const unsigned int component) const { - Assert (component <= dim, ExcIndexRange(component,0,dim+1)); + Assert (component <= dim, ExcIndexRange(component,0,dim+1)); using numbers::PI; const double x = p(0); @@ -160,11 +160,11 @@ namespace Step55 Solution<2>::gradient (const Point<2> &p, const unsigned int component) const { - Assert (component <= dim, ExcIndexRange(component,0,dim+1)); + Assert (component <= dim, ExcIndexRange(component,0,dim+1)); using numbers::PI; - double x = p(0); - double y = p(1); + const double x = p(0); + const double y = p(1); Tensor<1,2> return_value; if (component == 0) { @@ -190,12 +190,12 @@ namespace Step55 Solution<3>::gradient (const Point<3> &p, const unsigned int component) const { - Assert (component <= dim, ExcIndexRange(component,0,dim+1)); + Assert (component <= dim, ExcIndexRange(component,0,dim+1)); using numbers::PI; - double x = p(0); - double y = p(1); - double z = p(2); + const double x = p(0); + const double y = p(1); + const double z = p(2); Tensor<1,3> return_value; if (component == 0) { @@ -241,7 +241,7 @@ namespace Step55 RightHandSide<2>::value (const Point<2> &p, const unsigned int component) const { - Assert (component <= dim, ExcIndexRange(component,0,dim+1)); + Assert (component <= dim, ExcIndexRange(component,0,dim+1)); using numbers::PI; double x = p(0); @@ -262,7 +262,7 @@ namespace Step55 RightHandSide<3>::value (const Point<3> &p, const unsigned int component) const { - Assert (component <= dim, ExcIndexRange(component,0,dim+1)); + Assert (component <= dim, ExcIndexRange(component,0,dim+1)); using numbers::PI; double x = p(0); @@ -444,23 +444,23 @@ namespace Step55 void compute_errors (); void output_results (const unsigned int refinement_cycle) const; - const unsigned int degree; - SolverType::type solver_type; + const unsigned int degree; + SolverType::type solver_type; - Triangulation triangulation; - FESystem velocity_fe; - FESystem fe; - DoFHandler dof_handler; - DoFHandler velocity_dof_handler; + Triangulation triangulation; + FESystem velocity_fe; + FESystem fe; + DoFHandler dof_handler; + DoFHandler velocity_dof_handler; - ConstraintMatrix constraints; + ConstraintMatrix constraints; - BlockSparsityPattern sparsity_pattern; - BlockSparseMatrix system_matrix; - SparseMatrix pressure_mass_matrix; + BlockSparsityPattern sparsity_pattern; + BlockSparseMatrix system_matrix; + SparseMatrix pressure_mass_matrix; - BlockVector solution; - BlockVector system_rhs; + BlockVector solution; + BlockVector system_rhs; MGLevelObject mg_sparsity_patterns; MGLevelObject > mg_matrices; @@ -480,7 +480,7 @@ namespace Step55 triangulation (Triangulation::maximum_smoothing), velocity_fe (FE_Q(degree+1), dim), // Finite element for velocity-only fe (velocity_fe, 1, // Finite element for whole system - FE_Q (degree), 1), + FE_Q (degree), 1), dof_handler (triangulation), velocity_dof_handler (triangulation), computing_timer (std::cout, TimerOutput::summary, @@ -544,12 +544,11 @@ namespace Step55 mg_interface_matrices.resize(0, n_levels-1); mg_interface_matrices.clear (); // In contrast to all other container classes' clear() functions which - // delete the contents of the container, this clear() function - // calls the clear function of all elements stored by this container. + // delete the contents of the container, this clear() function + // calls the clear function of all elements stored by this container. mg_matrices.resize(0, n_levels-1); mg_matrices.clear (); mg_sparsity_patterns.resize(0, n_levels-1); - //mg_sparsity_patterns.clear (); for (unsigned int level=0; level quadrature_formula(degree+2); @@ -969,7 +968,7 @@ namespace Step55 SparseILU S_preconditioner; S_preconditioner.initialize (pressure_mass_matrix, - SparseILU::AdditionalData()); + SparseILU::AdditionalData()); const BlockSchurPreconditioner< PreconditionMG, MGTransferPrebuilt > >, @@ -1017,10 +1016,10 @@ namespace Step55 // in a pressure with mean value zero. Here we make use of the fact that // the pressure is component $dim$ and that the finite element space // is nodal. - double mean_pressure = VectorTools::compute_mean_value (dof_handler, - QGauss(degree+2), - solution, - dim); + const double mean_pressure = VectorTools::compute_mean_value (dof_handler, + QGauss(degree+2), + solution, + dim); solution.block(1).add(-mean_pressure); std::cout << " Note: The mean value was adjusted by " << -mean_pressure << std::endl; -- 2.39.5