From 089acc97800415197c494a885ffabc4ad3f5ccf7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 22 Dec 2015 09:36:40 -0600 Subject: [PATCH] Convert the VectorSlice argument of Mapping::transform to ArrayView. This will allow to change the underlying data type in which the data is stored because ArrayView does not actually store this, in contrast to VectorSlice. This patch is backward incompatible. However, this area has already been incompatibly changed in recent months. --- include/deal.II/base/vector_slice.h | 39 +++- include/deal.II/fe/fe_poly.templates.h | 51 +++-- include/deal.II/fe/mapping.h | 45 ++--- include/deal.II/fe/mapping_cartesian.h | 28 +-- include/deal.II/fe/mapping_fe_field.h | 28 +-- include/deal.II/fe/mapping_q.h | 34 ++-- include/deal.II/fe/mapping_q_generic.h | 28 +-- source/fe/fe_poly.cc | 48 ++--- source/fe/fe_poly_tensor.cc | 253 ++++++++++++++----------- source/fe/fe_values.cc | 15 +- source/fe/mapping_cartesian.cc | 28 +-- source/fe/mapping_fe_field.cc | 47 +++-- source/fe/mapping_q.cc | 35 ++-- source/fe/mapping_q_generic.cc | 56 +++--- 14 files changed, 401 insertions(+), 334 deletions(-) diff --git a/include/deal.II/base/vector_slice.h b/include/deal.II/base/vector_slice.h index 67f5bfd8fd..c6f034768a 100644 --- a/include/deal.II/base/vector_slice.h +++ b/include/deal.II/base/vector_slice.h @@ -18,6 +18,7 @@ #include #include +#include DEAL_II_NAMESPACE_OPEN @@ -63,6 +64,20 @@ public: unsigned int start, unsigned int length); + /** + * Conversion operator to an ArrayView object that represents + * an array of non-const elements pointing to the same location + * as the current object. + */ + operator ArrayView (); + + /** + * Conversion operator to an ArrayView object that represents + * an array of const elements pointing to the same location + * as the current object. + */ + operator ArrayView () const; + /** * Return the length of the slice using the same interface as * std::vector. @@ -70,14 +85,14 @@ public: unsigned int size() const; /** - * Access an element of the slice using the same interface as - * std::vector. + * Return a reference to the $i$th element of the range + * represented by the current object. */ typename VectorType::reference operator[] (unsigned int i); /** - * Access an element of a constant slice using the same interface as - * std::vector. + * Return a @p const reference to the $i$th element of the range + * represented by the current object. */ typename VectorType::const_reference operator[] (unsigned int i) const; @@ -188,6 +203,22 @@ VectorSlice::size() const } +template +VectorSlice:: +operator ArrayView () +{ + return ArrayView (&v[start], length); +} + + +template +VectorSlice:: +operator ArrayView () const +{ + return ArrayView (&v[start], length); +} + + template inline typename VectorType::reference diff --git a/include/deal.II/fe/fe_poly.templates.h b/include/deal.II/fe/fe_poly.templates.h index bc2bf1d9d6..945bf378f5 100644 --- a/include/deal.II/fe/fe_poly.templates.h +++ b/include/deal.II/fe/fe_poly.templates.h @@ -259,18 +259,18 @@ fill_fe_values (const typename Triangulation::cell_iterator &, // we were in get_data() if (flags & update_gradients && cell_similarity != CellSimilarity::translation) for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_gradients[k], + mapping.transform (make_array_view(fe_data.shape_gradients[k]), mapping_covariant, mapping_internal, - output_data.shape_gradients[k]); + make_array_view(output_data.shape_gradients[k])); if (flags & update_hessians && cell_similarity != CellSimilarity::translation) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_hessians[k], + mapping.transform (make_array_view(fe_data.shape_hessians[k]), mapping_covariant_gradient, mapping_internal, - output_data.shape_hessians[k]); + make_array_view(output_data.shape_hessians[k])); for (unsigned int k=0; kdofs_per_cell; ++k) for (unsigned int i=0; i::cell_iterator &, if (flags & update_3rd_derivatives && cell_similarity != CellSimilarity::translation) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_3rd_derivatives[k], + mapping.transform (make_array_view(fe_data.shape_3rd_derivatives[k]), mapping_covariant_hessian, mapping_internal, - output_data.shape_3rd_derivatives[k]); + make_array_view(output_data.shape_3rd_derivatives[k])); for (unsigned int k=0; kdofs_per_cell; ++k) correct_third_derivatives(output_data, mapping_data, quadrature.size(), k); @@ -337,20 +337,19 @@ fill_fe_face_values (const typename Triangulation::cell_iterator if (flags & update_gradients) for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (make_slice(fe_data.shape_gradients[k], offset, quadrature.size()), + mapping.transform (ArrayView >(&fe_data.shape_gradients[k][offset], quadrature.size()), mapping_covariant, mapping_internal, - output_data.shape_gradients[k]); + make_array_view(output_data.shape_gradients[k])); if (flags & update_hessians) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (make_slice(fe_data.shape_hessians[k], - offset, - quadrature.size()), + mapping.transform (ArrayView >(&fe_data.shape_hessians[k][offset], + quadrature.size()), mapping_covariant_gradient, mapping_internal, - output_data.shape_hessians[k]); + make_array_view(output_data.shape_hessians[k])); for (unsigned int k=0; kdofs_per_cell; ++k) for (unsigned int i=0; i::cell_iterator if (flags & update_3rd_derivatives) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (make_slice(fe_data.shape_3rd_derivatives[k], - offset, - quadrature.size()), + mapping.transform (ArrayView >(&fe_data.shape_3rd_derivatives[k][offset], + quadrature.size()), mapping_covariant_hessian, mapping_internal, - output_data.shape_3rd_derivatives[k]); + make_array_view(output_data.shape_3rd_derivatives[k])); for (unsigned int k=0; kdofs_per_cell; ++k) correct_third_derivatives(output_data, mapping_data, quadrature.size(), k); } } + + template void FE_Poly:: @@ -419,20 +419,20 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato if (flags & update_gradients) for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (make_slice(fe_data.shape_gradients[k], offset, quadrature.size()), + mapping.transform (ArrayView >(&fe_data.shape_gradients[k][offset], + quadrature.size()), mapping_covariant, mapping_internal, - output_data.shape_gradients[k]); + make_array_view(output_data.shape_gradients[k])); if (flags & update_hessians) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (make_slice(fe_data.shape_hessians[k], - offset, - quadrature.size()), + mapping.transform (ArrayView >(&fe_data.shape_hessians[k][offset], + quadrature.size()), mapping_covariant_gradient, mapping_internal, - output_data.shape_hessians[k]); + make_array_view(output_data.shape_hessians[k])); for (unsigned int k=0; kdofs_per_cell; ++k) for (unsigned int i=0; i::cell_iterato if (flags & update_3rd_derivatives) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (make_slice(fe_data.shape_3rd_derivatives[k], - offset, - quadrature.size()), + mapping.transform (ArrayView >(&fe_data.shape_3rd_derivatives[k][offset], + quadrature.size()), mapping_covariant_hessian, mapping_internal, - output_data.shape_3rd_derivatives[k]); + make_array_view(output_data.shape_3rd_derivatives[k])); for (unsigned int k=0; kdofs_per_cell; ++k) correct_third_derivatives(output_data, mapping_data, quadrature.size(), k); diff --git a/include/deal.II/fe/mapping.h b/include/deal.II/fe/mapping.h index b4eee8462e..c539743346 100644 --- a/include/deal.II/fe/mapping.h +++ b/include/deal.II/fe/mapping.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include @@ -962,16 +962,15 @@ public: * this object also represents with respect to which cell the transformation * should be applied to. * @param[out] output An array (or part of an array) into which the transformed - * objects should be placed. + * objects should be placed. (Note that the array view is @p const, but the + * tensors it points to are not.) */ virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const = 0; - - + const ArrayView > &output) const = 0; /** * Transform a field of differential forms from the reference cell to the @@ -1015,15 +1014,15 @@ public: * this object also represents with respect to which cell the transformation * should be applied to. * @param[out] output An array (or part of an array) into which the transformed - * objects should be placed. + * objects should be placed. (Note that the array view is @p const, but the + * tensors it points to are not.) */ virtual void - transform (const VectorSlice > > input, - const MappingType type, - const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const = 0; - + transform (const ArrayView > &input, + const MappingType type, + const typename Mapping::InternalDataBase &internal, + const ArrayView > &output) const = 0; /** * Transform a tensor field from the reference cell to the physical cell. @@ -1074,14 +1073,15 @@ public: * this object also represents with respect to which cell the transformation * should be applied to. * @param[out] output An array (or part of an array) into which the transformed - * objects should be placed. + * objects should be placed. (Note that the array view is @p const, but the + * tensors it points to are not.) */ virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const = 0; + const ArrayView > &output) const = 0; /** * Transform a tensor field from the reference cell to the physical cell. @@ -1118,14 +1118,15 @@ public: * this object also represents with respect to which cell the transformation * should be applied to. * @param[out] output An array (or part of an array) into which the transformed - * objects should be placed. + * objects should be placed. (Note that the array view is @p const, but the + * tensors it points to are not.) */ virtual void - transform (const VectorSlice > > input, - const MappingType type, - const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const = 0; + transform (const ArrayView > &input, + const MappingType type, + const typename Mapping::InternalDataBase &internal, + const ArrayView > &output) const = 0; /** * Transform a field of 3-differential forms from the reference cell to the @@ -1176,10 +1177,10 @@ public: */ virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const = 0; + const ArrayView > &output) const = 0; /** * @} diff --git a/include/deal.II/fe/mapping_cartesian.h b/include/deal.II/fe/mapping_cartesian.h index fba4ce74bd..9d8a1ac7b4 100644 --- a/include/deal.II/fe/mapping_cartesian.h +++ b/include/deal.II/fe/mapping_cartesian.h @@ -94,42 +94,42 @@ public: // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, - const MappingType type, - const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + transform (const ArrayView > &input, + const MappingType type, + const typename Mapping::InternalDataBase &internal, + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, - const MappingType type, - const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + transform (const ArrayView > &input, + const MappingType type, + const typename Mapping::InternalDataBase &internal, + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; /** * @} diff --git a/include/deal.II/fe/mapping_fe_field.h b/include/deal.II/fe/mapping_fe_field.h index 6703832b78..24d7979cd5 100644 --- a/include/deal.II/fe/mapping_fe_field.h +++ b/include/deal.II/fe/mapping_fe_field.h @@ -160,42 +160,42 @@ public: // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, - const MappingType type, - const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + transform (const ArrayView > &input, + const MappingType type, + const typename Mapping::InternalDataBase &internal, + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, - const MappingType type, - const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + transform (const ArrayView > &input, + const MappingType type, + const typename Mapping::InternalDataBase &internal, + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; /** * @} diff --git a/include/deal.II/fe/mapping_q.h b/include/deal.II/fe/mapping_q.h index d0fec52125..1faaf01efa 100644 --- a/include/deal.II/fe/mapping_q.h +++ b/include/deal.II/fe/mapping_q.h @@ -153,45 +153,45 @@ public: transform_real_to_unit_cell (const typename Triangulation::cell_iterator &cell, const Point &p) const; - // for documentation, see the base classes + // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; - // for documentation, see the base classes + // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, - const MappingType type, - const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + transform (const ArrayView > &input, + const MappingType type, + const typename Mapping::InternalDataBase &internal, + const ArrayView > &output) const; - // for documentation, see the base classes + // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, - const MappingType type, - const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + transform (const ArrayView > &input, + const MappingType type, + const typename Mapping::InternalDataBase &internal, + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; /** * Return a pointer to a copy of the present object. The caller of this copy diff --git a/include/deal.II/fe/mapping_q_generic.h b/include/deal.II/fe/mapping_q_generic.h index bc46b3a488..bcfc2b0713 100644 --- a/include/deal.II/fe/mapping_q_generic.h +++ b/include/deal.II/fe/mapping_q_generic.h @@ -152,42 +152,42 @@ public: // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, - const MappingType type, - const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + transform (const ArrayView > &input, + const MappingType type, + const typename Mapping::InternalDataBase &internal, + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, - const MappingType type, - const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + transform (const ArrayView > &input, + const MappingType type, + const typename Mapping::InternalDataBase &internal, + const ArrayView > &output) const; // for documentation, see the Mapping base class virtual void - transform (const VectorSlice > > input, + transform (const ArrayView > &input, const MappingType type, const typename Mapping::InternalDataBase &internal, - VectorSlice > > output) const; + const ArrayView > &output) const; /** * @} diff --git a/source/fe/fe_poly.cc b/source/fe/fe_poly.cc index 8af7c2b330..c3c4c091a0 100644 --- a/source/fe/fe_poly.cc +++ b/source/fe/fe_poly.cc @@ -52,18 +52,18 @@ fill_fe_values (const Triangulation<1,2>::cell_iterator &, // we were in get_data() if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_gradients[k], + mapping.transform (make_array_view(fe_data.shape_gradients[k]), mapping_covariant, mapping_internal, - output_data.shape_gradients[k]); + make_array_view(output_data.shape_gradients[k])); if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_hessians[k], + mapping.transform (make_array_view(fe_data.shape_hessians[k]), mapping_covariant_gradient, mapping_internal, - output_data.shape_hessians[k]); + make_array_view(output_data.shape_hessians[k])); for (unsigned int k=0; kdofs_per_cell; ++k) for (unsigned int i=0; i::cell_iterator &, if (fe_data.update_each & update_3rd_derivatives && cell_similarity != CellSimilarity::translation) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_3rd_derivatives[k], + mapping.transform (make_array_view(fe_data.shape_3rd_derivatives[k]), mapping_covariant_hessian, mapping_internal, - output_data.shape_3rd_derivatives[k]); + make_array_view(output_data.shape_3rd_derivatives[k])); for (unsigned int k=0; kdofs_per_cell; ++k) correct_third_derivatives(output_data, mapping_data, quadrature.size(), k); @@ -111,18 +111,18 @@ fill_fe_values (const Triangulation<2,3>::cell_iterator &, // we were in get_data() if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_gradients[k], + mapping.transform (make_array_view(fe_data.shape_gradients[k]), mapping_covariant, mapping_internal, - output_data.shape_gradients[k]); + make_array_view(output_data.shape_gradients[k])); if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_hessians[k], + mapping.transform (make_array_view(fe_data.shape_hessians[k]), mapping_covariant_gradient, mapping_internal, - output_data.shape_hessians[k]); + make_array_view(output_data.shape_hessians[k])); for (unsigned int k=0; kdofs_per_cell; ++k) for (unsigned int i=0; i::cell_iterator &, if (fe_data.update_each & update_3rd_derivatives && cell_similarity != CellSimilarity::translation) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_3rd_derivatives[k], + mapping.transform (make_array_view(fe_data.shape_3rd_derivatives[k]), mapping_covariant_hessian, mapping_internal, - output_data.shape_3rd_derivatives[k]); + make_array_view(output_data.shape_3rd_derivatives[k])); for (unsigned int k=0; kdofs_per_cell; ++k) correct_third_derivatives(output_data, mapping_data, quadrature.size(), k); @@ -171,18 +171,18 @@ fill_fe_values (const Triangulation<1,2>::cell_iterator &, // we were in get_data() if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_gradients[k], + mapping.transform (make_array_view(fe_data.shape_gradients[k]), mapping_covariant, mapping_internal, - output_data.shape_gradients[k]); + make_array_view(output_data.shape_gradients[k])); if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_hessians[k], + mapping.transform (make_array_view(fe_data.shape_hessians[k]), mapping_covariant_gradient, mapping_internal, - output_data.shape_hessians[k]); + make_array_view(output_data.shape_hessians[k])); for (unsigned int k=0; kdofs_per_cell; ++k) for (unsigned int i=0; i::cell_iterator &, if (fe_data.update_each & update_3rd_derivatives && cell_similarity != CellSimilarity::translation) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_3rd_derivatives[k], + mapping.transform (make_array_view(fe_data.shape_3rd_derivatives[k]), mapping_covariant_hessian, mapping_internal, - output_data.shape_3rd_derivatives[k]); + make_array_view(output_data.shape_3rd_derivatives[k])); for (unsigned int k=0; kdofs_per_cell; ++k) correct_third_derivatives(output_data, mapping_data, quadrature.size(), k); @@ -226,18 +226,18 @@ fill_fe_values (const Triangulation<2,3>::cell_iterator &, // we were in get_data() if (fe_data.update_each & update_gradients && cell_similarity != CellSimilarity::translation) for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_gradients[k], + mapping.transform (make_array_view(fe_data.shape_gradients[k]), mapping_covariant, mapping_internal, - output_data.shape_gradients[k]); + make_array_view(output_data.shape_gradients[k])); if (fe_data.update_each & update_hessians && cell_similarity != CellSimilarity::translation) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_hessians[k], + mapping.transform (make_array_view(fe_data.shape_hessians[k]), mapping_covariant_gradient, mapping_internal, - output_data.shape_hessians[k]); + make_array_view(output_data.shape_hessians[k])); for (unsigned int k=0; kdofs_per_cell; ++k) for (unsigned int i=0; i::cell_iterator &, if (fe_data.update_each & update_3rd_derivatives && cell_similarity != CellSimilarity::translation) { for (unsigned int k=0; kdofs_per_cell; ++k) - mapping.transform (fe_data.shape_3rd_derivatives[k], + mapping.transform (make_array_view(fe_data.shape_3rd_derivatives[k]), mapping_covariant_hessian, mapping_internal, - output_data.shape_3rd_derivatives[k]); + make_array_view(output_data.shape_3rd_derivatives[k])); for (unsigned int k=0; kdofs_per_cell; ++k) correct_third_derivatives(output_data, mapping_data, quadrature.size(), k); diff --git a/source/fe/fe_poly_tensor.cc b/source/fe/fe_poly_tensor.cc index 9aaad2904e..66b0af514d 100644 --- a/source/fe/fe_poly_tensor.cc +++ b/source/fe/fe_poly_tensor.cc @@ -364,10 +364,10 @@ fill_fe_values case mapping_covariant: case mapping_contravariant: { - mapping.transform (fe_data.shape_values[i], + mapping.transform (make_array_view(fe_data.shape_values[i]), mapping_type, mapping_internal, - fe_data.transformed_shape_values); + make_array_view(fe_data.transformed_shape_values)); for (unsigned int k=0; k > > - transformed_shape_values(fe_data.transformed_shape_values, offset, n_q_points); - // Use auxiliary vector - // for transformation - mapping.transform (make_slice(fe_data.shape_values[i], offset, n_q_points), + 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_type, mapping_internal, transformed_shape_values); @@ -849,10 +851,9 @@ fill_fe_face_values case mapping_raviart_thomas: case mapping_piola: { - VectorSlice< std::vector > > - transformed_shape_values(fe_data.transformed_shape_values, offset, n_q_points); - - mapping.transform (make_slice(fe_data.shape_values[i], offset, n_q_points), + 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_piola, mapping_internal, transformed_shape_values); @@ -865,10 +866,9 @@ fill_fe_face_values case mapping_nedelec: { - VectorSlice< std::vector > > - transformed_shape_values(fe_data.transformed_shape_values, offset, n_q_points); - - mapping.transform (make_slice (fe_data.shape_values[i], offset, n_q_points), + 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_covariant, mapping_internal, transformed_shape_values); @@ -888,14 +888,13 @@ fill_fe_face_values if (fe_data.update_each & update_gradients) { - VectorSlice< std::vector > > - transformed_shape_grads (fe_data.transformed_shape_grads, offset, n_q_points); - switch (mapping_type) { case mapping_none: { - mapping.transform (make_slice(fe_data.shape_grads[i], offset, n_q_points), + 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_covariant, mapping_internal, transformed_shape_grads); @@ -907,7 +906,9 @@ fill_fe_face_values case mapping_covariant: { - mapping.transform (make_slice(fe_data.shape_grads[i], offset, n_q_points), + 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_covariant_gradient, mapping_internal, transformed_shape_grads); @@ -923,11 +924,14 @@ fill_fe_face_values output_data.shape_gradients[first+d][k] = transformed_shape_grads[k][d]; break; } + case mapping_contravariant: { + const ArrayView > transformed_shape_grads + = make_array_view(fe_data.transformed_shape_grads, offset, n_q_points); for (unsigned int k=0; k > transformed_shape_grads + = make_array_view(fe_data.transformed_shape_grads, offset, n_q_points); for (unsigned int k=0; k > transformed_shape_grads + = make_array_view(fe_data.transformed_shape_grads, offset, n_q_points); + mapping.transform (make_array_view (fe_data.untransformed_shape_grads, offset, n_q_points), mapping_covariant_gradient, mapping_internal, transformed_shape_grads); @@ -1011,19 +1020,17 @@ fill_fe_face_values } if (fe_data.update_each & update_hessians) - { - - VectorSlice< std::vector > > transformed_shape_hessians (fe_data.transformed_shape_hessians, offset, n_q_points); - switch (mapping_type) { case mapping_none: { - - mapping.transform(make_slice (fe_data.shape_grad_grads[i], offset, n_q_points), - mapping_covariant_gradient, mapping_internal, transformed_shape_hessians - ); + 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_covariant_gradient, + mapping_internal, + transformed_shape_hessians); for (unsigned int k=0; k > transformed_shape_hessians + = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points); + mapping.transform(make_array_view (fe_data.untransformed_shape_hessian_tensors, offset, n_q_points), + mapping_covariant_hessian, + mapping_internal, + transformed_shape_hessians); for (unsigned int k=0; k > transformed_shape_hessians + = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points); + mapping.transform(make_array_view (fe_data.untransformed_shape_hessian_tensors, offset, n_q_points), + mapping_contravariant_hessian, + mapping_internal, + transformed_shape_hessians); for (unsigned int k=0; k > transformed_shape_hessians + = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points); + mapping.transform(make_array_view (fe_data.untransformed_shape_hessian_tensors, offset, n_q_points), + mapping_piola_hessian, + mapping_internal, + transformed_shape_hessians); for (unsigned int k=0; k > transformed_shape_hessians + = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points); + mapping.transform(make_array_view (fe_data.untransformed_shape_hessian_tensors, offset, n_q_points), + mapping_covariant_hessian, + mapping_internal, + transformed_shape_hessians); for (unsigned int k=0; k > > - transformed_shape_values (fe_data.transformed_shape_values, offset, n_q_points); - - // Use auxiliary vector for - // transformation - mapping.transform (make_slice(fe_data.shape_values[i], offset, n_q_points), + 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_type, mapping_internal, transformed_shape_values); @@ -1312,26 +1327,30 @@ fill_fe_subface_values break; } + case mapping_raviart_thomas: case mapping_piola: { - VectorSlice< std::vector > > - transformed_shape_values (fe_data.transformed_shape_values, offset, n_q_points); + const ArrayView > transformed_shape_values + = make_array_view(fe_data.transformed_shape_values, offset, n_q_points); - mapping.transform(make_slice(fe_data.shape_values[i], offset, n_q_points), - mapping_piola, mapping_internal, transformed_shape_values); + mapping.transform(make_array_view(fe_data.shape_values[i], offset, n_q_points), + mapping_piola, + mapping_internal, + transformed_shape_values); for (unsigned int k=0; k > > - transformed_shape_values (fe_data.transformed_shape_values, offset, n_q_points); + const ArrayView > transformed_shape_values + = make_array_view(fe_data.transformed_shape_values, offset, n_q_points); - mapping.transform (make_slice (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); @@ -1343,6 +1362,7 @@ fill_fe_subface_values break; } + default: Assert(false, ExcNotImplemented()); } @@ -1350,13 +1370,13 @@ fill_fe_subface_values if (fe_data.update_each & update_gradients) { - VectorSlice< std::vector > > - transformed_shape_grads (fe_data.transformed_shape_grads, offset, n_q_points); + const ArrayView > transformed_shape_grads + = make_array_view(fe_data.transformed_shape_grads, offset, n_q_points); switch (mapping_type) { case mapping_none: { - mapping.transform (make_slice(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); @@ -1368,7 +1388,7 @@ fill_fe_subface_values case mapping_covariant: { - mapping.transform (make_slice(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); @@ -1391,7 +1411,7 @@ fill_fe_subface_values for (unsigned int k=0; k > > transformed_shape_hessians (fe_data.transformed_shape_hessians, offset, n_q_points); - switch (mapping_type) { case mapping_none: { - - mapping.transform(make_slice (fe_data.shape_grad_grads[i], offset, n_q_points), + 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_covariant_gradient, mapping_internal, - transformed_shape_hessians ); + transformed_shape_hessians); for (unsigned int k=0; k > transformed_shape_hessians + = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points); + mapping.transform(make_array_view (fe_data.untransformed_shape_hessian_tensors, offset, n_q_points), + mapping_covariant_hessian, + mapping_internal, + transformed_shape_hessians); for (unsigned int k=0; k > transformed_shape_hessians + = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points); + mapping.transform(make_array_view (fe_data.untransformed_shape_hessian_tensors, offset, n_q_points), + mapping_contravariant_hessian, + mapping_internal, + transformed_shape_hessians); for (unsigned int k=0; k > transformed_shape_hessians + = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points); + mapping.transform(make_array_view (fe_data.untransformed_shape_hessian_tensors, offset, n_q_points), + mapping_piola_hessian, + mapping_internal, + transformed_shape_hessians); for (unsigned int k=0; k > transformed_shape_hessians + = make_array_view(fe_data.transformed_shape_hessians, offset, n_q_points); + mapping.transform(make_array_view(fe_data.untransformed_shape_hessian_tensors, offset, n_q_points), + mapping_covariant_hessian, + mapping_internal, + transformed_shape_hessians); for (unsigned int k=0; k::get_normal_vectors () const template void -FEValuesBase::transform ( - std::vector > &transformed, - const std::vector > &original, - MappingType type) const +FEValuesBase:: +transform (std::vector > &transformed, + const std::vector > &original, + MappingType type) const { - VectorSlice > > src(original); - VectorSlice > > dst(transformed); - mapping->transform(src, type,*mapping_data, dst); + mapping->transform(make_array_view(original), + type, + *mapping_data, + make_array_view(transformed)); } diff --git a/source/fe/mapping_cartesian.cc b/source/fe/mapping_cartesian.cc index f8f16e989b..5ffce2361e 100644 --- a/source/fe/mapping_cartesian.cc +++ b/source/fe/mapping_cartesian.cc @@ -613,10 +613,10 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato template void MappingCartesian:: -transform (const VectorSlice > > input, +transform (const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); Assert (dynamic_cast(&mapping_data) != 0, @@ -668,10 +668,10 @@ transform (const VectorSlice > > input, template void MappingCartesian:: -transform (const VectorSlice > > input, - const MappingType mapping_type, - const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const +transform (const ArrayView > &input, + const MappingType mapping_type, + const typename Mapping::InternalDataBase &mapping_data, + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); Assert (dynamic_cast(&mapping_data) != 0, @@ -769,10 +769,10 @@ transform (const VectorSlice > template void MappingCartesian:: -transform (const VectorSlice > > input, +transform (const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); @@ -870,10 +870,10 @@ transform (const VectorSlice > > input, template void MappingCartesian:: -transform (const VectorSlice > > input, - const MappingType mapping_type, - const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const +transform (const ArrayView > &input, + const MappingType mapping_type, + const typename Mapping::InternalDataBase &mapping_data, + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); @@ -908,10 +908,10 @@ transform (const VectorSlice template void MappingCartesian:: -transform (const VectorSlice > > input, +transform (const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index 80a377c08c..54b2da4d93 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -1097,10 +1097,10 @@ namespace internal data.unit_tangentials[face_no+GeometryInfo::faces_per_cell*d].size(), ExcInternalError()); - mapping.transform (data.unit_tangentials[face_no+GeometryInfo::faces_per_cell*d], + mapping.transform (make_array_view(data.unit_tangentials[face_no+GeometryInfo::faces_per_cell*d]), mapping_contravariant, data, - data.aux[d]); + make_array_view(data.aux[d])); } // if dim==spacedim, we can use the unit tangentials to compute the @@ -1515,10 +1515,10 @@ namespace { template void - transform_fields(const VectorSlice > > input, + transform_fields(const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) + const ArrayView > &output) { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), @@ -1578,10 +1578,10 @@ namespace template void transform_differential_forms - (const VectorSlice > > input, - const MappingType mapping_type, - const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) + (const ArrayView > &input, + const MappingType mapping_type, + const typename Mapping::InternalDataBase &mapping_data, + const ArrayView > &output) { AssertDimension (input.size(), output.size()); @@ -1614,10 +1614,10 @@ namespace template void MappingFEField:: -transform (const VectorSlice > > input, +transform (const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); @@ -1629,10 +1629,10 @@ transform (const VectorSlice > > input, template void MappingFEField:: -transform (const VectorSlice > > input, - const MappingType mapping_type, - const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const +transform (const ArrayView > &input, + const MappingType mapping_type, + const typename Mapping::InternalDataBase &mapping_data, + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); @@ -1644,10 +1644,10 @@ transform (const VectorSlice template void MappingFEField:: -transform (const VectorSlice > > input, - const MappingType, +transform (const ArrayView > &input, + const MappingType , const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { (void)input; (void)output; @@ -1662,12 +1662,11 @@ transform (const VectorSlice > > input, template void MappingFEField:: -transform (const VectorSlice > > input, - const MappingType mapping_type, - const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const +transform (const ArrayView > &input, + const MappingType mapping_type, + const typename Mapping::InternalDataBase &mapping_data, + const ArrayView > &output) const { - AssertDimension (input.size(), output.size()); Assert (dynamic_cast(&mapping_data) != 0, ExcInternalError()); @@ -1712,10 +1711,10 @@ transform (const VectorSlice template void MappingFEField:: -transform (const VectorSlice > > input, +transform (const ArrayView > &input, const MappingType /*mapping_type*/, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { (void)input; diff --git a/source/fe/mapping_q.cc b/source/fe/mapping_q.cc index bd50a012d2..345b83998b 100644 --- a/source/fe/mapping_q.cc +++ b/source/fe/mapping_q.cc @@ -345,13 +345,14 @@ fill_fe_subface_values (const typename Triangulation::cell_iterato } + template void MappingQ:: -transform (const VectorSlice > > input, +transform (const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *> (&mapping_data) @@ -372,10 +373,10 @@ transform (const VectorSlice > > input, template void MappingQ:: -transform (const VectorSlice > > input, - const MappingType mapping_type, - const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const +transform (const ArrayView > &input, + const MappingType mapping_type, + const typename Mapping::InternalDataBase &mapping_data, + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *> (&mapping_data) @@ -392,12 +393,14 @@ transform (const VectorSlice } + template -void MappingQ:: -transform (const VectorSlice > > input, +void +MappingQ:: +transform (const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *> (&mapping_data) @@ -418,10 +421,10 @@ transform (const VectorSlice > > input, template void MappingQ:: -transform (const VectorSlice > > input, - const MappingType mapping_type, - const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const +transform (const ArrayView > &input, + const MappingType mapping_type, + const typename Mapping::InternalDataBase &mapping_data, + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *> (&mapping_data) @@ -438,12 +441,13 @@ transform (const VectorSlice } + template void MappingQ:: -transform (const VectorSlice > > input, +transform (const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *> (&mapping_data) @@ -460,6 +464,7 @@ transform (const VectorSlice > > input, } + template Point MappingQ:: diff --git a/source/fe/mapping_q_generic.cc b/source/fe/mapping_q_generic.cc index 4696483c38..f8452f9d97 100644 --- a/source/fe/mapping_q_generic.cc +++ b/source/fe/mapping_q_generic.cc @@ -2744,10 +2744,10 @@ namespace internal data.unit_tangentials[face_no+GeometryInfo::faces_per_cell*d].size(), ExcInternalError()); - mapping.transform (data.unit_tangentials[face_no+GeometryInfo::faces_per_cell*d], + mapping.transform (make_array_view(data.unit_tangentials[face_no+GeometryInfo::faces_per_cell*d]), mapping_contravariant, data, - data.aux[d]); + make_array_view(data.aux[d])); } // if dim==spacedim, we can use the unit tangentials to compute the @@ -2998,10 +2998,10 @@ namespace { template void - transform_fields(const VectorSlice > > input, - const MappingType mapping_type, - const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) + transform_fields(const ArrayView > &input, + const MappingType mapping_type, + const typename Mapping::InternalDataBase &mapping_data, + const ArrayView > &output) { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), @@ -3061,10 +3061,10 @@ namespace template void - transform_gradients(const VectorSlice > > input, + transform_gradients(const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) + const ArrayView > &output) { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), @@ -3142,10 +3142,10 @@ namespace template void - transform_hessians(const VectorSlice > > input, + transform_hessians(const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) + const ArrayView > &output) { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), @@ -3284,10 +3284,10 @@ namespace template void - transform_differential_forms(const VectorSlice > > input, - const MappingType mapping_type, - const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) + transform_differential_forms(const ArrayView > &input, + const MappingType mapping_type, + const typename Mapping::InternalDataBase &mapping_data, + const ArrayView > &output) { AssertDimension (input.size(), output.size()); Assert ((dynamic_cast::InternalData *>(&mapping_data) != 0), @@ -3318,10 +3318,10 @@ namespace template void MappingQGeneric:: -transform (const VectorSlice > > input, +transform (const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { transform_fields(input, mapping_type, mapping_data, output); } @@ -3331,10 +3331,10 @@ transform (const VectorSlice > > input, template void MappingQGeneric:: -transform (const VectorSlice > > input, - const MappingType mapping_type, - const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const +transform (const ArrayView > &input, + const MappingType mapping_type, + const typename Mapping::InternalDataBase &mapping_data, + const ArrayView > &output) const { transform_differential_forms(input, mapping_type, mapping_data, output); } @@ -3344,10 +3344,10 @@ transform (const VectorSlice > template void MappingQGeneric:: -transform (const VectorSlice > > input, +transform (const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { switch (mapping_type) { @@ -3370,10 +3370,10 @@ transform (const VectorSlice > > input, template void MappingQGeneric:: -transform (const VectorSlice > > input, - const MappingType mapping_type, - const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const +transform (const ArrayView > &input, + const MappingType mapping_type, + const typename Mapping::InternalDataBase &mapping_data, + const ArrayView > &output) const { AssertDimension (input.size(), output.size()); @@ -3419,10 +3419,10 @@ transform (const VectorSlice template void MappingQGeneric:: -transform (const VectorSlice > > input, +transform (const ArrayView > &input, const MappingType mapping_type, const typename Mapping::InternalDataBase &mapping_data, - VectorSlice > > output) const + const ArrayView > &output) const { switch (mapping_type) { -- 2.39.5