From 4db2606c40f96f224114566a8621cbbc011a595f Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 22 Jun 2023 00:49:43 -0500 Subject: [PATCH] fe/fe_values: convert internal::do_function_values to ArrayView --- source/fe/fe_values.cc | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 5f5a84e663..562c636d53 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -2817,7 +2817,7 @@ namespace internal template void - do_function_values(const Number2 * dof_values_ptr, + do_function_values(const ArrayView & dof_values, const dealii::Table<2, double> &shape_values, std::vector & values) { @@ -2839,7 +2839,7 @@ namespace internal // the shape_values data stored contiguously for (unsigned int shape_func = 0; shape_func < dofs_per_cell; ++shape_func) { - const Number2 value = dof_values_ptr[shape_func]; + const Number2 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. @@ -2858,13 +2858,13 @@ namespace internal template void do_function_values( - const typename VectorType::value_type *dof_values_ptr, - const dealii::Table<2, double> & shape_values, - const FiniteElement & fe, - const std::vector & shape_function_to_row_table, - ArrayView values, - const bool quadrature_points_fastest = false, - const unsigned int component_multiple = 1) + const ArrayView &dof_values, + const dealii::Table<2, double> & shape_values, + const FiniteElement & fe, + const std::vector &shape_function_to_row_table, + ArrayView values, + const bool quadrature_points_fastest = false, + const unsigned int component_multiple = 1) { using Number = typename VectorType::value_type; // initialize with zero @@ -2906,7 +2906,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. @@ -3281,7 +3281,8 @@ FEValuesBase::get_function_values( // 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_values(dof_values.begin(), + internal::do_function_values(make_array_view(dof_values.begin(), + dof_values.end()), this->finite_element_output.shape_values, values); } @@ -3305,7 +3306,8 @@ FEValuesBase::get_function_values( 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_values(dof_values.data(), + internal::do_function_values(make_array_view(dof_values.begin(), + dof_values.end()), this->finite_element_output.shape_values, values); } @@ -3330,7 +3332,7 @@ FEValuesBase::get_function_values( Vector dof_values(dofs_per_cell); present_cell.get_interpolated_dof_values(fe_function, dof_values); internal::do_function_values( - dof_values.begin(), + make_array_view(dof_values.begin(), dof_values.end()), this->finite_element_output.shape_values, *fe, this->finite_element_output.shape_function_to_row_table, @@ -3359,7 +3361,7 @@ FEValuesBase::get_function_values( for (unsigned int i = 0; i < dofs_per_cell; ++i) dof_values[i] = internal::get_vector_element(fe_function, indices[i]); internal::do_function_values( - dof_values.data(), + make_array_view(dof_values.begin(), dof_values.end()), this->finite_element_output.shape_values, *fe, this->finite_element_output.shape_function_to_row_table, @@ -3392,7 +3394,7 @@ FEValuesBase::get_function_values( for (unsigned int i = 0; i < indices.size(); ++i) dof_values[i] = internal::get_vector_element(fe_function, indices[i]); internal::do_function_values( - dof_values.data(), + make_array_view(dof_values.begin(), dof_values.end()), this->finite_element_output.shape_values, *fe, this->finite_element_output.shape_function_to_row_table, -- 2.39.5