]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Mark an input argument as 'const', and in the process give it a reasonable type. 16973/head
authorWolfgang Bangerth <bangerth@colostate.edu>
Mon, 6 May 2024 15:57:28 +0000 (21:27 +0530)
committerWolfgang Bangerth <bangerth@colostate.edu>
Mon, 6 May 2024 15:57:28 +0000 (21:27 +0530)
include/deal.II/fe/mapping_fe_field.h
source/fe/mapping_fe_field.cc

index 1f90d82033a6ebc197acd6ebe109929b74ded6b0..c972f592a1086a080c08f3f262d8e59f7014f282 100644 (file)
@@ -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<dim, spacedim>::cell_iterator &cell,
     const Point<spacedim>                                      &p,
-    Quadrature<dim> &point_quadrature,
-    InternalData    &mdata) const;
+    const Point<dim>                                           &starting_guess,
+    InternalData                                               &mdata) const;
 
   /**
    * Update internal degrees of freedom.
index 50fd675c30b565c10ef67b7bbfb1f9a0d0b971dc..719f429e5148db9147beab73fba7509e1baa18f7 100644 (file)
@@ -2249,13 +2249,11 @@ MappingFEField<dim, spacedim, VectorType>::transform_real_to_unit_cell(
 
   initial_p_unit = cell->reference_cell().closest_point(initial_p_unit);
 
-  Quadrature<dim> point_quadrature(initial_p_unit);
-
   UpdateFlags update_flags = update_quadrature_points | update_jacobians;
   if (spacedim > dim)
     update_flags |= update_jacobian_grads;
   std::unique_ptr<typename Mapping<dim, spacedim>::InternalDataBase> mdata(
-    get_data(update_flags, point_quadrature));
+    get_data(update_flags, Quadrature<dim>(initial_p_unit)));
   Assert(dynamic_cast<InternalData *>(mdata.get()) != nullptr,
          ExcInternalError());
 
@@ -2263,7 +2261,7 @@ MappingFEField<dim, spacedim, VectorType>::transform_real_to_unit_cell(
 
   return do_transform_real_to_unit_cell(cell,
                                         p,
-                                        point_quadrature,
+                                        initial_p_unit,
                                         static_cast<InternalData &>(*mdata));
 }
 
@@ -2273,7 +2271,7 @@ Point<dim>
 MappingFEField<dim, spacedim, VectorType>::do_transform_real_to_unit_cell(
   const typename Triangulation<dim, spacedim>::cell_iterator &cell,
   const Point<spacedim>                                      &p,
-  Quadrature<dim>                                            &point_quadrature,
+  const Point<dim>                                           &starting_guess,
   InternalData                                               &mdata) const
 {
   const unsigned int n_shapes = mdata.shape_values.size();
@@ -2291,10 +2289,9 @@ MappingFEField<dim, spacedim, VectorType>::do_transform_real_to_unit_cell(
   // of the mapping at this point are
   // previously computed.
 
-  AssertDimension(point_quadrature.size(), 1);
-  Point<dim> p_unit = point_quadrature.point(0);
+  Point<dim> p_unit = starting_guess;
   Point<dim> f;
-  mdata.reinit(mdata.update_each, point_quadrature);
+  mdata.reinit(mdata.update_each, Quadrature<dim>(starting_guess));
 
   Point<spacedim>     p_real(do_transform_unit_to_real_cell(mdata));
   Tensor<1, spacedim> p_minus_F              = p - p_real;
@@ -2343,11 +2340,10 @@ MappingFEField<dim, spacedim, VectorType>::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<const Point<dim>>(&p_unit_trial, 1));
-          mdata.reinit(mdata.update_each, point_quadrature);
+          mdata.reinit(mdata.update_each, Quadrature<dim>(p_unit_trial));
           // f(x)
-          Point<spacedim> p_real_trial = do_transform_unit_to_real_cell(mdata);
+          const Point<spacedim> 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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.