From: Mathias Anselmann Date: Thu, 20 May 2021 16:51:38 +0000 (+0200) Subject: small changes which resulted in problems when merging a GCC 11 fix X-Git-Tag: v9.3.0-rc1~26^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12264%2Fhead;p=dealii.git small changes which resulted in problems when merging a GCC 11 fix --- diff --git a/examples/step-12/step-12.cc b/examples/step-12/step-12.cc index e61887b79b..f91e94999e 100644 --- a/examples/step-12/step-12.cc +++ b/examples/step-12/step-12.cc @@ -120,9 +120,9 @@ namespace Step12 { Assert(dim >= 2, ExcNotImplemented()); - Point wind_field; - wind_field(0) = -p(1); - wind_field(1) = p(0); + Tensor<1, dim> wind_field; + wind_field[0] = -p[1]; + wind_field[1] = p[0]; if (wind_field.norm() > 1e-10) wind_field /= wind_field.norm(); diff --git a/examples/step-12b/step-12b.cc b/examples/step-12b/step-12b.cc index 0b3fc73526..9c00608114 100644 --- a/examples/step-12b/step-12b.cc +++ b/examples/step-12b/step-12b.cc @@ -126,9 +126,9 @@ namespace Step12 { Assert(dim >= 2, ExcNotImplemented()); - Point wind_field; - wind_field(0) = -p(1); - wind_field(1) = p(0); + Tensor<1, dim> wind_field; + wind_field[0] = -p[1]; + wind_field[1] = p[0]; wind_field /= wind_field.norm(); return wind_field; diff --git a/examples/step-19/step-19.cc b/examples/step-19/step-19.cc index e3af6b4d97..37af115505 100644 --- a/examples/step-19/step-19.cc +++ b/examples/step-19/step-19.cc @@ -470,7 +470,7 @@ namespace Step19 if (particle_handler.n_particles_in_cell(cell) > 0) for (const auto &particle : particle_handler.particles_in_cell(cell)) { - const Point reference_location = + const Point &reference_location = particle.get_reference_location(); for (const unsigned int i : fe_values.dof_indices()) cell_rhs(i) += @@ -613,7 +613,7 @@ namespace Step19 if ((E * fe_face_values.normal_vector(q_point) < 0) && (E.norm() > Constants::E_threshold)) { - const Point location = + const Point &location = fe_face_values.quadrature_point(q_point); Particles::Particle new_particle; @@ -682,7 +682,8 @@ namespace Step19 particle != particles_in_cell.end(); ++particle, ++particle_index) { - const Tensor<1, dim> E = evaluator.get_gradient(particle_index); + const Tensor<1, dim> &E = + evaluator.get_gradient(particle_index); // Having now obtained the electric field at the location of one // of the particles, we use this to update first the velocity diff --git a/examples/step-4/step-4.cc b/examples/step-4/step-4.cc index 9f552e049b..6084770a39 100644 --- a/examples/step-4/step-4.cc +++ b/examples/step-4/step-4.cc @@ -378,7 +378,7 @@ void Step4::assemble_system() fe_values.shape_grad(j, q_index) * // grad phi_j(x_q) fe_values.JxW(q_index)); // dx - const auto x_q = fe_values.quadrature_point(q_index); + const auto &x_q = fe_values.quadrature_point(q_index); cell_rhs(i) += (fe_values.shape_value(i, q_index) * // phi_i(x_q) right_hand_side.value(x_q) * // f(x_q) fe_values.JxW(q_index)); // dx diff --git a/examples/step-47/step-47.cc b/examples/step-47/step-47.cc index 8440a29f40..e683a19ee6 100644 --- a/examples/step-47/step-47.cc +++ b/examples/step-47/step-47.cc @@ -405,12 +405,12 @@ namespace Step47 { for (unsigned int i = 0; i < dofs_per_cell; ++i) { - const Tensor<2, dim> hessian_i = + const Tensor<2, dim> &hessian_i = fe_values.shape_hessian(i, qpoint); for (unsigned int j = 0; j < dofs_per_cell; ++j) { - const Tensor<2, dim> hessian_j = + const Tensor<2, dim> &hessian_j = fe_values.shape_hessian(j, qpoint); copy_data.cell_matrix(i, j) += diff --git a/examples/step-61/step-61.cc b/examples/step-61/step-61.cc index 9b66d90982..d3c35b6b2a 100644 --- a/examples/step-61/step-61.cc +++ b/examples/step-61/step-61.cc @@ -522,7 +522,7 @@ namespace Step61 for (unsigned int q = 0; q < n_face_q_points; ++q) { - const Tensor<1, dim> normal = fe_face_values.normal_vector(q); + const Tensor<1, dim> &normal = fe_face_values.normal_vector(q); for (unsigned int i = 0; i < dofs_per_cell_dgrt; ++i) { @@ -769,7 +769,7 @@ namespace Step61 for (unsigned int q = 0; q < n_face_q_points; ++q) { - const Tensor<1, dim> normal = fe_face_values.normal_vector(q); + const Tensor<1, dim> &normal = fe_face_values.normal_vector(q); for (unsigned int i = 0; i < dofs_per_cell_dgrt; ++i) { @@ -939,7 +939,7 @@ namespace Step61 const Tensor<1, dim> true_velocity = exact_velocity.value(fe_face_values_dgrt.quadrature_point(q)); - const Tensor<1, dim> normal = + const Tensor<1, dim> &normal = fe_face_values_dgrt.normal_vector(q); L2_err_flux_face_sqr_local += diff --git a/examples/step-9/step-9.cc b/examples/step-9/step-9.cc index 49ed119ec9..d29c49fed8 100644 --- a/examples/step-9/step-9.cc +++ b/examples/step-9/step-9.cc @@ -131,7 +131,7 @@ namespace Step9 template Tensor<1, dim> AdvectionField::value(const Point &p) const { - Point value; + Tensor<1, dim> value; value[0] = 2; for (unsigned int i = 1; i < dim; ++i) value[i] = 1 + 0.8 * std::sin(8. * numbers::PI * p[0]); diff --git a/include/deal.II/base/quadrature_lib.h b/include/deal.II/base/quadrature_lib.h index a1bcf8802a..af9a4c0174 100644 --- a/include/deal.II/base/quadrature_lib.h +++ b/include/deal.II/base/quadrature_lib.h @@ -253,7 +253,7 @@ public: * formula or it is factored out, to be included in the integrand. */ QGaussLogR(const unsigned int n, - const Point x0 = Point(), + const Point & x0 = Point(), const double alpha = 1, const bool factor_out_singular_weight = false); @@ -333,7 +333,7 @@ public: * @endcode */ QGaussOneOverR(const unsigned int n, - const Point singularity, + const Point & singularity, const bool factor_out_singular_weight = false); /** * The constructor takes three arguments: the order of the Gauss formula, @@ -380,7 +380,7 @@ private: * the cell, on an edge of the cell, or on a corner of the cell. */ static unsigned int - quad_size(const Point singularity, const unsigned int n); + quad_size(const Point &singularity, const unsigned int n); }; @@ -911,7 +911,7 @@ template <> QGaussLog<1>::QGaussLog(const unsigned int n, const bool revert); template <> QGaussLogR<1>::QGaussLogR(const unsigned int n, - const Point<1> x0, + const Point<1> & x0, const double alpha, const bool flag); template <> diff --git a/include/deal.II/fe/mapping_q_internal.h b/include/deal.II/fe/mapping_q_internal.h index 77bd25c84e..4ee907fcfd 100644 --- a/include/deal.II/fe/mapping_q_internal.h +++ b/include/deal.II/fe/mapping_q_internal.h @@ -261,7 +261,7 @@ namespace internal for (unsigned int i = 0; i < M; ++i) for (unsigned int j = 0; j < M; ++j) { - const Point<2> p = + const Point<2> &p = gl.point((i + 1) * (polynomial_degree + 1) + (j + 1)); const unsigned int index_table = i * M + j; for (unsigned int v = 0; v < 4; ++v) @@ -315,8 +315,8 @@ namespace internal for (unsigned int j = 0; j < M; ++j) for (unsigned int k = 0; k < M; ++k) { - const Point<3> p = gl.point((i + 1) * (M + 2) * (M + 2) + - (j + 1) * (M + 2) + (k + 1)); + const Point<3> & p = gl.point((i + 1) * (M + 2) * (M + 2) + + (j + 1) * (M + 2) + (k + 1)); const unsigned int index_table = i * M * M + j * M + k; // vertices diff --git a/include/deal.II/grid/grid_generator.h b/include/deal.II/grid/grid_generator.h index 2da9f9590c..90fca82336 100644 --- a/include/deal.II/grid/grid_generator.h +++ b/include/deal.II/grid/grid_generator.h @@ -395,7 +395,7 @@ namespace GridGenerator const double pad_top = 2., const double pad_left = 1., const double pad_right = 1., - const Point center = Point(), + const Point & center = Point(), const types::manifold_id polar_manifold_id = 0, const types::manifold_id tfi_manifold_id = 1, const double L = 1., diff --git a/include/deal.II/integrators/laplace.h b/include/deal.II/integrators/laplace.h index 0be1d8326c..875de4e703 100644 --- a/include/deal.II/integrators/laplace.h +++ b/include/deal.II/integrators/laplace.h @@ -167,8 +167,8 @@ namespace LocalIntegrators for (unsigned int k = 0; k < fe.n_quadrature_points; ++k) { - const double dx = fe.JxW(k) * factor; - const Tensor<1, dim> n = fe.normal_vector(k); + const double dx = fe.JxW(k) * factor; + const Tensor<1, dim> &n = fe.normal_vector(k); for (unsigned int i = 0; i < n_dofs; ++i) for (unsigned int j = 0; j < n_dofs; ++j) for (unsigned int d = 0; d < n_comp; ++d) @@ -382,8 +382,8 @@ namespace LocalIntegrators for (unsigned int k = 0; k < fe1.n_quadrature_points; ++k) { - const double dx = fe1.JxW(k); - const Tensor<1, dim> n = fe1.normal_vector(k); + const double dx = fe1.JxW(k); + const Tensor<1, dim> &n = fe1.normal_vector(k); for (unsigned int d = 0; d < fe1.get_fe().n_components(); ++d) { for (unsigned int i = 0; i < n_dofs; ++i) diff --git a/include/deal.II/matrix_free/shape_info.templates.h b/include/deal.II/matrix_free/shape_info.templates.h index 591010b170..218713f9c2 100644 --- a/include/deal.II/matrix_free/shape_info.templates.h +++ b/include/deal.II/matrix_free/shape_info.templates.h @@ -386,7 +386,7 @@ namespace internal for (unsigned int i = 0; i < n_dofs; ++i) for (unsigned int q = 0; q < n_q_points_face; ++q) { - const auto point = + const auto &point = projected_quad_face.point(q + offset); shape_values_face(f, o, i * n_q_points_face + q) = diff --git a/include/deal.II/numerics/vector_tools_boundary.templates.h b/include/deal.II/numerics/vector_tools_boundary.templates.h index f50a56ea29..6fb5ec1c58 100644 --- a/include/deal.II/numerics/vector_tools_boundary.templates.h +++ b/include/deal.II/numerics/vector_tools_boundary.templates.h @@ -2832,7 +2832,7 @@ namespace VectorTools } // Tensor of normal vector on the face at q_point; - const Tensor<1, dim> normal_vector = + const Tensor<1, dim> &normal_vector = fe_face_values.normal_vector(q_point); // Now compute the linear system: diff --git a/include/deal.II/numerics/vector_tools_constraints.templates.h b/include/deal.II/numerics/vector_tools_constraints.templates.h index 24477aac63..d3e51e020e 100644 --- a/include/deal.II/numerics/vector_tools_constraints.templates.h +++ b/include/deal.II/numerics/vector_tools_constraints.templates.h @@ -656,8 +656,8 @@ namespace VectorTools normal_vector[d] = 0; normal_vector /= normal_vector.norm(); - const Point point = fe_values.quadrature_point(i); - Vector b_values(dim); + const Point &point = fe_values.quadrature_point(i); + Vector b_values(dim); function_map.at(*b_id)->vector_value(point, b_values); // now enter the (dofs,(normal_vector,cell)) entry into @@ -1165,8 +1165,8 @@ namespace VectorTools i, face_no) .second][component] = face_dofs[i]; - const Point point = fe_values.quadrature_point(i); - const double b_value = + const Point &point = fe_values.quadrature_point(i); + const double b_value = function_map.at(*b_id)->value(point, component); dof_to_b_value.insert( std::make_pair(face_dofs[i], b_value)); diff --git a/source/base/quadrature_lib.cc b/source/base/quadrature_lib.cc index 2733115cb3..88ad96517d 100644 --- a/source/base/quadrature_lib.cc +++ b/source/base/quadrature_lib.cc @@ -526,7 +526,7 @@ QGaussLog<1>::get_quadrature_weights(const unsigned int n) template <> QGaussLogR<1>::QGaussLogR(const unsigned int n, - const Point<1> origin, + const Point<1> & origin, const double alpha, const bool factor_out_singularity) : Quadrature<1>( @@ -606,7 +606,7 @@ QGaussLogR<1>::QGaussLogR(const unsigned int n, template <> unsigned int -QGaussOneOverR<2>::quad_size(const Point<2> singularity, const unsigned int n) +QGaussOneOverR<2>::quad_size(const Point<2> &singularity, const unsigned int n) { const double eps = 1e-8; const bool on_edge = @@ -628,7 +628,7 @@ QGaussOneOverR<2>::quad_size(const Point<2> singularity, const unsigned int n) template <> QGaussOneOverR<2>::QGaussOneOverR(const unsigned int n, - const Point<2> singularity, + const Point<2> & singularity, const bool factor_out_singularity) : Quadrature<2>(quad_size(singularity, n)) { @@ -1258,8 +1258,8 @@ QTrianglePolar::QTrianglePolar(const Quadrature<1> &radial_quadrature, this->weights.resize(base.size()); for (unsigned int i = 0; i < base.size(); ++i) { - const auto q = base.point(i); - const auto w = base.weight(i); + const auto &q = base.point(i); + const auto w = base.weight(i); const auto xhat = q[0]; const auto yhat = q[1]; @@ -1295,8 +1295,8 @@ QDuffy::QDuffy(const Quadrature<1> &radial_quadrature, this->weights.resize(base.size()); for (unsigned int i = 0; i < base.size(); ++i) { - const auto q = base.point(i); - const auto w = base.weight(i); + const auto &q = base.point(i); + const auto w = base.weight(i); const auto xhat = q[0]; const auto yhat = q[1]; diff --git a/source/grid/grid_generator.cc b/source/grid/grid_generator.cc index 1728060c3c..81fdd1eef0 100644 --- a/source/grid/grid_generator.cc +++ b/source/grid/grid_generator.cc @@ -413,7 +413,7 @@ namespace GridGenerator * airfoil points. */ static std::array>, 2> - joukowski(const Point<2> centerpoint, + joukowski(const Point<2> & centerpoint, const unsigned int number_points, const unsigned int factor) { @@ -3282,7 +3282,7 @@ namespace GridGenerator const double /*pad_top*/, const double /*pad_left*/, const double /*pad_right*/, - const Point<1> /*center*/, + const Point<1> & /*center*/, const types::manifold_id /*polar_manifold_id*/, const types::manifold_id /*tfi_manifold_id*/, const double /*L*/, @@ -3344,7 +3344,7 @@ namespace GridGenerator const double pad_top, const double pad_left, const double pad_right, - const Point<2> new_center, + const Point<2> & new_center, const types::manifold_id polar_manifold_id, const types::manifold_id tfi_manifold_id, const double L, @@ -3527,7 +3527,7 @@ namespace GridGenerator const double pad_top, const double pad_left, const double pad_right, - const Point<3> new_center, + const Point<3> & new_center, const types::manifold_id polar_manifold_id, const types::manifold_id tfi_manifold_id, const double L, diff --git a/source/grid/grid_generator_from_name.cc b/source/grid/grid_generator_from_name.cc index 1ac0314e93..60f8952640 100644 --- a/source/grid/grid_generator_from_name.cc +++ b/source/grid/grid_generator_from_name.cc @@ -111,7 +111,7 @@ namespace GridGenerator double, double, double, - const Point, + const Point &, types::manifold_id, types::manifold_id, double, diff --git a/source/numerics/derivative_approximation.cc b/source/numerics/derivative_approximation.cc index 5871717ade..e07ae53b95 100644 --- a/source/numerics/derivative_approximation.cc +++ b/source/numerics/derivative_approximation.cc @@ -839,7 +839,7 @@ namespace DerivativeApproximation neighbor_fe_midpoint_value, solution, component); // ...and the place where it lives - const Point neighbor_center = + const Point &neighbor_center = neighbor_fe_midpoint_value.quadrature_point(0); @@ -848,6 +848,7 @@ namespace DerivativeApproximation // direction between // the centers of two // cells + Tensor<1, dim> y = neighbor_center - this_center; const double distance = y.norm(); // normalize y diff --git a/source/numerics/point_value_history.cc b/source/numerics/point_value_history.cc index 2c190caf41..79575ef9e7 100644 --- a/source/numerics/point_value_history.cc +++ b/source/numerics/point_value_history.cc @@ -255,7 +255,8 @@ PointValueHistory::add_point(const Point &location) unsigned int component = dof_handler->get_fe() .system_to_component_index(support_point) .first; - Point test_point = fe_values.quadrature_point(support_point); + const Point &test_point = + fe_values.quadrature_point(support_point); if (location.distance(test_point) < location.distance(current_points[component])) @@ -402,7 +403,8 @@ PointValueHistory::add_points(const std::vector> &locations) unsigned int component = dof_handler->get_fe() .system_to_component_index(support_point) .first; - Point test_point = fe_values.quadrature_point(support_point); + const Point &test_point = + fe_values.quadrature_point(support_point); for (unsigned int point = 0; point < locations.size(); point++) { diff --git a/source/particles/generators.cc b/source/particles/generators.cc index e54b47608c..32750d09fd 100644 --- a/source/particles/generators.cc +++ b/source/particles/generators.cc @@ -177,7 +177,7 @@ namespace Particles std::uniform_real_distribution uniform_distribution_01(0, 1); const BoundingBox cell_bounding_box(cell->bounding_box()); - const std::pair, Point> cell_bounds( + const std::pair, Point> &cell_bounds( cell_bounding_box.get_boundary_points()); // Generate random points in these bounds until one is within the cell