From 5a9834134f7a995a92fdb29b2ac7af7fa360a3b6 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 16 Sep 2017 16:36:18 -0400 Subject: [PATCH] Remove VectorSlice from some internal functions. --- source/fe/fe_values.cc | 113 +++++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 45 deletions(-) diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 4892d82e31..87d9337dce 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -2700,16 +2700,17 @@ namespace internal } } - template + template void - do_function_values (const Number *dof_values_ptr, - const dealii::Table<2,double> &shape_values, - const FiniteElement &fe, - const std::vector &shape_function_to_row_table, - VectorSlice > &values, - const bool quadrature_points_fastest = false, - const unsigned int component_multiple = 1) + 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) { + typedef typename VectorType::value_type Number; // initialize with zero for (unsigned int i=0; i void - do_function_derivatives (const Number *dof_values_ptr, - const dealii::Table<2,Tensor > &shape_derivatives, - const FiniteElement &fe, - const std::vector &shape_function_to_row_table, - VectorSlice > > > &derivatives, - const bool quadrature_points_fastest = false, - const unsigned int component_multiple = 1) + do_function_derivatives (const Number *dof_values_ptr, + const dealii::Table<2,Tensor > &shape_derivatives, + const FiniteElement &fe, + const std::vector &shape_function_to_row_table, + ArrayView > > derivatives, + const bool quadrature_points_fastest = false, + const unsigned int component_multiple = 1) { // initialize with zero for (unsigned int i=0; i::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); - VectorSlice > > val(values); - internal::do_function_values(dof_values.begin(), this->finite_element_output.shape_values, *fe, - this->finite_element_output.shape_function_to_row_table, val); + internal::do_function_values(dof_values.begin(), + this->finite_element_output.shape_values, + *fe, + this->finite_element_output.shape_function_to_row_table, + make_array_view(values.begin(), values.end())); } @@ -3145,13 +3148,16 @@ void FEValuesBase::get_function_values ( Assert (this->update_flags & update_values, ExcAccessToUninitializedField("update_values")); - VectorSlice > > val(values); boost::container::small_vector dof_values(dofs_per_cell); for (unsigned int i=0; ifinite_element_output.shape_values, *fe, - this->finite_element_output.shape_function_to_row_table, val, - false, indices.size()/dofs_per_cell); + internal::do_function_values(dof_values.data(), + this->finite_element_output.shape_values, + *fe, + this->finite_element_output.shape_function_to_row_table, + make_array_view(values.begin(), values.end()), + false, + indices.size()/dofs_per_cell); } @@ -3176,8 +3182,11 @@ void FEValuesBase::get_function_values ( boost::container::small_vector dof_values(indices.size()); for (unsigned int i=0; ifinite_element_output.shape_values, *fe, - this->finite_element_output.shape_function_to_row_table, values, + internal::do_function_values(dof_values.data(), + this->finite_element_output.shape_values, + *fe, + this->finite_element_output.shape_function_to_row_table, + make_array_view(values.begin(), values.end()), quadrature_points_fastest, indices.size()/dofs_per_cell); } @@ -3248,10 +3257,11 @@ 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); - VectorSlice > > > grads(gradients); - internal::do_function_derivatives(dof_values.begin(), this->finite_element_output.shape_gradients, - *fe, this->finite_element_output.shape_function_to_row_table, - grads); + internal::do_function_derivatives(dof_values.begin(), + this->finite_element_output.shape_gradients, + *fe, + this->finite_element_output.shape_function_to_row_table, + make_array_view(gradients.begin(), gradients.end())); } @@ -3275,9 +3285,12 @@ void FEValuesBase::get_function_gradients ( boost::container::small_vector dof_values(indices.size()); for (unsigned int i=0; ifinite_element_output.shape_gradients, - *fe, this->finite_element_output.shape_function_to_row_table, - gradients, quadrature_points_fastest, + internal::do_function_derivatives(dof_values.data(), + this->finite_element_output.shape_gradients, + *fe, + this->finite_element_output.shape_function_to_row_table, + make_array_view(gradients.begin(), gradients.end()), + quadrature_points_fastest, indices.size()/dofs_per_cell); } @@ -3348,10 +3361,12 @@ get_function_hessians (const InputVector &fe_function, // get function values of dofs on this cell Vector dof_values (dofs_per_cell); present_cell->get_interpolated_dof_values(fe_function, dof_values); - VectorSlice > > > hes(hessians); - internal::do_function_derivatives(dof_values.begin(), this->finite_element_output.shape_hessians, - *fe, this->finite_element_output.shape_function_to_row_table, - hes, quadrature_points_fastest); + internal::do_function_derivatives(dof_values.begin(), + this->finite_element_output.shape_hessians, + *fe, + this->finite_element_output.shape_function_to_row_table, + make_array_view(hessians.begin(), hessians.end()), + quadrature_points_fastest); } @@ -3373,9 +3388,12 @@ void FEValuesBase::get_function_hessians ( boost::container::small_vector dof_values(indices.size()); for (unsigned int i=0; ifinite_element_output.shape_hessians, - *fe, this->finite_element_output.shape_function_to_row_table, - hessians, quadrature_points_fastest, + internal::do_function_derivatives(dof_values.data(), + this->finite_element_output.shape_hessians, + *fe, + this->finite_element_output.shape_function_to_row_table, + make_array_view(hessians.begin(), hessians.end()), + quadrature_points_fastest, indices.size()/dofs_per_cell); } @@ -3565,10 +3583,12 @@ get_function_third_derivatives (const InputVector &fe_fu // get function values of dofs on this cell Vector dof_values (dofs_per_cell); present_cell->get_interpolated_dof_values(fe_function, dof_values); - VectorSlice > > > third(third_derivatives); - internal::do_function_derivatives(dof_values.begin(), this->finite_element_output.shape_3rd_derivatives, - *fe, this->finite_element_output.shape_function_to_row_table, - third, quadrature_points_fastest); + internal::do_function_derivatives(dof_values.begin(), + this->finite_element_output.shape_3rd_derivatives, + *fe, + this->finite_element_output.shape_function_to_row_table, + make_array_view(third_derivatives.begin(), third_derivatives.end()), + quadrature_points_fastest); } @@ -3590,9 +3610,12 @@ void FEValuesBase::get_function_third_derivatives ( boost::container::small_vector dof_values(indices.size()); for (unsigned int i=0; ifinite_element_output.shape_3rd_derivatives, - *fe, this->finite_element_output.shape_function_to_row_table, - third_derivatives, quadrature_points_fastest, + internal::do_function_derivatives(dof_values.data(), + this->finite_element_output.shape_3rd_derivatives, + *fe, + this->finite_element_output.shape_function_to_row_table, + make_array_view(third_derivatives.begin(), third_derivatives.end()), + quadrature_points_fastest, indices.size()/dofs_per_cell); } -- 2.39.5