From: Matthias Maier Date: Thu, 22 Jun 2023 05:54:10 +0000 (-0500) Subject: fe/fe_values: convert internal::do_function_gradients to ArrayView X-Git-Tag: v9.5.0-rc1~59^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2d6a24f74e267d8072431d717d6cc6cf7d77e2c;p=dealii.git fe/fe_values: convert internal::do_function_gradients to ArrayView --- diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 562c636d53..ecbcf5cf55 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -2969,7 +2969,7 @@ namespace internal template void do_function_derivatives( - const Number * dof_values_ptr, + const ArrayView & dof_values, const dealii::Table<2, Tensor> &shape_derivatives, std::vector> & 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 void do_function_derivatives( - const Number * dof_values_ptr, + const ArrayView & dof_values, const dealii::Table<2, Tensor> &shape_derivatives, const FiniteElement & fe, const std::vector &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::get_function_gradients( // get function values of dofs on this cell Vector 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::get_function_gradients( boost::container::small_vector 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::get_function_gradients( Vector 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::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::get_function_hessians( // get function values of dofs on this cell Vector 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::get_function_hessians( boost::container::small_vector 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::get_function_hessians( Vector 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::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::get_function_third_derivatives( Vector 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::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::get_function_third_derivatives( Vector 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::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,