From 20d7813bbd616bb0b457942a4b571cb55c184326 Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Mon, 7 Aug 2017 11:46:47 -0600 Subject: [PATCH] Replaced dealii::Vector with ArrayView in internal FEValues calls. --- source/fe/fe_values.cc | 90 +++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index 16b2f18af7..7af003694a 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -13,6 +13,7 @@ // // --------------------------------------------------------------------- +#include #include #include #include @@ -455,7 +456,7 @@ namespace FEValuesViews // ------------------------- scalar functions -------------------------- template void - do_function_values (const ::dealii::Vector &dof_values, + do_function_values (const ArrayView &dof_values, const Table<2,double> &shape_values, const std::vector::ShapeFunctionData> &shape_function_data, std::vector::type> &values) @@ -471,7 +472,7 @@ namespace FEValuesViews shape_function void - do_function_derivatives (const ::dealii::Vector &dof_values, + do_function_derivatives (const ArrayView &dof_values, const Table<2,dealii::Tensor > &shape_derivatives, const std::vector::ShapeFunctionData> &shape_function_data, std::vector >::type> &derivatives) @@ -505,7 +506,7 @@ namespace FEValuesViews shape_function void - do_function_laplacians (const ::dealii::Vector &dof_values, + do_function_laplacians (const ArrayView &dof_values, const Table<2,dealii::Tensor<2,spacedim> > &shape_hessians, const std::vector::ShapeFunctionData> &shape_function_data, std::vector::type> &laplacians) @@ -537,7 +538,7 @@ namespace FEValuesViews shape_function - void do_function_values (const ::dealii::Vector &dof_values, + void do_function_values (const ArrayView &dof_values, const Table<2,double> &shape_values, const std::vector::ShapeFunctionData> &shape_function_data, std::vector >::type> &values) @@ -574,7 +575,7 @@ namespace FEValuesViews // shape function is zero for the selected components continue; - const Number value = dof_values(shape_function); + const Number value = dof_values[shape_function]; if (value == Number()) continue; @@ -602,7 +603,7 @@ namespace FEValuesViews template void - do_function_derivatives (const ::dealii::Vector &dof_values, + do_function_derivatives (const ArrayView &dof_values, const Table<2,dealii::Tensor > &shape_derivatives, const std::vector::ShapeFunctionData> &shape_function_data, std::vector >::type> &derivatives) @@ -624,7 +625,7 @@ namespace FEValuesViews // shape function is zero for the selected components continue; - const Number value = dof_values(shape_function); + const Number value = dof_values[shape_function]; if (value == Number()) continue; @@ -656,7 +657,7 @@ namespace FEValuesViews template void - do_function_symmetric_gradients (const ::dealii::Vector &dof_values, + do_function_symmetric_gradients (const ArrayView &dof_values, const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients, const std::vector::ShapeFunctionData> &shape_function_data, std::vector >::type> &symmetric_gradients) @@ -678,7 +679,7 @@ namespace FEValuesViews // shape function is zero for the selected components continue; - const Number value = dof_values(shape_function); + const Number value = dof_values[shape_function]; if (value == Number()) continue; @@ -709,7 +710,7 @@ namespace FEValuesViews template void - do_function_divergences (const ::dealii::Vector &dof_values, + do_function_divergences (const ArrayView &dof_values, const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients, const std::vector::ShapeFunctionData> &shape_function_data, std::vector::type> &divergences) @@ -730,7 +731,7 @@ namespace FEValuesViews // shape function is zero for the selected components continue; - const Number value = dof_values(shape_function); + const Number value = dof_values[shape_function]; if (value == Number()) continue; @@ -759,7 +760,7 @@ namespace FEValuesViews template void - do_function_curls (const ::dealii::Vector &dof_values, + do_function_curls (const ArrayView &dof_values, const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients, const std::vector::ShapeFunctionData> &shape_function_data, std::vector::type>::type> &curls) @@ -790,7 +791,7 @@ namespace FEValuesViews // shape function is zero for the selected components continue; - const Number value = dof_values (shape_function); + const Number value = dof_values[shape_function]; if (value == Number()) continue; @@ -850,7 +851,7 @@ namespace FEValuesViews // shape function is zero for the selected components continue; - const Number value = dof_values (shape_function); + const Number value = dof_values[shape_function]; if (value == Number()) continue; @@ -951,7 +952,7 @@ namespace FEValuesViews template void - do_function_laplacians (const ::dealii::Vector &dof_values, + do_function_laplacians (const ArrayView &dof_values, const Table<2,dealii::Tensor<2,spacedim> > &shape_hessians, const std::vector::ShapeFunctionData> &shape_function_data, std::vector >::type> &laplacians) @@ -973,7 +974,7 @@ namespace FEValuesViews // shape function is zero for the selected components continue; - const Number value = dof_values(shape_function); + const Number value = dof_values[shape_function]; if (value == Number()) continue; @@ -1005,7 +1006,7 @@ namespace FEValuesViews template void - do_function_values (const ::dealii::Vector &dof_values, + do_function_values (const ArrayView &dof_values, const dealii::Table<2,double> &shape_values, const std::vector::ShapeFunctionData> &shape_function_data, std::vector >::type> &values) @@ -1027,7 +1028,7 @@ namespace FEValuesViews // shape function is zero for the selected components continue; - const Number value = dof_values(shape_function); + const Number value = dof_values[shape_function]; if (value == Number()) continue; @@ -1059,7 +1060,7 @@ namespace FEValuesViews template void - do_function_divergences (const ::dealii::Vector &dof_values, + do_function_divergences (const ArrayView &dof_values, const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients, const std::vector::ShapeFunctionData> &shape_function_data, std::vector >::type> &divergences) @@ -1081,7 +1082,7 @@ namespace FEValuesViews // shape function is zero for the selected components continue; - const Number value = dof_values(shape_function); + const Number value = dof_values[shape_function]; if (value == Number()) continue; @@ -1147,7 +1148,7 @@ namespace FEValuesViews template void - do_function_values (const ::dealii::Vector &dof_values, + do_function_values (const ArrayView &dof_values, const dealii::Table<2,double> &shape_values, const std::vector::ShapeFunctionData> &shape_function_data, std::vector >::type> &values) @@ -1169,7 +1170,7 @@ namespace FEValuesViews // shape function is zero for the selected components continue; - const Number value = dof_values(shape_function); + const Number value = dof_values[shape_function]; if (value == Number()) continue; @@ -1203,7 +1204,7 @@ namespace FEValuesViews template void - do_function_divergences (const ::dealii::Vector &dof_values, + do_function_divergences (const ArrayView &dof_values, const Table<2,dealii::Tensor<1,spacedim> > &shape_gradients, const std::vector::ShapeFunctionData> &shape_function_data, std::vector >::type> &divergences) @@ -1225,7 +1226,7 @@ namespace FEValuesViews // shape function is zero for the selected components continue; - const Number value = dof_values(shape_function); + const Number value = dof_values[shape_function]; if (value == Number()) continue; @@ -1281,7 +1282,8 @@ namespace FEValuesViews dealii::Vector dof_values(fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_values - (dof_values, fe_values->finite_element_output.shape_values, shape_function_data, values); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), + fe_values->finite_element_output.shape_values, shape_function_data, values); } @@ -1304,7 +1306,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_derivatives<1,dim,spacedim> - (dof_values, fe_values->finite_element_output.shape_gradients, shape_function_data, gradients); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_gradients, shape_function_data, gradients); } @@ -1327,7 +1329,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_derivatives<2,dim,spacedim> - (dof_values, fe_values->finite_element_output.shape_hessians, shape_function_data, hessians); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_hessians, shape_function_data, hessians); } @@ -1350,7 +1352,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_laplacians - (dof_values, fe_values->finite_element_output.shape_hessians, shape_function_data, laplacians); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_hessians, shape_function_data, laplacians); } @@ -1373,7 +1375,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_derivatives<3,dim,spacedim> - (dof_values, fe_values->finite_element_output.shape_3rd_derivatives, shape_function_data, third_derivatives); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_3rd_derivatives, shape_function_data, third_derivatives); } @@ -1396,7 +1398,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_values - (dof_values, fe_values->finite_element_output.shape_values, shape_function_data, values); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_values, shape_function_data, values); } @@ -1420,7 +1422,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_derivatives<1,dim,spacedim> - (dof_values, fe_values->finite_element_output.shape_gradients, shape_function_data, gradients); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_gradients, shape_function_data, gradients); } @@ -1443,7 +1445,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_symmetric_gradients - (dof_values, fe_values->finite_element_output.shape_gradients, shape_function_data, + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_gradients, shape_function_data, symmetric_gradients); } @@ -1468,7 +1470,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_divergences - (dof_values, fe_values->finite_element_output.shape_gradients, shape_function_data, divergences); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_gradients, shape_function_data, divergences); } template @@ -1489,7 +1491,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values (fe_function, dof_values); internal::do_function_curls - (dof_values, fe_values->finite_element_output.shape_gradients, shape_function_data, curls); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_gradients, shape_function_data, curls); } @@ -1511,7 +1513,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_derivatives<2,dim,spacedim> - (dof_values, fe_values->finite_element_output.shape_hessians, shape_function_data, hessians); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_hessians, shape_function_data, hessians); } @@ -1537,7 +1539,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_laplacians - (dof_values, fe_values->finite_element_output.shape_hessians, shape_function_data, laplacians); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_hessians, shape_function_data, laplacians); } @@ -1559,7 +1561,7 @@ namespace FEValuesViews dealii::Vector dof_values (fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_derivatives<3,dim,spacedim> - (dof_values, fe_values->finite_element_output.shape_3rd_derivatives, shape_function_data, third_derivatives); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_3rd_derivatives, shape_function_data, third_derivatives); } @@ -1582,7 +1584,7 @@ namespace FEValuesViews dealii::Vector dof_values(fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_values - (dof_values, fe_values->finite_element_output.shape_values, shape_function_data, values); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_values, shape_function_data, values); } @@ -1606,7 +1608,7 @@ namespace FEValuesViews dealii::Vector dof_values(fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_divergences - (dof_values, fe_values->finite_element_output.shape_gradients, shape_function_data, divergences); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_gradients, shape_function_data, divergences); } template @@ -1627,7 +1629,7 @@ namespace FEValuesViews dealii::Vector dof_values(fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_values - (dof_values, fe_values->finite_element_output.shape_values, shape_function_data, values); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_values, shape_function_data, values); } @@ -1651,7 +1653,7 @@ namespace FEValuesViews dealii::Vector dof_values(fe_values->dofs_per_cell); fe_values->present_cell->get_interpolated_dof_values(fe_function, dof_values); internal::do_function_divergences - (dof_values, fe_values->finite_element_output.shape_gradients, shape_function_data, divergences); + (ArrayView(&dof_values[0], fe_values->dofs_per_cell), fe_values->finite_element_output.shape_gradients, shape_function_data, divergences); } } -- 2.39.5