From: Wolfgang Bangerth Date: Mon, 6 May 2024 15:57:28 +0000 (+0530) Subject: Mark an input argument as 'const', and in the process give it a reasonable type. X-Git-Tag: v9.6.0-rc1~313^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d2c5987bff20217628fda9df3b74907f439154e;p=dealii.git Mark an input argument as 'const', and in the process give it a reasonable type. --- diff --git a/include/deal.II/fe/mapping_fe_field.h b/include/deal.II/fe/mapping_fe_field.h index 1f90d82033..c972f592a1 100644 --- a/include/deal.II/fe/mapping_fe_field.h +++ b/include/deal.II/fe/mapping_fe_field.h @@ -602,13 +602,15 @@ private: /** * Transform the point @p p on the real cell to the corresponding point on - * the unit cell @p cell by a Newton iteration. + * the unit cell @p cell by a Newton iteration. @p starting_guess is + * a guess for the position on the unit cell at which this function will + * start its Newton iteration. * * Takes a reference to an @p InternalData that is assumed to be previously * created by the @p get_data function with @p UpdateFlags including @p * update_transformation_values and @p update_transformation_gradients and a * one point Quadrature that includes the given initial guess specified - * through the given @p point_quadrature object. + * through the given @p starting_guess. * * @p mdata will be changed by this function. */ @@ -616,8 +618,8 @@ private: do_transform_real_to_unit_cell( const typename Triangulation::cell_iterator &cell, const Point &p, - Quadrature &point_quadrature, - InternalData &mdata) const; + const Point &starting_guess, + InternalData &mdata) const; /** * Update internal degrees of freedom. diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index 50fd675c30..719f429e51 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -2249,13 +2249,11 @@ MappingFEField::transform_real_to_unit_cell( initial_p_unit = cell->reference_cell().closest_point(initial_p_unit); - Quadrature point_quadrature(initial_p_unit); - UpdateFlags update_flags = update_quadrature_points | update_jacobians; if (spacedim > dim) update_flags |= update_jacobian_grads; std::unique_ptr::InternalDataBase> mdata( - get_data(update_flags, point_quadrature)); + get_data(update_flags, Quadrature(initial_p_unit))); Assert(dynamic_cast(mdata.get()) != nullptr, ExcInternalError()); @@ -2263,7 +2261,7 @@ MappingFEField::transform_real_to_unit_cell( return do_transform_real_to_unit_cell(cell, p, - point_quadrature, + initial_p_unit, static_cast(*mdata)); } @@ -2273,7 +2271,7 @@ Point MappingFEField::do_transform_real_to_unit_cell( const typename Triangulation::cell_iterator &cell, const Point &p, - Quadrature &point_quadrature, + const Point &starting_guess, InternalData &mdata) const { const unsigned int n_shapes = mdata.shape_values.size(); @@ -2291,10 +2289,9 @@ MappingFEField::do_transform_real_to_unit_cell( // of the mapping at this point are // previously computed. - AssertDimension(point_quadrature.size(), 1); - Point p_unit = point_quadrature.point(0); + Point p_unit = starting_guess; Point f; - mdata.reinit(mdata.update_each, point_quadrature); + mdata.reinit(mdata.update_each, Quadrature(starting_guess)); Point p_real(do_transform_unit_to_real_cell(mdata)); Tensor<1, spacedim> p_minus_F = p - p_real; @@ -2343,11 +2340,10 @@ MappingFEField::do_transform_real_to_unit_cell( p_unit_trial[i] -= step_length * delta[i]; // shape values and derivatives // at new p_unit point - point_quadrature.initialize( - ArrayView>(&p_unit_trial, 1)); - mdata.reinit(mdata.update_each, point_quadrature); + mdata.reinit(mdata.update_each, Quadrature(p_unit_trial)); // f(x) - Point p_real_trial = do_transform_unit_to_real_cell(mdata); + const Point p_real_trial = + do_transform_unit_to_real_cell(mdata); const Tensor<1, spacedim> f_trial = p - p_real_trial; // see if we are making progress with the current step length // and if not, reduce it by a factor of two and try again