]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fe/fe_values: convert internal::do_function_gradients to ArrayView
authorMatthias Maier <maier@tamu.edu>
Thu, 22 Jun 2023 05:54:10 +0000 (00:54 -0500)
committerMatthias Maier <tamiko@43-1.org>
Thu, 22 Jun 2023 05:59:50 +0000 (00:59 -0500)
source/fe/fe_values.cc

index 562c636d53c6230304e698c25c9522f4cb50173d..ecbcf5cf55c71e437f325ec4df8346fffd833b98 100644 (file)
@@ -2969,7 +2969,7 @@ namespace internal
   template <int order, int spacedim, typename Number>
   void
   do_function_derivatives(
-    const Number *                                   dof_values_ptr,
+    const ArrayView<Number> &                        dof_values,
     const dealii::Table<2, Tensor<order, spacedim>> &shape_derivatives,
     std::vector<Tensor<order, spacedim, Number>> &   derivatives)
   {
@@ -2990,7 +2990,7 @@ namespace internal
     // access the shape_gradients/hessians data stored contiguously
     for (unsigned int shape_func = 0; shape_func < dofs_per_cell; ++shape_func)
       {
-        const Number &value = dof_values_ptr[shape_func];
+        const Number &value = dof_values[shape_func];
         // For auto-differentiable numbers, the fact that a DoF value is zero
         // does not imply that its derivatives are zero as well. So we
         // can't filter by value for these number types.
@@ -3009,7 +3009,7 @@ namespace internal
   template <int order, int dim, int spacedim, typename Number>
   void
   do_function_derivatives(
-    const Number *                                   dof_values_ptr,
+    const ArrayView<Number> &                        dof_values,
     const dealii::Table<2, Tensor<order, spacedim>> &shape_derivatives,
     const FiniteElement<dim, spacedim> &             fe,
     const std::vector<unsigned int> &shape_function_to_row_table,
@@ -3057,7 +3057,7 @@ namespace internal
       for (unsigned int shape_func = 0; shape_func < dofs_per_cell;
            ++shape_func)
         {
-          const Number &value = dof_values_ptr[shape_func + mc * dofs_per_cell];
+          const Number &value = dof_values[shape_func + mc * dofs_per_cell];
           // For auto-differentiable numbers, the fact that a DoF value is zero
           // does not imply that its derivatives are zero as well. So we
           // can't filter by value for these number types.
@@ -3423,7 +3423,8 @@ FEValuesBase<dim, spacedim>::get_function_gradients(
   // get function values of dofs on this cell
   Vector<Number> dof_values(dofs_per_cell);
   present_cell.get_interpolated_dof_values(fe_function, dof_values);
-  internal::do_function_derivatives(dof_values.begin(),
+  internal::do_function_derivatives(make_array_view(dof_values.begin(),
+                                                    dof_values.end()),
                                     this->finite_element_output.shape_gradients,
                                     gradients);
 }
@@ -3448,7 +3449,8 @@ FEValuesBase<dim, spacedim>::get_function_gradients(
   boost::container::small_vector<Number, 200> dof_values(dofs_per_cell);
   for (unsigned int i = 0; i < dofs_per_cell; ++i)
     dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
-  internal::do_function_derivatives(dof_values.data(),
+  internal::do_function_derivatives(make_array_view(dof_values.begin(),
+                                                    dof_values.end()),
                                     this->finite_element_output.shape_gradients,
                                     gradients);
 }
@@ -3474,7 +3476,7 @@ FEValuesBase<dim, spacedim>::get_function_gradients(
   Vector<Number> dof_values(dofs_per_cell);
   present_cell.get_interpolated_dof_values(fe_function, dof_values);
   internal::do_function_derivatives(
-    dof_values.begin(),
+    make_array_view(dof_values.begin(), dof_values.end()),
     this->finite_element_output.shape_gradients,
     *fe,
     this->finite_element_output.shape_function_to_row_table,
@@ -3505,7 +3507,7 @@ FEValuesBase<dim, spacedim>::get_function_gradients(
   for (unsigned int i = 0; i < indices.size(); ++i)
     dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
   internal::do_function_derivatives(
-    dof_values.data(),
+    make_array_view(dof_values.begin(), dof_values.end()),
     this->finite_element_output.shape_gradients,
     *fe,
     this->finite_element_output.shape_function_to_row_table,
@@ -3534,7 +3536,8 @@ FEValuesBase<dim, spacedim>::get_function_hessians(
   // get function values of dofs on this cell
   Vector<Number> dof_values(dofs_per_cell);
   present_cell.get_interpolated_dof_values(fe_function, dof_values);
-  internal::do_function_derivatives(dof_values.begin(),
+  internal::do_function_derivatives(make_array_view(dof_values.begin(),
+                                                    dof_values.end()),
                                     this->finite_element_output.shape_hessians,
                                     hessians);
 }
@@ -3559,7 +3562,8 @@ FEValuesBase<dim, spacedim>::get_function_hessians(
   boost::container::small_vector<Number, 200> dof_values(dofs_per_cell);
   for (unsigned int i = 0; i < dofs_per_cell; ++i)
     dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
-  internal::do_function_derivatives(dof_values.data(),
+  internal::do_function_derivatives(make_array_view(dof_values.begin(),
+                                                    dof_values.end()),
                                     this->finite_element_output.shape_hessians,
                                     hessians);
 }
@@ -3586,7 +3590,7 @@ FEValuesBase<dim, spacedim>::get_function_hessians(
   Vector<Number> dof_values(dofs_per_cell);
   present_cell.get_interpolated_dof_values(fe_function, dof_values);
   internal::do_function_derivatives(
-    dof_values.begin(),
+    make_array_view(dof_values.begin(), dof_values.end()),
     this->finite_element_output.shape_hessians,
     *fe,
     this->finite_element_output.shape_function_to_row_table,
@@ -3616,7 +3620,7 @@ FEValuesBase<dim, spacedim>::get_function_hessians(
   for (unsigned int i = 0; i < indices.size(); ++i)
     dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
   internal::do_function_derivatives(
-    dof_values.data(),
+    make_array_view(dof_values.begin(), dof_values.end()),
     this->finite_element_output.shape_hessians,
     *fe,
     this->finite_element_output.shape_function_to_row_table,
@@ -3781,7 +3785,7 @@ FEValuesBase<dim, spacedim>::get_function_third_derivatives(
   Vector<Number> dof_values(dofs_per_cell);
   present_cell.get_interpolated_dof_values(fe_function, dof_values);
   internal::do_function_derivatives(
-    dof_values.begin(),
+    make_array_view(dof_values.begin(), dof_values.end()),
     this->finite_element_output.shape_3rd_derivatives,
     third_derivatives);
 }
@@ -3807,7 +3811,7 @@ FEValuesBase<dim, spacedim>::get_function_third_derivatives(
   for (unsigned int i = 0; i < dofs_per_cell; ++i)
     dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
   internal::do_function_derivatives(
-    dof_values.data(),
+    make_array_view(dof_values.begin(), dof_values.end()),
     this->finite_element_output.shape_3rd_derivatives,
     third_derivatives);
 }
@@ -3834,7 +3838,7 @@ FEValuesBase<dim, spacedim>::get_function_third_derivatives(
   Vector<Number> dof_values(dofs_per_cell);
   present_cell.get_interpolated_dof_values(fe_function, dof_values);
   internal::do_function_derivatives(
-    dof_values.begin(),
+    make_array_view(dof_values.begin(), dof_values.end()),
     this->finite_element_output.shape_3rd_derivatives,
     *fe,
     this->finite_element_output.shape_function_to_row_table,
@@ -3864,7 +3868,7 @@ FEValuesBase<dim, spacedim>::get_function_third_derivatives(
   for (unsigned int i = 0; i < indices.size(); ++i)
     dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
   internal::do_function_derivatives(
-    dof_values.data(),
+    make_array_view(dof_values.begin(), dof_values.end()),
     this->finite_element_output.shape_3rd_derivatives,
     *fe,
     this->finite_element_output.shape_function_to_row_table,

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.