From bad6b96689e7dc06a856cbb77e4d080bcb4415b2 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 3 May 2024 22:25:29 +0530 Subject: [PATCH] Make many more variables 'const'. --- examples/step-14/step-14.cc | 4 ++-- examples/step-17/step-17.cc | 4 ++-- examples/step-20/step-20.cc | 8 ++++---- examples/step-21/step-21.cc | 16 ++++++++-------- examples/step-22/step-22.cc | 2 +- examples/step-25/step-25.cc | 4 ++-- examples/step-29/step-29.cc | 4 ++-- examples/step-31/step-31.cc | 4 ++-- examples/step-35/step-35.cc | 4 ++-- examples/step-36/step-36.cc | 2 +- examples/step-4/step-4.cc | 2 +- examples/step-42/step-42.cc | 19 ++++++++++--------- examples/step-43/step-43.cc | 10 +++++----- examples/step-45/step-45.cc | 2 +- examples/step-5/step-5.cc | 2 +- examples/step-50/step-50.cc | 2 +- examples/step-55/step-55.cc | 4 ++-- examples/step-56/step-56.cc | 4 ++-- examples/step-57/step-57.cc | 2 +- examples/step-59/step-59.cc | 2 +- examples/step-60/step-60.cc | 4 ++-- examples/step-62/step-62.cc | 2 +- examples/step-7/step-7.cc | 4 ++-- examples/step-70/step-70.cc | 6 +++--- examples/step-72/step-72.cc | 6 +++--- examples/step-78/step-78.cc | 2 +- examples/step-79/step-79.cc | 10 +++++----- examples/step-8/step-8.cc | 2 +- examples/step-81/step-81.cc | 4 ++-- examples/step-82/step-82.cc | 12 ++++++------ examples/step-87/step-87.cc | 2 +- source/base/polynomial.cc | 6 +++--- source/base/quadrature_lib.cc | 12 ++++++------ source/dofs/dof_renumbering.cc | 2 +- source/dofs/dof_tools_constraints.cc | 3 ++- source/fe/fe_abf.cc | 12 ++++++------ source/fe/fe_bdm.cc | 6 +++--- source/fe/fe_dgq.cc | 2 +- source/fe/fe_q_base.cc | 2 +- source/fe/fe_q_iso_q1.cc | 4 ++-- source/fe/fe_raviart_thomas.cc | 14 +++++++------- source/fe/fe_rt_bubbles.cc | 8 ++++---- source/fe/mapping_q_cache.cc | 20 ++++++++++++-------- source/grid/grid_out.cc | 16 ++++++++-------- source/grid/grid_tools.cc | 2 +- source/grid/manifold_lib.cc | 2 +- source/numerics/data_out_resample.cc | 2 +- source/numerics/data_out_stack.cc | 4 ++-- source/numerics/derivative_approximation.cc | 2 +- 49 files changed, 140 insertions(+), 134 deletions(-) diff --git a/examples/step-14/step-14.cc b/examples/step-14/step-14.cc index 58a8d8614a..ba87eb6dab 100644 --- a/examples/step-14/step-14.cc +++ b/examples/step-14/step-14.cc @@ -202,7 +202,7 @@ namespace Step14 // ...then have some objects of which the meaning will become clear // below... - QTrapezoid vertex_quadrature; + const QTrapezoid vertex_quadrature; FEValues fe_values(dof_handler.get_fe(), vertex_quadrature, update_gradients | update_quadrature_points); @@ -1528,7 +1528,7 @@ namespace Step14 // Initialize a FEValues object with a quadrature formula, // have abbreviations for the number of quadrature points and shape // functions... - QGauss quadrature(dof_handler.get_fe().degree + 1); + const QGauss quadrature(dof_handler.get_fe().degree + 1); FEValues fe_values(dof_handler.get_fe(), quadrature, update_gradients | update_quadrature_points | diff --git a/examples/step-17/step-17.cc b/examples/step-17/step-17.cc index 54055548b7..845eb626bf 100644 --- a/examples/step-17/step-17.cc +++ b/examples/step-17/step-17.cc @@ -424,8 +424,8 @@ namespace Step17 template void ElasticProblem::assemble_system() { - QGauss quadrature_formula(fe.degree + 1); - FEValues fe_values(fe, + const QGauss quadrature_formula(fe.degree + 1); + FEValues fe_values(fe, quadrature_formula, update_values | update_gradients | update_quadrature_points | update_JxW_values); diff --git a/examples/step-20/step-20.cc b/examples/step-20/step-20.cc index 63285a2705..d8a6afd678 100644 --- a/examples/step-20/step-20.cc +++ b/examples/step-20/step-20.cc @@ -433,8 +433,8 @@ namespace Step20 template void MixedLaplaceProblem::assemble_system() { - QGauss quadrature_formula(degree + 2); - QGauss face_quadrature_formula(degree + 2); + const QGauss quadrature_formula(degree + 2); + const QGauss face_quadrature_formula(degree + 2); FEValues fe_values(fe, quadrature_formula, @@ -699,8 +699,8 @@ namespace Step20 // points for integration. To avoid this problem, we simply use a // trapezoidal rule and iterate it degree+2 times in each // coordinate direction (again as explained in step-7): - QTrapezoid<1> q_trapez; - QIterated quadrature(q_trapez, degree + 2); + const QTrapezoid<1> q_trapez; + const QIterated quadrature(q_trapez, degree + 2); // With this, we can then let the library compute the errors and output // them to the screen: diff --git a/examples/step-21/step-21.cc b/examples/step-21/step-21.cc index d4b8c868d9..0c3760a02e 100644 --- a/examples/step-21/step-21.cc +++ b/examples/step-21/step-21.cc @@ -579,8 +579,8 @@ namespace Step21 system_matrix = 0; system_rhs = 0; - QGauss quadrature_formula(degree + 2); - QGauss face_quadrature_formula(degree + 2); + const QGauss quadrature_formula(degree + 2); + const QGauss face_quadrature_formula(degree + 2); FEValues fe_values(fe, quadrature_formula, @@ -729,18 +729,18 @@ namespace Step21 template void TwoPhaseFlowProblem::assemble_rhs_S() { - QGauss quadrature_formula(degree + 2); - QGauss face_quadrature_formula(degree + 2); - FEValues fe_values(fe, + const QGauss quadrature_formula(degree + 2); + const QGauss face_quadrature_formula(degree + 2); + FEValues fe_values(fe, quadrature_formula, update_values | update_gradients | update_quadrature_points | update_JxW_values); - FEFaceValues fe_face_values(fe, + FEFaceValues fe_face_values(fe, face_quadrature_formula, update_values | update_normal_vectors | update_quadrature_points | update_JxW_values); - FEFaceValues fe_face_values_neighbor(fe, + FEFaceValues fe_face_values_neighbor(fe, face_quadrature_formula, update_values); @@ -1048,7 +1048,7 @@ namespace Step21 template double TwoPhaseFlowProblem::get_maximal_velocity() const { - QGauss quadrature_formula(degree + 2); + const QGauss quadrature_formula(degree + 2); const unsigned int n_q_points = quadrature_formula.size(); FEValues fe_values(fe, quadrature_formula, update_values); diff --git a/examples/step-22/step-22.cc b/examples/step-22/step-22.cc index bb3b712056..8351f74d8e 100644 --- a/examples/step-22/step-22.cc +++ b/examples/step-22/step-22.cc @@ -602,7 +602,7 @@ namespace Step22 system_rhs = 0; preconditioner_matrix = 0; - QGauss quadrature_formula(degree + 2); + const QGauss quadrature_formula(degree + 2); FEValues fe_values(fe, quadrature_formula, diff --git a/examples/step-25/step-25.cc b/examples/step-25/step-25.cc index 8d5bc8e442..a417c54ea2 100644 --- a/examples/step-25/step-25.cc +++ b/examples/step-25/step-25.cc @@ -455,8 +455,8 @@ namespace Step25 const Vector &new_data, SparseMatrix &nl_matrix) const { - QGauss quadrature_formula(fe.degree + 1); - FEValues fe_values(fe, + const QGauss quadrature_formula(fe.degree + 1); + FEValues fe_values(fe, quadrature_formula, update_values | update_JxW_values | update_quadrature_points); diff --git a/examples/step-29/step-29.cc b/examples/step-29/step-29.cc index 86113c3ffd..238ec4448b 100644 --- a/examples/step-29/step-29.cc +++ b/examples/step-29/step-29.cc @@ -529,8 +529,8 @@ namespace Step29 // used. Since our bilinear form involves boundary integrals on // $\Gamma_2$, we also need a quadrature rule for surface integration on // the faces, which are $dim-1$ dimensional: - QGauss quadrature_formula(fe.degree + 1); - QGauss face_quadrature_formula(fe.degree + 1); + const QGauss quadrature_formula(fe.degree + 1); + const QGauss face_quadrature_formula(fe.degree + 1); const unsigned int n_q_points = quadrature_formula.size(), n_face_q_points = face_quadrature_formula.size(), diff --git a/examples/step-31/step-31.cc b/examples/step-31/step-31.cc index 6b14bfa4ca..3e66bc0710 100644 --- a/examples/step-31/step-31.cc +++ b/examples/step-31/step-31.cc @@ -1398,8 +1398,8 @@ namespace Step31 temperature_mass_matrix = 0; temperature_stiffness_matrix = 0; - QGauss quadrature_formula(temperature_degree + 2); - FEValues temperature_fe_values(temperature_fe, + const QGauss quadrature_formula(temperature_degree + 2); + FEValues temperature_fe_values(temperature_fe, quadrature_formula, update_values | update_gradients | update_JxW_values); diff --git a/examples/step-35/step-35.cc b/examples/step-35/step-35.cc index d16a509a22..9f4c6ff9e2 100644 --- a/examples/step-35/step-35.cc +++ b/examples/step-35/step-35.cc @@ -451,8 +451,8 @@ namespace Step35 DoFHandler dof_handler_velocity; DoFHandler dof_handler_pressure; - QGauss quadrature_pressure; - QGauss quadrature_velocity; + const QGauss quadrature_pressure; + const QGauss quadrature_velocity; SparsityPattern sparsity_pattern_velocity; SparsityPattern sparsity_pattern_pressure; diff --git a/examples/step-36/step-36.cc b/examples/step-36/step-36.cc index e20625930d..dd7f52afb9 100644 --- a/examples/step-36/step-36.cc +++ b/examples/step-36/step-36.cc @@ -232,7 +232,7 @@ namespace Step36 template void EigenvalueProblem::assemble_system() { - QGauss quadrature_formula(fe.degree + 1); + const QGauss quadrature_formula(fe.degree + 1); FEValues fe_values(fe, quadrature_formula, diff --git a/examples/step-4/step-4.cc b/examples/step-4/step-4.cc index 4a3d3be510..472610c2e5 100644 --- a/examples/step-4/step-4.cc +++ b/examples/step-4/step-4.cc @@ -313,7 +313,7 @@ void Step4::setup_system() template void Step4::assemble_system() { - QGauss quadrature_formula(fe.degree + 1); + const QGauss quadrature_formula(fe.degree + 1); // We wanted to have a non-constant right hand side, so we use an object of // the class declared above to generate the necessary data. Since this right diff --git a/examples/step-42/step-42.cc b/examples/step-42/step-42.cc index ef05dfd759..0cd0ecf61c 100644 --- a/examples/step-42/step-42.cc +++ b/examples/step-42/step-42.cc @@ -1123,7 +1123,7 @@ namespace Step42 void PlasticityContactProblem::assemble_mass_matrix_diagonal( TrilinosWrappers::SparseMatrix &mass_matrix) { - QGaussLobatto face_quadrature_formula(fe.degree + 1); + const QGaussLobatto face_quadrature_formula(fe.degree + 1); FEFaceValues fe_values_face(fe, face_quadrature_formula, @@ -1216,8 +1216,9 @@ namespace Step42 // many quadrature points as there are shape functions per face and // looping over quadrature points is equivalent to looping over shape // functions defined on a face. With this, the code looks as follows: - Quadrature face_quadrature(fe.get_unit_face_support_points()); - FEFaceValues fe_values_face(fe, + const Quadrature face_quadrature( + fe.get_unit_face_support_points()); + FEFaceValues fe_values_face(fe, face_quadrature, update_quadrature_points); @@ -1326,8 +1327,8 @@ namespace Step42 { TimerOutput::Scope t(computing_timer, "Assembling"); - QGauss quadrature_formula(fe.degree + 1); - QGauss face_quadrature_formula(fe.degree + 1); + const QGauss quadrature_formula(fe.degree + 1); + const QGauss face_quadrature_formula(fe.degree + 1); FEValues fe_values(fe, quadrature_formula, @@ -1479,8 +1480,8 @@ namespace Step42 void PlasticityContactProblem::compute_nonlinear_residual( const TrilinosWrappers::MPI::Vector &linearization_point) { - QGauss quadrature_formula(fe.degree + 1); - QGauss face_quadrature_formula(fe.degree + 1); + const QGauss quadrature_formula(fe.degree + 1); + const QGauss face_quadrature_formula(fe.degree + 1); FEValues fe_values(fe, quadrature_formula, @@ -2078,8 +2079,8 @@ namespace Step42 double contact_force = 0.0; - QGauss face_quadrature_formula(fe.degree + 1); - FEFaceValues fe_values_face(fe, + const QGauss face_quadrature_formula(fe.degree + 1); + FEFaceValues fe_values_face(fe, face_quadrature_formula, update_values | update_JxW_values); diff --git a/examples/step-43/step-43.cc b/examples/step-43/step-43.cc index 7a52709280..b36b03bc9f 100644 --- a/examples/step-43/step-43.cc +++ b/examples/step-43/step-43.cc @@ -970,8 +970,8 @@ namespace Step43 darcy_matrix = 0; darcy_rhs = 0; - QGauss quadrature_formula(darcy_degree + 2); - QGauss face_quadrature_formula(darcy_degree + 2); + const QGauss quadrature_formula(darcy_degree + 2); + const QGauss face_quadrature_formula(darcy_degree + 2); FEValues darcy_fe_values(darcy_fe, quadrature_formula, @@ -1174,7 +1174,7 @@ namespace Step43 template void TwoPhaseFlowProblem::assemble_saturation_matrix() { - QGauss quadrature_formula(saturation_degree + 2); + const QGauss quadrature_formula(saturation_degree + 2); FEValues saturation_fe_values(saturation_fe, quadrature_formula, @@ -1242,8 +1242,8 @@ namespace Step43 template void TwoPhaseFlowProblem::assemble_saturation_rhs() { - QGauss quadrature_formula(saturation_degree + 2); - QGauss face_quadrature_formula(saturation_degree + 2); + const QGauss quadrature_formula(saturation_degree + 2); + const QGauss face_quadrature_formula(saturation_degree + 2); FEValues saturation_fe_values(saturation_fe, quadrature_formula, diff --git a/examples/step-45/step-45.cc b/examples/step-45/step-45.cc index 109aef15c1..307aa616d6 100644 --- a/examples/step-45/step-45.cc +++ b/examples/step-45/step-45.cc @@ -534,7 +534,7 @@ namespace Step45 system_rhs = 0.; preconditioner_matrix = 0.; - QGauss quadrature_formula(degree + 2); + const QGauss quadrature_formula(degree + 2); FEValues fe_values(mapping, fe, diff --git a/examples/step-5/step-5.cc b/examples/step-5/step-5.cc index c696f2cfa5..d2f56853ab 100644 --- a/examples/step-5/step-5.cc +++ b/examples/step-5/step-5.cc @@ -157,7 +157,7 @@ void Step5::setup_system() template void Step5::assemble_system() { - QGauss quadrature_formula(fe.degree + 1); + const QGauss quadrature_formula(fe.degree + 1); FEValues fe_values(fe, quadrature_formula, diff --git a/examples/step-50/step-50.cc b/examples/step-50/step-50.cc index 4eb415b4f7..38a390f1db 100644 --- a/examples/step-50/step-50.cc +++ b/examples/step-50/step-50.cc @@ -803,7 +803,7 @@ void LaplaceProblem::assemble_multigrid() { TimerOutput::Scope timing(computing_timer, "Assemble multigrid"); - QGauss quadrature_formula(degree + 1); + const QGauss quadrature_formula(degree + 1); FEValues fe_values(fe, quadrature_formula, diff --git a/examples/step-55/step-55.cc b/examples/step-55/step-55.cc index 27ecafab6e..c12cc6d9ce 100644 --- a/examples/step-55/step-55.cc +++ b/examples/step-55/step-55.cc @@ -684,8 +684,8 @@ namespace Step55 const ComponentSelectFunction velocity_mask(std::make_pair(0, dim), dim + 1); - Vector cellwise_errors(triangulation.n_active_cells()); - QGauss quadrature(velocity_degree + 2); + Vector cellwise_errors(triangulation.n_active_cells()); + const QGauss quadrature(velocity_degree + 2); VectorTools::integrate_difference(dof_handler, locally_relevant_solution, diff --git a/examples/step-56/step-56.cc b/examples/step-56/step-56.cc index a933e84ac5..518256a0f0 100644 --- a/examples/step-56/step-56.cc +++ b/examples/step-56/step-56.cc @@ -609,7 +609,7 @@ namespace Step56 const bool assemble_pressure_mass_matrix = (solver_type == SolverType::UMFPACK) ? false : true; - QGauss quadrature_formula(pressure_degree + 2); + const QGauss quadrature_formula(pressure_degree + 2); FEValues fe_values(fe, quadrature_formula, @@ -707,7 +707,7 @@ namespace Step56 mg_matrices = 0.; - QGauss quadrature_formula(pressure_degree + 2); + const QGauss quadrature_formula(pressure_degree + 2); FEValues fe_values(velocity_fe, quadrature_formula, diff --git a/examples/step-57/step-57.cc b/examples/step-57/step-57.cc index 6f3fb8c676..0ac9165a60 100644 --- a/examples/step-57/step-57.cc +++ b/examples/step-57/step-57.cc @@ -367,7 +367,7 @@ namespace Step57 system_rhs = 0; - QGauss quadrature_formula(degree + 2); + const QGauss quadrature_formula(degree + 2); FEValues fe_values(fe, quadrature_formula, diff --git a/examples/step-59/step-59.cc b/examples/step-59/step-59.cc index 002d7f4feb..c9a448b956 100644 --- a/examples/step-59/step-59.cc +++ b/examples/step-59/step-59.cc @@ -750,7 +750,7 @@ namespace Step59 laplace_matrices[d].reinit(N, N); } - QGauss<1> quadrature(N); + const QGauss<1> quadrature(N); for (unsigned int i = 0; i < N; ++i) for (unsigned int j = 0; j < N; ++j) { diff --git a/examples/step-60/step-60.cc b/examples/step-60/step-60.cc index 7db74fba23..fa4a8e47ee 100644 --- a/examples/step-60/step-60.cc +++ b/examples/step-60/step-60.cc @@ -904,7 +904,7 @@ namespace Step60 { TimerOutput::Scope timer_section(monitor, "Setup coupling"); - QGauss quad(parameters.coupling_quadrature_order); + const QGauss quad(parameters.coupling_quadrature_order); DynamicSparsityPattern dsp(space_dh->n_dofs(), embedded_dh->n_dofs()); @@ -954,7 +954,7 @@ namespace Step60 // To compute the coupling matrix we use the // NonMatching::create_coupling_mass_matrix tool, which works similarly to // NonMatching::create_coupling_sparsity_pattern. - QGauss quad(parameters.coupling_quadrature_order); + const QGauss quad(parameters.coupling_quadrature_order); NonMatching::create_coupling_mass_matrix(*space_grid_tools_cache, *space_dh, *embedded_dh, diff --git a/examples/step-62/step-62.cc b/examples/step-62/step-62.cc index 9b62d6ce75..f8d73115a4 100644 --- a/examples/step-62/step-62.cc +++ b/examples/step-62/step-62.cc @@ -314,7 +314,7 @@ namespace step62 parallel::distributed::Triangulation triangulation; - QGauss quadrature_formula; + const QGauss quadrature_formula; // We store the mass and stiffness matrices for each cell this vector. std::vector> quadrature_cache; diff --git a/examples/step-7/step-7.cc b/examples/step-7/step-7.cc index 53dd9e4083..8b2ca2fda7 100644 --- a/examples/step-7/step-7.cc +++ b/examples/step-7/step-7.cc @@ -513,8 +513,8 @@ namespace Step7 template void HelmholtzProblem::assemble_system() { - QGauss quadrature_formula(fe->degree + 1); - QGauss face_quadrature_formula(fe->degree + 1); + const QGauss quadrature_formula(fe->degree + 1); + const QGauss face_quadrature_formula(fe->degree + 1); const unsigned int n_q_points = quadrature_formula.size(); const unsigned int n_face_q_points = face_quadrature_formula.size(); diff --git a/examples/step-70/step-70.cc b/examples/step-70/step-70.cc index 02b2aa7fd1..107503d419 100644 --- a/examples/step-70/step-70.cc +++ b/examples/step-70/step-70.cc @@ -1115,7 +1115,7 @@ namespace Step70 template void StokesImmersedProblem::setup_solid_particles() { - QGauss quadrature(fluid_fe->degree + 1); + const QGauss quadrature(fluid_fe->degree + 1); const unsigned int n_properties = 1; solid_particle_handler.initialize(fluid_tria, @@ -1338,8 +1338,8 @@ namespace Step70 TimerOutput::Scope t(computing_timer, "Assemble Stokes terms"); - QGauss quadrature_formula(fluid_fe->degree + 1); - FEValues fe_values(*fluid_fe, + const QGauss quadrature_formula(fluid_fe->degree + 1); + FEValues fe_values(*fluid_fe, quadrature_formula, update_values | update_gradients | update_quadrature_points | diff --git a/examples/step-72/step-72.cc b/examples/step-72/step-72.cc index 275123258a..b0479b77e5 100644 --- a/examples/step-72/step-72.cc +++ b/examples/step-72/step-72.cc @@ -159,9 +159,9 @@ namespace Step72 Triangulation triangulation; - DoFHandler dof_handler; - FE_Q fe; - QGauss quadrature_formula; + DoFHandler dof_handler; + const FE_Q fe; + const QGauss quadrature_formula; AffineConstraints hanging_node_constraints; diff --git a/examples/step-78/step-78.cc b/examples/step-78/step-78.cc index 85cdfe9e27..be93d3cf34 100644 --- a/examples/step-78/step-78.cc +++ b/examples/step-78/step-78.cc @@ -414,7 +414,7 @@ namespace BlackScholesSolver // current_coefficient variable. const unsigned int dofs_per_cell = fe.dofs_per_cell; FullMatrix cell_matrix(dofs_per_cell, dofs_per_cell); - QGauss quadrature_formula(fe.degree + 1); + const QGauss quadrature_formula(fe.degree + 1); FEValues fe_values(fe, quadrature_formula, update_values | update_gradients | diff --git a/examples/step-79/step-79.cc b/examples/step-79/step-79.cc index 9eb09cb372..5cca5c6f07 100644 --- a/examples/step-79/step-79.cc +++ b/examples/step-79/step-79.cc @@ -753,15 +753,15 @@ namespace SAND system_rhs = 0; - MappingQ mapping(1); - QGauss quadrature_formula(fe.degree + 1); - QGauss face_quadrature_formula(fe.degree + 1); - FEValues fe_values(mapping, + MappingQ mapping(1); + const QGauss quadrature_formula(fe.degree + 1); + const QGauss face_quadrature_formula(fe.degree + 1); + FEValues fe_values(mapping, fe, quadrature_formula, update_values | update_gradients | update_quadrature_points | update_JxW_values); - FEFaceValues fe_face_values(mapping, + FEFaceValues fe_face_values(mapping, fe, face_quadrature_formula, update_values | update_quadrature_points | diff --git a/examples/step-8/step-8.cc b/examples/step-8/step-8.cc index 1f1def8c60..f159a2cc57 100644 --- a/examples/step-8/step-8.cc +++ b/examples/step-8/step-8.cc @@ -281,7 +281,7 @@ namespace Step8 template void ElasticProblem::assemble_system() { - QGauss quadrature_formula(fe.degree + 1); + const QGauss quadrature_formula(fe.degree + 1); FEValues fe_values(fe, quadrature_formula, diff --git a/examples/step-81/step-81.cc b/examples/step-81/step-81.cc index 91f2ae098b..42c42df8f7 100644 --- a/examples/step-81/step-81.cc +++ b/examples/step-81/step-81.cc @@ -597,8 +597,8 @@ namespace Step81 template void Maxwell::assemble_system() { - QGauss quadrature_formula(quadrature_order); - QGauss face_quadrature_formula(quadrature_order); + const QGauss quadrature_formula(quadrature_order); + const QGauss face_quadrature_formula(quadrature_order); FEValues fe_values(*fe, quadrature_formula, diff --git a/examples/step-82/step-82.cc b/examples/step-82/step-82.cc index 1650e3ef9b..67df8a7a55 100644 --- a/examples/step-82/step-82.cc +++ b/examples/step-82/step-82.cc @@ -482,8 +482,8 @@ namespace Step82 { matrix = 0; - QGauss quad(fe.degree + 1); - QGauss quad_face(fe.degree + 1); + const QGauss quad(fe.degree + 1); + const QGauss quad_face(fe.degree + 1); const unsigned int n_q_points = quad.size(); const unsigned int n_q_points_face = quad_face.size(); @@ -931,8 +931,8 @@ namespace Step82 double error_H1 = 0; double error_L2 = 0; - QGauss quad(fe.degree + 1); - QGauss quad_face(fe.degree + 1); + const QGauss quad(fe.degree + 1); + const QGauss quad_face(fe.degree + 1); FEValues fe_values(fe, quad, @@ -1191,8 +1191,8 @@ namespace Step82 const typename Triangulation::cell_iterator cell_lift = static_cast::cell_iterator>(cell); - QGauss quad(fe.degree + 1); - QGauss quad_face(fe.degree + 1); + const QGauss quad(fe.degree + 1); + const QGauss quad_face(fe.degree + 1); const unsigned int n_q_points = quad.size(); const unsigned int n_q_points_face = quad_face.size(); diff --git a/examples/step-87/step-87.cc b/examples/step-87/step-87.cc index e51a3e34a6..b9701e973e 100644 --- a/examples/step-87/step-87.cc +++ b/examples/step-87/step-87.cc @@ -761,7 +761,7 @@ namespace Step87 MappingQ mapping_immersed_base(3); MappingQCache mapping_immersed(3); mapping_immersed.initialize(mapping_immersed_base, tria_immersed); - QGauss quadrature_immersed(degree + 1); + const QGauss quadrature_immersed(degree + 1); FE_Q fe_scalar_immersed(degree); FESystem fe_immersed(fe_scalar_immersed, dim); diff --git a/source/base/polynomial.cc b/source/base/polynomial.cc index 000a1155f2..ed7b74da42 100644 --- a/source/base/polynomial.cc +++ b/source/base/polynomial.cc @@ -710,7 +710,7 @@ namespace Polynomials // Gauss-Legendre quadrature formula if (k > 0) { - QGauss<1> gauss(k); + const QGauss<1> gauss(k); for (unsigned int i = 0; i < k; ++i) this->lagrange_support_points[i] = gauss.get_points()[i][0]; } @@ -1139,8 +1139,8 @@ namespace Polynomials // Note that the polynomials are not yet normalized here, which is not // necessary because we are only looking for the x_star where the matrix // entry is zero, for which the constants do not matter. - QGauss<1> gauss(degree + 1); - double integral_left = 0, integral_right = 0; + const QGauss<1> gauss(degree + 1); + double integral_left = 0, integral_right = 0; for (unsigned int q = 0; q < gauss.size(); ++q) { const double x = gauss.point(q)[0]; diff --git a/source/base/quadrature_lib.cc b/source/base/quadrature_lib.cc index dc1e41ccc1..577ef8e48b 100644 --- a/source/base/quadrature_lib.cc +++ b/source/base/quadrature_lib.cc @@ -785,9 +785,9 @@ QGaussLogR<1>::QGaussLogR(const unsigned int n, // only need n quadrature points. In the most difficult one, we // need 2*n points for the first segment, and 2*n points for the // second segment. - QGaussLog<1> quad1(n, origin[0] != 0); - QGaussLog<1> quad2(n); - QGauss<1> quad(n); + const QGaussLog<1> quad1(n, origin[0] != 0); + const QGaussLog<1> quad2(n); + const QGauss<1> quad(n); // Check that the origin is inside 0,1 Assert((fraction >= 0) && (fraction <= 1), @@ -928,7 +928,7 @@ QGaussOneOverR<2>::QGaussOneOverR(const unsigned int n, // Start with the gauss quadrature formula on the (u,v) reference // element. - QGauss<2> gauss(n); + const QGauss<2> gauss(n); Assert(gauss.size() == n * n, ExcInternalError()); @@ -2353,8 +2353,8 @@ QGaussWedge::QGaussWedge(const unsigned int n_points) { AssertDimension(dim, 3); - QGaussSimplex<2> quad_tri(n_points); - QGauss<1> quad_line(n_points); + const QGaussSimplex<2> quad_tri(n_points); + const QGauss<1> quad_line(n_points); for (unsigned int i = 0; i < quad_line.size(); ++i) for (unsigned int j = 0; j < quad_tri.size(); ++j) diff --git a/source/dofs/dof_renumbering.cc b/source/dofs/dof_renumbering.cc index d4f060248b..9733dbecdb 100644 --- a/source/dofs/dof_renumbering.cc +++ b/source/dofs/dof_renumbering.cc @@ -1901,7 +1901,7 @@ namespace DoFRenumbering std::vector, unsigned int>> support_point_list(n_dofs); - Quadrature q_dummy(dof.get_fe().get_unit_support_points()); + const Quadrature q_dummy(dof.get_fe().get_unit_support_points()); FEValues fe_values(dof.get_fe(), q_dummy, update_quadrature_points); diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc index 0272036e72..5cf682abe3 100644 --- a/source/dofs/dof_tools_constraints.cc +++ b/source/dofs/dof_tools_constraints.cc @@ -3521,7 +3521,8 @@ namespace DoFTools Assert(matrix.m() == spacedim, ExcInternalError()); - Quadrature quadrature(fe.get_unit_face_support_points(face_no)); + const Quadrature quadrature( + fe.get_unit_face_support_points(face_no)); // have an array that stores the location of each vector-dof tuple we want // to rotate. diff --git a/source/fe/fe_abf.cc b/source/fe/fe_abf.cc index 44b8fc6567..b251bfa2dc 100644 --- a/source/fe/fe_abf.cc +++ b/source/fe/fe_abf.cc @@ -169,7 +169,7 @@ template void FE_ABF::initialize_support_points(const unsigned int deg) { - QGauss cell_quadrature(deg + 2); + const QGauss cell_quadrature(deg + 2); const unsigned int n_interior_points = cell_quadrature.size(); // TODO: the implementation makes the assumption that all faces have the @@ -207,7 +207,7 @@ FE_ABF::initialize_support_points(const unsigned int deg) if (dim > 1) { - QGauss face_points(deg + 1); + const QGauss face_points(deg + 1); TensorProductPolynomials legendre = Polynomials::Legendre::generate_complete_basis(deg); @@ -348,9 +348,9 @@ FE_ABF::initialize_restriction() this->restriction[iso][i].reinit(0, 0); return; } - unsigned int iso = RefinementCase::isotropic_refinement - 1; - QGauss q_base(rt_order + 1); - const unsigned int n_face_points = q_base.size(); + unsigned int iso = RefinementCase::isotropic_refinement - 1; + const QGauss q_base(rt_order + 1); + const unsigned int n_face_points = q_base.size(); // First, compute interpolation on // subfaces for (const unsigned int face : GeometryInfo::face_indices()) @@ -441,7 +441,7 @@ FE_ABF::initialize_restriction() AssertDimension(this->n_unique_faces(), 1); const unsigned int face_no = 0; - QGauss q_cell(rt_order + 1); + const QGauss q_cell(rt_order + 1); const unsigned int start_cell_dofs = GeometryInfo::faces_per_cell * this->n_dofs_per_face(face_no); diff --git a/source/fe/fe_bdm.cc b/source/fe/fe_bdm.cc index d5aa67d62a..2ae1c0e279 100644 --- a/source/fe/fe_bdm.cc +++ b/source/fe/fe_bdm.cc @@ -359,7 +359,7 @@ FE_BDM::initialize_support_points(const unsigned int deg) // up to deg, which means we need dg+1 points in each direction. The // fact that we do not have tensor product polynomials will be // considered later. In 2d, we can use point values. - QGauss face_points(deg + 1); + const QGauss face_points(deg + 1); // TODO: the implementation makes the assumption that all faces have the // same number of dofs @@ -375,7 +375,7 @@ FE_BDM::initialize_support_points(const unsigned int deg) // deg-2, thus we use deg points. Note that deg>=1 and the lowest // order element has no points in the cell, such that we have to // distinguish this case. - QGauss cell_points(deg == 1 ? 0 : deg); + const QGauss cell_points(deg == 1 ? 0 : deg); // Compute the size of the whole support point set const unsigned int npoints = @@ -383,7 +383,7 @@ FE_BDM::initialize_support_points(const unsigned int deg) this->generalized_support_points.resize(npoints); - Quadrature faces = + const Quadrature faces = QProjector::project_to_all_faces(this->reference_cell(), face_points); for (unsigned int f = 0; f < GeometryInfo::faces_per_cell; ++f) diff --git a/source/fe/fe_dgq.cc b/source/fe/fe_dgq.cc index 0d8a65ba52..83ea9c889a 100644 --- a/source/fe/fe_dgq.cc +++ b/source/fe/fe_dgq.cc @@ -994,7 +994,7 @@ FE_DGQArbitraryNodes::clone() const polynomial_space->get_numbering_inverse(); for (unsigned int i = 0; i <= this->degree; ++i) qpoints[i] = Point<1>(this->unit_support_points[lexicographic[i]][0]); - Quadrature<1> pquadrature(qpoints); + const Quadrature<1> pquadrature(qpoints); return std::make_unique>(pquadrature); } diff --git a/source/fe/fe_q_base.cc b/source/fe/fe_q_base.cc index 94d26cc5b8..10107e543e 100644 --- a/source/fe/fe_q_base.cc +++ b/source/fe/fe_q_base.cc @@ -257,7 +257,7 @@ struct FE_Q_Base::Implementation std::vector> line_support_points(n); for (unsigned int i = 0; i < n; ++i) line_support_points[i][0] = (i + 1) * step; - Quadrature qline(line_support_points); + const Quadrature qline(line_support_points); // auxiliary points in 2d std::vector> p_line(n); diff --git a/source/fe/fe_q_iso_q1.cc b/source/fe/fe_q_iso_q1.cc index 190b926171..12ce528b30 100644 --- a/source/fe/fe_q_iso_q1.cc +++ b/source/fe/fe_q_iso_q1.cc @@ -46,8 +46,8 @@ FE_Q_iso_Q1::FE_Q_iso_Q1(const unsigned int subdivisions) ExcMessage("This element can only be used with a positive number of " "subelements")); - QTrapezoid<1> trapez; - QIterated<1> points(trapez, subdivisions); + const QTrapezoid<1> trapez; + const QIterated<1> points(trapez, subdivisions); this->initialize(points.get_points()); } diff --git a/source/fe/fe_raviart_thomas.cc b/source/fe/fe_raviart_thomas.cc index f5c194b6bc..163a3623fb 100644 --- a/source/fe/fe_raviart_thomas.cc +++ b/source/fe/fe_raviart_thomas.cc @@ -158,7 +158,7 @@ template void FE_RaviartThomas::initialize_support_points(const unsigned int deg) { - QGauss cell_quadrature(deg + 1); + const QGauss cell_quadrature(deg + 1); const unsigned int n_interior_points = (deg > 0) ? cell_quadrature.size() : 0; // TODO: the implementation makes the assumption that all faces have the @@ -181,7 +181,7 @@ FE_RaviartThomas::initialize_support_points(const unsigned int deg) if (dim > 1) { - QGauss face_points(deg + 1); + const QGauss face_points(deg + 1); TensorProductPolynomials legendre = Polynomials::Legendre::generate_complete_basis(deg); @@ -453,8 +453,8 @@ FE_RaviartThomas::initialize_restriction() { const unsigned int iso = RefinementCase::isotropic_refinement - 1; - QGauss q_base(this->degree); - const unsigned int n_face_points = q_base.size(); + const QGauss q_base(this->degree); + const unsigned int n_face_points = q_base.size(); // First, compute interpolation on // subfaces for (const unsigned int face : GeometryInfo::face_indices()) @@ -463,7 +463,7 @@ FE_RaviartThomas::initialize_restriction() // child cell are evaluated // in the quadrature points // of a full face. - Quadrature q_face = + const Quadrature q_face = QProjector::project_to_face(this->reference_cell(), q_base, face); // Store shape values, since the // evaluation suffers if not @@ -482,7 +482,7 @@ FE_RaviartThomas::initialize_restriction() // the coarse face are // evaluated on the subface // only. - Quadrature q_sub = QProjector::project_to_subface( + const Quadrature q_sub = QProjector::project_to_subface( this->reference_cell(), q_base, face, sub); const unsigned int child = GeometryInfo::child_cell_on_face( RefinementCase::isotropic_refinement, face, sub); @@ -546,7 +546,7 @@ FE_RaviartThomas::initialize_restriction() AssertDimension(this->n_unique_faces(), 1); const unsigned int face_no = 0; - QGauss q_cell(this->degree); + const QGauss q_cell(this->degree); const unsigned int start_cell_dofs = GeometryInfo::faces_per_cell * this->n_dofs_per_face(face_no); diff --git a/source/fe/fe_rt_bubbles.cc b/source/fe/fe_rt_bubbles.cc index a9339f68b2..97a3304a00 100644 --- a/source/fe/fe_rt_bubbles.cc +++ b/source/fe/fe_rt_bubbles.cc @@ -175,7 +175,7 @@ FE_RT_Bubbles::initialize_support_points(const unsigned int deg) // This is the deg of the RT_Bubble element plus one. if (dim > 1) { - QGaussLobatto face_points(deg + 1); + const QGaussLobatto face_points(deg + 1); Assert(face_points.size() == this->n_dofs_per_face(face_no), ExcInternalError()); for (unsigned int k = 0; k < this->n_dofs_per_face(face_no); ++k) @@ -203,8 +203,8 @@ FE_RT_Bubbles::initialize_support_points(const unsigned int deg) // In the interior, we need anisotropic Gauss-Lobatto quadratures, // one for each direction - QGaussLobatto<1> high(deg + 1); - std::vector> pts = high.get_points(); + const QGaussLobatto<1> high(deg + 1); + std::vector> pts = high.get_points(); if (pts.size() > 2) { pts.erase(pts.begin()); @@ -212,7 +212,7 @@ FE_RT_Bubbles::initialize_support_points(const unsigned int deg) } std::vector wts(pts.size(), 1); - Quadrature<1> low(pts, wts); + const Quadrature<1> low(pts, wts); for (unsigned int d = 0; d < dim; ++d) { diff --git a/source/fe/mapping_q_cache.cc b/source/fe/mapping_q_cache.cc index ae95a3ba79..5f0cf67c9f 100644 --- a/source/fe/mapping_q_cache.cc +++ b/source/fe/mapping_q_cache.cc @@ -111,14 +111,15 @@ MappingQCache::initialize( auto &fe_values = fe_values_all.get(); if (fe_values.get() == nullptr) { - QGaussLobatto quadrature_gl(this->polynomial_degree + 1); + const QGaussLobatto quadrature_gl(this->polynomial_degree + + 1); std::vector> quadrature_points; for (const auto i : FETools::hierarchic_to_lexicographic_numbering( this->polynomial_degree)) quadrature_points.push_back(quadrature_gl.point(i)); - Quadrature quadrature(quadrature_points); + const Quadrature quadrature(quadrature_points); fe_values = std::make_unique>( mapping, fe, quadrature, update_quadrature_points); @@ -208,14 +209,15 @@ MappingQCache::initialize( auto &fe_values = fe_values_all.get(); if (fe_values.get() == nullptr) { - QGaussLobatto quadrature_gl(this->polynomial_degree + 1); + const QGaussLobatto quadrature_gl(this->polynomial_degree + + 1); std::vector> quadrature_points; for (const auto i : FETools::hierarchic_to_lexicographic_numbering( this->polynomial_degree)) quadrature_points.push_back(quadrature_gl.point(i)); - Quadrature quadrature(quadrature_points); + const Quadrature quadrature(quadrature_points); fe_values = std::make_unique>( mapping, fe, quadrature, update_quadrature_points); @@ -364,14 +366,15 @@ MappingQCache::initialize( auto &fe_values = fe_values_all.get(); if (fe_values.get() == nullptr) { - QGaussLobatto quadrature_gl(this->polynomial_degree + 1); + const QGaussLobatto quadrature_gl(this->polynomial_degree + + 1); std::vector> quadrature_points; for (const auto i : FETools::hierarchic_to_lexicographic_numbering( this->polynomial_degree)) quadrature_points.push_back(quadrature_gl.point(i)); - Quadrature quadrature(quadrature_points); + const Quadrature quadrature(quadrature_points); fe_values = std::make_unique>( mapping, @@ -567,14 +570,15 @@ MappingQCache::initialize( auto &fe_values = fe_values_all.get(); if (fe_values.get() == nullptr) { - QGaussLobatto quadrature_gl(this->polynomial_degree + 1); + const QGaussLobatto quadrature_gl(this->polynomial_degree + + 1); std::vector> quadrature_points; for (const auto i : FETools::hierarchic_to_lexicographic_numbering( this->polynomial_degree)) quadrature_points.push_back(quadrature_gl.point(i)); - Quadrature quadrature(quadrature_points); + const Quadrature quadrature(quadrature_points); fe_values = std::make_unique>( mapping, diff --git a/source/grid/grid_out.cc b/source/grid/grid_out.cc index 1daf6d7eaf..d30eec1f0c 100644 --- a/source/grid/grid_out.cc +++ b/source/grid/grid_out.cc @@ -3698,7 +3698,7 @@ GridOut::write_mesh_per_processor_as_vtu( // We need a dummy vector with the names of the data values in the // .vtu files in order that the .pvtu contains reference these values - Vector dummy_vector(tr->n_active_cells()); + const Vector dummy_vector(tr->n_active_cells()); data_out.add_data_vector(dummy_vector, "level"); data_out.add_data_vector(dummy_vector, "subdomain"); data_out.add_data_vector(dummy_vector, "level_subdomain"); @@ -4233,8 +4233,8 @@ namespace internal for (unsigned int i = 1; i < n_points - 1; ++i) boundary_points[i][0] = 1. * i / (n_points - 1); - std::vector dummy_weights(n_points, 1. / n_points); - Quadrature quadrature(boundary_points, dummy_weights); + const std::vector dummy_weights(n_points, 1. / n_points); + const Quadrature quadrature(boundary_points, dummy_weights); q_projector = QProjector::project_to_all_faces( ReferenceCells::get_hypercube(), quadrature); @@ -4355,11 +4355,11 @@ namespace internal for (unsigned int i = 1; i < n_points - 1; ++i) boundary_points[i][0] = 1. * i / (n_points - 1); - std::vector dummy_weights(n_points, 1. / n_points); - Quadrature<1> quadrature1d(boundary_points, dummy_weights); + const std::vector dummy_weights(n_points, 1. / n_points); + const Quadrature<1> quadrature1d(boundary_points, dummy_weights); // tensor product of points, only one copy - QIterated quadrature(quadrature1d, 1); + const QIterated quadrature(quadrature1d, 1); q_projector = std::make_unique>( QProjector::project_to_all_faces( ReferenceCells::get_hypercube(), quadrature)); @@ -4788,8 +4788,8 @@ namespace internal for (unsigned int i = 0; i < n_points; ++i) boundary_points[i][0] = 1. * (i + 1) / (n_points + 1); - Quadrature quadrature(boundary_points); - Quadrature q_projector( + const Quadrature quadrature(boundary_points); + const Quadrature q_projector( QProjector::project_to_all_faces( ReferenceCells::get_hypercube(), quadrature)); diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index c0adeb3d22..2503c671fd 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -322,7 +322,7 @@ namespace GridTools SparseMatrix S(sparsity_pattern); - QGauss quadrature(4); + const QGauss quadrature(4); Assert(triangulation.all_reference_cells_are_hyper_cube(), ExcNotImplemented()); diff --git a/source/grid/manifold_lib.cc b/source/grid/manifold_lib.cc index 089bfa5989..ddc375cb60 100644 --- a/source/grid/manifold_lib.cc +++ b/source/grid/manifold_lib.cc @@ -1656,7 +1656,7 @@ TransfiniteInterpolationManifold::initialize( // back to a simple GridTools::affine_cell_approximation() which // requires 2^dim points, instead. Thus, initialize the QIterated // quadrature with no subdivisions. - std::vector> unit_points = + const std::vector> unit_points = QIterated(QTrapezoid<1>(), (dim == spacedim ? 2 : 1)).get_points(); std::vector> real_points(unit_points.size()); diff --git a/source/numerics/data_out_resample.cc b/source/numerics/data_out_resample.cc index 1d2d0d59dc..0715c29a09 100644 --- a/source/numerics/data_out_resample.cc +++ b/source/numerics/data_out_resample.cc @@ -54,7 +54,7 @@ DataOutResample::update_mapping( std::vector>> points_all; - Quadrature quadrature(fe.get_unit_support_points()); + const Quadrature quadrature(fe.get_unit_support_points()); FEValues fe_values(*patch_mapping, fe, diff --git a/source/numerics/data_out_stack.cc b/source/numerics/data_out_stack.cc index c2dcd3b837..e64b1f5f3d 100644 --- a/source/numerics/data_out_stack.cc +++ b/source/numerics/data_out_stack.cc @@ -277,8 +277,8 @@ DataOutStack::build_patches(const unsigned int nnnn_subdivisions) // patch, and an object that // extracts the data on each // cell to these points - QTrapezoid<1> q_trapez; - QIterated patch_points(q_trapez, n_subdivisions); + const QTrapezoid<1> q_trapez; + const QIterated patch_points(q_trapez, n_subdivisions); // create collection objects from // single quadratures, diff --git a/source/numerics/derivative_approximation.cc b/source/numerics/derivative_approximation.cc index fb43e67b9f..61154c2b1a 100644 --- a/source/numerics/derivative_approximation.cc +++ b/source/numerics/derivative_approximation.cc @@ -749,7 +749,7 @@ namespace DerivativeApproximation const typename DoFHandler::active_cell_iterator &cell, typename DerivativeDescription::Derivative &derivative) { - QMidpoint midpoint_rule; + const QMidpoint midpoint_rule; // create collection objects from // single quadratures, mappings, -- 2.39.5