From 64bbc8cd075d29e3832b67b54673dfe6881b39e2 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 22 Dec 2015 23:38:59 -0600 Subject: [PATCH] Also replace std::vector> by Table<2,T> in FE_PolyTensor::InternalData. --- include/deal.II/fe/fe_poly_tensor.h | 26 +++++++---------- source/fe/fe_poly_tensor.cc | 44 ++++++++++++++--------------- 2 files changed, 32 insertions(+), 38 deletions(-) diff --git a/include/deal.II/fe/fe_poly_tensor.h b/include/deal.II/fe/fe_poly_tensor.h index 3fd0a77695..24495748c2 100644 --- a/include/deal.II/fe/fe_poly_tensor.h +++ b/include/deal.II/fe/fe_poly_tensor.h @@ -230,9 +230,7 @@ protected: if (update_flags & update_values) { values.resize (this->dofs_per_cell); - data->shape_values.resize (this->dofs_per_cell); - for (unsigned int i=0; idofs_per_cell; ++i) - data->shape_values[i].resize (n_q_points); + data->shape_values.reinit (this->dofs_per_cell, n_q_points); if (mapping_type != mapping_none) data->transformed_shape_values.resize (n_q_points); } @@ -240,9 +238,7 @@ protected: if (update_flags & update_gradients) { grads.resize (this->dofs_per_cell); - data->shape_grads.resize (this->dofs_per_cell); - for (unsigned int i=0; idofs_per_cell; ++i) - data->shape_grads[i].resize (n_q_points); + data->shape_grads.reinit (this->dofs_per_cell, n_q_points); data->transformed_shape_grads.resize (n_q_points); if ( (mapping_type == mapping_raviart_thomas) @@ -258,9 +254,7 @@ protected: if (update_flags & update_hessians) { grad_grads.resize (this->dofs_per_cell); - data->shape_grad_grads.resize (this->dofs_per_cell); - for (unsigned int i=0; idofs_per_cell; ++i) - data->shape_grad_grads[i].resize (n_q_points); + data->shape_grad_grads.reinit (this->dofs_per_cell, n_q_points); data->transformed_shape_hessians.resize (n_q_points); if ( mapping_type != mapping_none ) data->untransformed_shape_hessian_tensors.resize(n_q_points); @@ -380,33 +374,33 @@ protected: * Array with shape function values in quadrature points. There is one row * for each shape function, containing values for each quadrature point. */ - std::vector > > shape_values; + Table<2,Tensor<1,dim> > shape_values; /** * Array with shape function gradients in quadrature points. There is one * row for each shape function, containing values for each quadrature * point. */ - std::vector< std::vector< DerivativeForm<1, dim, spacedim> > > shape_grads; + Table<2,DerivativeForm<1, dim, spacedim> > shape_grads; /** * Array with shape function hessians in quadrature points. There is one * row for each shape function, containing values for each quadrature * point. */ - std::vector< std::vector< DerivativeForm<2, dim, spacedim> > > shape_grad_grads; + Table<2,DerivativeForm<2, dim, spacedim> > shape_grad_grads; /** * Scratch arrays for intermediate computations */ - mutable std::vector sign_change; - mutable std::vector > transformed_shape_values; + mutable std::vector sign_change; + mutable std::vector > transformed_shape_values; // for shape_gradient computations mutable std::vector > transformed_shape_grads; - mutable std::vector > untransformed_shape_grads; + mutable std::vector > untransformed_shape_grads; // for shape_hessian computations mutable std::vector > transformed_shape_hessians; - mutable std::vector > untransformed_shape_hessian_tensors; + mutable std::vector > untransformed_shape_hessian_tensors; }; diff --git a/source/fe/fe_poly_tensor.cc b/source/fe/fe_poly_tensor.cc index 66b0af514d..4f9c3635c9 100644 --- a/source/fe/fe_poly_tensor.cc +++ b/source/fe/fe_poly_tensor.cc @@ -316,10 +316,10 @@ fill_fe_values const unsigned int n_q_points = quadrature.size(); - Assert(!(fe_data.update_each & update_values) || fe_data.shape_values.size() == this->dofs_per_cell, - ExcDimensionMismatch(fe_data.shape_values.size(), this->dofs_per_cell)); - Assert(!(fe_data.update_each & update_values) || fe_data.shape_values[0].size() == n_q_points, - ExcDimensionMismatch(fe_data.shape_values[0].size(), n_q_points)); + Assert(!(fe_data.update_each & update_values) || fe_data.shape_values.size()[0] == this->dofs_per_cell, + ExcDimensionMismatch(fe_data.shape_values.size()[0], this->dofs_per_cell)); + Assert(!(fe_data.update_each & update_values) || fe_data.shape_values.size()[1] == n_q_points, + ExcDimensionMismatch(fe_data.shape_values.size()[1], n_q_points)); // Create table with sign changes, due to the special structure of the RT elements. // TODO: Preliminary hack to demonstrate the overall prinicple! @@ -364,7 +364,7 @@ fill_fe_values case mapping_covariant: case mapping_contravariant: { - mapping.transform (make_array_view(fe_data.shape_values[i]), + mapping.transform (make_array_view(fe_data.shape_values, i), mapping_type, mapping_internal, make_array_view(fe_data.transformed_shape_values)); @@ -379,7 +379,7 @@ fill_fe_values case mapping_raviart_thomas: case mapping_piola: { - mapping.transform (make_array_view(fe_data.shape_values[i]), + mapping.transform (make_array_view(fe_data.shape_values, i), mapping_piola, mapping_internal, make_array_view(fe_data.transformed_shape_values)); @@ -392,7 +392,7 @@ fill_fe_values case mapping_nedelec: { - mapping.transform (make_array_view(fe_data.shape_values[i]), + mapping.transform (make_array_view(fe_data.shape_values, i), mapping_covariant, mapping_internal, make_array_view(fe_data.transformed_shape_values)); @@ -423,7 +423,7 @@ fill_fe_values { case mapping_none: { - mapping.transform (make_array_view(fe_data.shape_grads[i]), + mapping.transform (make_array_view(fe_data.shape_grads, i), mapping_covariant, mapping_internal, make_array_view(fe_data.transformed_shape_grads)); @@ -434,7 +434,7 @@ fill_fe_values } case mapping_covariant: { - mapping.transform (make_array_view(fe_data.shape_grads[i]), + mapping.transform (make_array_view(fe_data.shape_grads, i), mapping_covariant_gradient, mapping_internal, make_array_view(fe_data.transformed_shape_grads)); @@ -553,7 +553,7 @@ fill_fe_values case mapping_none: { - mapping.transform(make_array_view(fe_data.shape_grad_grads[i]), + mapping.transform(make_array_view(fe_data.shape_grad_grads, i), mapping_covariant_gradient, mapping_internal, make_array_view(fe_data.transformed_shape_hessians)); @@ -837,7 +837,7 @@ fill_fe_face_values { const ArrayView > transformed_shape_values = make_array_view(fe_data.transformed_shape_values, offset, n_q_points); - mapping.transform (make_array_view(fe_data.shape_values[i], offset, n_q_points), + mapping.transform (make_array_view(fe_data.shape_values, i, offset, n_q_points), mapping_type, mapping_internal, transformed_shape_values); @@ -853,7 +853,7 @@ fill_fe_face_values { const ArrayView > transformed_shape_values = make_array_view(fe_data.transformed_shape_values, offset, n_q_points); - mapping.transform (make_array_view(fe_data.shape_values[i], offset, n_q_points), + mapping.transform (make_array_view(fe_data.shape_values, i, offset, n_q_points), mapping_piola, mapping_internal, transformed_shape_values); @@ -868,7 +868,7 @@ fill_fe_face_values { const ArrayView > transformed_shape_values = make_array_view(fe_data.transformed_shape_values, offset, n_q_points); - mapping.transform (make_array_view (fe_data.shape_values[i], offset, n_q_points), + mapping.transform (make_array_view (fe_data.shape_values, i, offset, n_q_points), mapping_covariant, mapping_internal, transformed_shape_values); @@ -894,7 +894,7 @@ fill_fe_face_values { const ArrayView > transformed_shape_grads = make_array_view(fe_data.transformed_shape_grads, offset, n_q_points); - mapping.transform (make_array_view(fe_data.shape_grads[i], offset, n_q_points), + mapping.transform (make_array_view(fe_data.shape_grads, i, offset, n_q_points), mapping_covariant, mapping_internal, transformed_shape_grads); @@ -908,7 +908,7 @@ fill_fe_face_values { const ArrayView > transformed_shape_grads = make_array_view(fe_data.transformed_shape_grads, offset, n_q_points); - mapping.transform (make_array_view(fe_data.shape_grads[i], offset, n_q_points), + mapping.transform (make_array_view(fe_data.shape_grads, i, offset, n_q_points), mapping_covariant_gradient, mapping_internal, transformed_shape_grads); @@ -1027,7 +1027,7 @@ fill_fe_face_values { const ArrayView > transformed_shape_hessians = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points); - mapping.transform(make_array_view (fe_data.shape_grad_grads[i], offset, n_q_points), + mapping.transform(make_array_view (fe_data.shape_grad_grads, i, offset, n_q_points), mapping_covariant_gradient, mapping_internal, transformed_shape_hessians); @@ -1316,7 +1316,7 @@ fill_fe_subface_values { const ArrayView > transformed_shape_values = make_array_view(fe_data.transformed_shape_values, offset, n_q_points); - mapping.transform (make_array_view(fe_data.shape_values[i], offset, n_q_points), + mapping.transform (make_array_view(fe_data.shape_values, i, offset, n_q_points), mapping_type, mapping_internal, transformed_shape_values); @@ -1334,7 +1334,7 @@ fill_fe_subface_values const ArrayView > transformed_shape_values = make_array_view(fe_data.transformed_shape_values, offset, n_q_points); - mapping.transform(make_array_view(fe_data.shape_values[i], offset, n_q_points), + mapping.transform(make_array_view(fe_data.shape_values, i, offset, n_q_points), mapping_piola, mapping_internal, transformed_shape_values); @@ -1350,7 +1350,7 @@ fill_fe_subface_values const ArrayView > transformed_shape_values = make_array_view(fe_data.transformed_shape_values, offset, n_q_points); - mapping.transform (make_array_view (fe_data.shape_values[i], offset, n_q_points), + mapping.transform (make_array_view (fe_data.shape_values, i, offset, n_q_points), mapping_covariant, mapping_internal, transformed_shape_values); @@ -1376,7 +1376,7 @@ fill_fe_subface_values { case mapping_none: { - mapping.transform (make_array_view(fe_data.shape_grads[i], offset, n_q_points), + mapping.transform (make_array_view(fe_data.shape_grads, i, offset, n_q_points), mapping_covariant, mapping_internal, transformed_shape_grads); @@ -1388,7 +1388,7 @@ fill_fe_subface_values case mapping_covariant: { - mapping.transform (make_array_view(fe_data.shape_grads[i], offset, n_q_points), + mapping.transform (make_array_view(fe_data.shape_grads, i, offset, n_q_points), mapping_covariant_gradient, mapping_internal, transformed_shape_grads); @@ -1502,7 +1502,7 @@ fill_fe_subface_values { const ArrayView > transformed_shape_hessians = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points); - mapping.transform(make_array_view (fe_data.shape_grad_grads[i], offset, n_q_points), + mapping.transform(make_array_view (fe_data.shape_grad_grads, i, offset, n_q_points), mapping_covariant_gradient, mapping_internal, transformed_shape_hessians); -- 2.39.5