]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make FEValues::get_function_values() use ReadVector.
authorDavid Wells <drwells@email.unc.edu>
Sat, 13 May 2023 12:50:21 +0000 (08:50 -0400)
committerDavid Wells <drwells@email.unc.edu>
Sat, 1 Jul 2023 14:20:10 +0000 (10:20 -0400)
include/deal.II/dofs/dof_accessor.h
include/deal.II/dofs/dof_accessor.templates.h
include/deal.II/fe/fe_values.h
source/dofs/dof_accessor_get.cc
source/dofs/dof_accessor_get.inst.in
source/fe/fe_values.cc
source/fe/fe_values.inst.in

index 001fb7beaca275a5ebc01217cbabcdb58cc9839e..3914d83dff16f2021539bf6445b5a78525d69ba9 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <deal.II/grid/tria_accessor.h>
 
+#include <deal.II/lac/read_vector.h>
+
 #include <boost/container/small_vector.hpp>
 
 #include <set>
@@ -1589,11 +1591,11 @@ public:
    * caller to assure that the types of the numbers stored in input and output
    * vectors are compatible and with similar accuracy.
    */
-  template <class InputVector, typename ForwardIterator>
+  template <typename Number, typename ForwardIterator>
   void
-  get_dof_values(const InputVector &values,
-                 ForwardIterator    local_values_begin,
-                 ForwardIterator    local_values_end) const;
+  get_dof_values(const ReadVector<Number> &values,
+                 ForwardIterator           local_values_begin,
+                 ForwardIterator           local_values_end) const;
 
   /**
    * Collect the values of the given vector restricted to the dofs of this cell
@@ -1683,12 +1685,12 @@ public:
    * interpolation is presently only provided for cells by the finite element
    * classes.
    */
-  template <class InputVector, typename number>
+  template <typename Number>
   void
   get_interpolated_dof_values(
-    const InputVector &   values,
-    Vector<number> &      interpolated_values,
-    const types::fe_index fe_index = numbers::invalid_fe_index) const;
+    const ReadVector<Number> &values,
+    Vector<Number> &          interpolated_values,
+    const types::fe_index     fe_index = numbers::invalid_fe_index) const;
 
   /**
    * This function is the counterpart to get_interpolated_dof_values(): you
index d5505c5fca772e1d1f8bee9046c4d5d59ef2e89e..4ee7bd40e5c96fd3b5e65cfb72dd37786b743884 100644 (file)
@@ -2524,12 +2524,12 @@ DoFCellAccessor<dimension_, space_dimension_, level_dof_access>::get_dof_values(
 
 
 template <int dimension_, int space_dimension_, bool level_dof_access>
-template <class InputVector, typename ForwardIterator>
+template <typename Number, typename ForwardIterator>
 inline void
 DoFCellAccessor<dimension_, space_dimension_, level_dof_access>::get_dof_values(
-  const InputVector &values,
-  ForwardIterator    local_values_begin,
-  ForwardIterator    local_values_end) const
+  const ReadVector<Number> &values,
+  ForwardIterator           local_values_begin,
+  ForwardIterator           local_values_end) const
 {
   (void)local_values_end;
   Assert(this->is_artificial() == false,
@@ -2547,11 +2547,17 @@ DoFCellAccessor<dimension_, space_dimension_, level_dof_access>::get_dof_values(
     dof_indices(this->get_fe().n_dofs_per_cell());
   internal::DoFAccessorImplementation::get_cell_dof_indices(
     *this, dof_indices, this->active_fe_index());
-  dealii::internal::DoFAccessorImplementation::Implementation::
-    extract_subvector_to(values,
-                         dof_indices.data(),
-                         dof_indices.data() + dof_indices.size(),
-                         local_values_begin);
+
+  boost::container::small_vector<Number, 27> values_temp(local_values_end -
+                                                         local_values_begin);
+  auto view = make_array_view(values_temp.begin(), values_temp.end());
+  values.extract_subvector_to(make_array_view(dof_indices.begin(),
+                                              dof_indices.end()),
+                              view);
+  using view_type = std::remove_reference_t<decltype(*local_values_begin)>;
+  ArrayView<view_type> values_view2(&*local_values_begin,
+                                    local_values_end - local_values_begin);
+  std::copy(values_temp.begin(), values_temp.end(), values_view2.begin());
 }
 
 
index 39eb362fe14b0482217e7a5bf37766195b3999b1..9dd445848c77d468dd2af35fdbcd1e82e0da1a92 100644 (file)
@@ -41,6 +41,8 @@
 
 #include <deal.II/hp/q_collection.h>
 
+#include <deal.II/lac/read_vector.h>
+
 #include <algorithm>
 #include <memory>
 #include <type_traits>
@@ -419,12 +421,10 @@ namespace FEValuesViews
      *
      * @dealiiRequiresUpdateFlags{update_values}
      */
-    template <class InputVector>
+    template <typename Number>
     void
-    get_function_values(
-      const InputVector &fe_function,
-      std::vector<solution_value_type<typename InputVector::value_type>>
-        &values) const;
+    get_function_values(const ReadVector<Number> &                fe_function,
+                        std::vector<solution_value_type<Number>> &values) const;
 
     /**
      * Same as above, but using a vector of local degree-of-freedom values. In
@@ -1108,12 +1108,10 @@ namespace FEValuesViews
      *
      * @dealiiRequiresUpdateFlags{update_values}
      */
-    template <class InputVector>
+    template <typename Number>
     void
-    get_function_values(
-      const InputVector &fe_function,
-      std::vector<solution_value_type<typename InputVector::value_type>>
-        &values) const;
+    get_function_values(const ReadVector<Number> &                fe_function,
+                        std::vector<solution_value_type<Number>> &values) const;
 
     /**
      * Same as above, but using a vector of local degree-of-freedom values. In
@@ -1682,12 +1680,10 @@ namespace FEValuesViews
      *
      * @dealiiRequiresUpdateFlags{update_values}
      */
-    template <class InputVector>
+    template <typename Number>
     void
-    get_function_values(
-      const InputVector &fe_function,
-      std::vector<solution_value_type<typename InputVector::value_type>>
-        &values) const;
+    get_function_values(const ReadVector<Number> &                fe_function,
+                        std::vector<solution_value_type<Number>> &values) const;
 
     /**
      * Same as above, but using a vector of local degree-of-freedom values. In
@@ -2058,12 +2054,10 @@ namespace FEValuesViews
      *
      * @dealiiRequiresUpdateFlags{update_values}
      */
-    template <class InputVector>
+    template <typename Number>
     void
-    get_function_values(
-      const InputVector &fe_function,
-      std::vector<solution_value_type<typename InputVector::value_type>>
-        &values) const;
+    get_function_values(const ReadVector<Number> &                fe_function,
+                        std::vector<solution_value_type<Number>> &values) const;
 
     /**
      * Same as above, but using a vector of local degree-of-freedom values. In
@@ -2717,19 +2711,12 @@ public:
    * @post <code>values[q]</code> will contain the value of the field
    * described by fe_function at the $q$th quadrature point.
    *
-   * @note The actual data type of the input vector may be either a
-   * Vector&lt;T&gt;, BlockVector&lt;T&gt;, or one of the PETSc or Trilinos
-   * vector wrapper classes. It represents a global vector of DoF values
-   * associated with the DoFHandler object with which this FEValues object was
-   * last initialized.
-   *
    * @dealiiRequiresUpdateFlags{update_values}
    */
-  template <class InputVector>
+  template <typename Number>
   void
-  get_function_values(
-    const InputVector &                            fe_function,
-    std::vector<typename InputVector::value_type> &values) const;
+  get_function_values(const ReadVector<Number> &fe_function,
+                      std::vector<Number> &     values) const;
 
   /**
    * This function does the same as the other get_function_values(), but
@@ -2744,11 +2731,10 @@ public:
    *
    * @dealiiRequiresUpdateFlags{update_values}
    */
-  template <class InputVector>
+  template <typename Number>
   void
-  get_function_values(
-    const InputVector &                                    fe_function,
-    std::vector<Vector<typename InputVector::value_type>> &values) const;
+  get_function_values(const ReadVector<Number> &   fe_function,
+                      std::vector<Vector<Number>> &values) const;
 
   /**
    * Generate function values from an arbitrary vector. This function
@@ -2806,12 +2792,11 @@ public:
    *
    * @dealiiRequiresUpdateFlags{update_values}
    */
-  template <class InputVector>
+  template <typename Number>
   void
-  get_function_values(
-    const InputVector &                             fe_function,
-    const ArrayView<const types::global_dof_index> &indices,
-    std::vector<typename InputVector::value_type> & values) const;
+  get_function_values(const ReadVector<Number> &fe_function,
+                      const ArrayView<const types::global_dof_index> &indices,
+                      std::vector<Number> &values) const;
 
   /**
    * Generate vector function values from an arbitrary vector.
@@ -2821,12 +2806,11 @@ public:
    *
    * @dealiiRequiresUpdateFlags{update_values}
    */
-  template <class InputVector>
+  template <typename Number>
   void
-  get_function_values(
-    const InputVector &                                    fe_function,
-    const ArrayView<const types::global_dof_index> &       indices,
-    std::vector<Vector<typename InputVector::value_type>> &values) const;
+  get_function_values(const ReadVector<Number> &fe_function,
+                      const ArrayView<const types::global_dof_index> &indices,
+                      std::vector<Vector<Number>> &values) const;
 
 
   /**
@@ -2850,13 +2834,12 @@ public:
    *
    * @dealiiRequiresUpdateFlags{update_values}
    */
-  template <class InputVector>
+  template <typename Number>
   void
-  get_function_values(
-    const InputVector &                                      fe_function,
-    const ArrayView<const types::global_dof_index> &         indices,
-    ArrayView<std::vector<typename InputVector::value_type>> values,
-    const bool quadrature_points_fastest) const;
+  get_function_values(const ReadVector<Number> &fe_function,
+                      const ArrayView<const types::global_dof_index> &indices,
+                      ArrayView<std::vector<Number>>                  values,
+                      const bool quadrature_points_fastest) const;
 
   /** @} */
   /// @name Access to derivatives of global finite element fields
@@ -3882,11 +3865,10 @@ protected:
      * Call @p get_interpolated_dof_values of the iterator with the
      * given arguments.
      */
-    template <typename VectorType>
+    template <typename Number>
     void
-    get_interpolated_dof_values(
-      const VectorType &                       in,
-      Vector<typename VectorType::value_type> &out) const;
+    get_interpolated_dof_values(const ReadVector<Number> &in,
+                                Vector<Number> &          out) const;
 
     /**
      * Call @p get_interpolated_dof_values of the iterator with the
index 9ec01541efaa7d084135949f4fb08ea3ed3a17a5..a414969a05962784109f222634970d87a804a4cb 100644 (file)
@@ -41,12 +41,12 @@ DEAL_II_NAMESPACE_OPEN
 
 
 template <int dim, int spacedim, bool lda>
-template <class InputVector, typename number>
+template <typename Number>
 void
 DoFCellAccessor<dim, spacedim, lda>::get_interpolated_dof_values(
-  const InputVector &   values,
-  Vector<number> &      interpolated_values,
-  const types::fe_index fe_index_) const
+  const ReadVector<Number> &values,
+  Vector<Number> &          interpolated_values,
+  const types::fe_index     fe_index_) const
 {
   const types::fe_index fe_index =
     (this->dof_handler->hp_capability_enabled == false &&
@@ -78,7 +78,7 @@ DoFCellAccessor<dim, spacedim, lda>::get_interpolated_dof_values(
             }
           else
             {
-              Vector<number> tmp(dofs_per_cell);
+              Vector<Number> tmp(dofs_per_cell);
               this->get_dof_values(values, tmp);
 
               FullMatrix<double> interpolation(
@@ -130,8 +130,8 @@ DoFCellAccessor<dim, spacedim, lda>::get_interpolated_dof_values(
       // anyway (and in fact is of size zero, see the assertion above)
       if (fe.n_dofs_per_cell() > 0)
         {
-          Vector<number> tmp1(dofs_per_cell);
-          Vector<number> tmp2(dofs_per_cell);
+          Vector<Number> tmp1(dofs_per_cell);
+          Vector<Number> tmp2(dofs_per_cell);
 
           interpolated_values = 0;
 
@@ -177,7 +177,7 @@ DoFCellAccessor<dim, spacedim, lda>::get_interpolated_dof_values(
               for (unsigned int i = 0; i < dofs_per_cell; ++i)
                 if (fe.restriction_is_additive(i))
                   interpolated_values(i) += tmp2(i);
-                else if (tmp2(i) != number())
+                else if (tmp2(i) != Number())
                   interpolated_values(i) = tmp2(i);
             }
         }
index f7d60737949555962dbe36adc45315bd80f25c57..0c6127dd3927a0f0e2e0d147f21e023df2ccf0dc 100644 (file)
 
 
 
-for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; lda : BOOL)
+for (S : REAL_AND_COMPLEX_SCALARS; deal_II_dimension : DIMENSIONS; lda : BOOL)
   {
     template void DoFCellAccessor<deal_II_dimension, deal_II_dimension, lda>::
-      get_interpolated_dof_values(const VEC &,
-                                  Vector<VEC::value_type> &,
+      get_interpolated_dof_values(const ReadVector<S> &,
+                                  Vector<S> &,
                                   const types::fe_index) const;
 
 #if deal_II_dimension != 3
 
     template void
     DoFCellAccessor<deal_II_dimension, deal_II_dimension + 1, lda>::
-      get_interpolated_dof_values(const VEC &,
-                                  Vector<VEC::value_type> &,
+      get_interpolated_dof_values(const ReadVector<S> &,
+                                  Vector<S> &,
                                   const types::fe_index) const;
 
 #endif
@@ -35,7 +35,7 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS; lda : BOOL)
 #if deal_II_dimension == 3
 
     template void DoFCellAccessor<1, 3, lda>::get_interpolated_dof_values(
-      const VEC &, Vector<VEC::value_type> &, const types::fe_index) const;
+      const ReadVector<S> &, Vector<S> &, const types::fe_index) const;
 
 #endif
   }
index 4d7bc738e8d5b70b95c7587bbcb5da38512b4eeb..2f2117f344a492fa571b42be8847b7baa93c55b4 100644 (file)
@@ -1540,25 +1540,21 @@ namespace FEValuesViews
 
 
   template <int dim, int spacedim>
-  template <class InputVector>
+  template <typename Number>
   void
   Scalar<dim, spacedim>::get_function_values(
-    const InputVector &fe_function,
-    std::vector<solution_value_type<typename InputVector::value_type>> &values)
-    const
+    const ReadVector<Number> &                fe_function,
+    std::vector<solution_value_type<Number>> &values) const
   {
     Assert(fe_values->update_flags & update_values,
            (typename FEValuesBase<dim, spacedim>::ExcAccessToUninitializedField(
              "update_values")));
     Assert(fe_values->present_cell.is_initialized(),
            (typename FEValuesBase<dim, spacedim>::ExcNotReinited()));
-    AssertDimension(fe_function.size(),
-                    fe_values->present_cell.n_dofs_for_dof_handler());
 
     // get function values of dofs on this cell and call internal worker
     // function
-    dealii::Vector<typename InputVector::value_type> dof_values(
-      fe_values->dofs_per_cell);
+    dealii::Vector<Number> dof_values(fe_values->dofs_per_cell);
     fe_values->present_cell.get_interpolated_dof_values(fe_function,
                                                         dof_values);
     internal::do_function_values<dim, spacedim>(
@@ -1813,24 +1809,20 @@ namespace FEValuesViews
 
 
   template <int dim, int spacedim>
-  template <class InputVector>
+  template <typename Number>
   void
   Vector<dim, spacedim>::get_function_values(
-    const InputVector &fe_function,
-    std::vector<solution_value_type<typename InputVector::value_type>> &values)
-    const
+    const ReadVector<Number> &                fe_function,
+    std::vector<solution_value_type<Number>> &values) const
   {
     Assert(fe_values->update_flags & update_values,
            (typename FEValuesBase<dim, spacedim>::ExcAccessToUninitializedField(
              "update_values")));
     Assert(fe_values->present_cell.is_initialized(),
            (typename FEValuesBase<dim, spacedim>::ExcNotReinited()));
-    AssertDimension(fe_function.size(),
-                    fe_values->present_cell.n_dofs_for_dof_handler());
 
     // get function values of dofs on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values(
-      fe_values->dofs_per_cell);
+    dealii::Vector<Number> dof_values(fe_values->dofs_per_cell);
     fe_values->present_cell.get_interpolated_dof_values(fe_function,
                                                         dof_values);
     internal::do_function_values<dim, spacedim>(
@@ -2258,24 +2250,20 @@ namespace FEValuesViews
 
 
   template <int dim, int spacedim>
-  template <class InputVector>
+  template <typename Number>
   void
   SymmetricTensor<2, dim, spacedim>::get_function_values(
-    const InputVector &fe_function,
-    std::vector<solution_value_type<typename InputVector::value_type>> &values)
-    const
+    const ReadVector<Number> &                fe_function,
+    std::vector<solution_value_type<Number>> &values) const
   {
     Assert(fe_values->update_flags & update_values,
            (typename FEValuesBase<dim, spacedim>::ExcAccessToUninitializedField(
              "update_values")));
     Assert(fe_values->present_cell.is_initialized(),
            (typename FEValuesBase<dim, spacedim>::ExcNotReinited()));
-    AssertDimension(fe_function.size(),
-                    fe_values->present_cell.n_dofs_for_dof_handler());
 
     // get function values of dofs on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values(
-      fe_values->dofs_per_cell);
+    dealii::Vector<Number> dof_values(fe_values->dofs_per_cell);
     fe_values->present_cell.get_interpolated_dof_values(fe_function,
                                                         dof_values);
     internal::do_function_values<dim, spacedim>(
@@ -2368,24 +2356,20 @@ namespace FEValuesViews
 
 
   template <int dim, int spacedim>
-  template <class InputVector>
+  template <typename Number>
   void
   Tensor<2, dim, spacedim>::get_function_values(
-    const InputVector &fe_function,
-    std::vector<solution_value_type<typename InputVector::value_type>> &values)
-    const
+    const ReadVector<Number> &                fe_function,
+    std::vector<solution_value_type<Number>> &values) const
   {
     Assert(fe_values->update_flags & update_values,
            (typename FEValuesBase<dim, spacedim>::ExcAccessToUninitializedField(
              "update_values")));
     Assert(fe_values->present_cell.is_initialized(),
            (typename FEValuesBase<dim, spacedim>::ExcNotReinited()));
-    AssertDimension(fe_function.size(),
-                    fe_values->present_cell.n_dofs_for_dof_handler());
 
     // get function values of dofs on this cell
-    dealii::Vector<typename InputVector::value_type> dof_values(
-      fe_values->dofs_per_cell);
+    dealii::Vector<Number> dof_values(fe_values->dofs_per_cell);
     fe_values->present_cell.get_interpolated_dof_values(fe_function,
                                                         dof_values);
     internal::do_function_values<dim, spacedim>(
@@ -2645,11 +2629,11 @@ FEValuesBase<dim, spacedim>::CellIteratorContainer::n_dofs_for_dof_handler()
 
 
 template <int dim, int spacedim>
-template <typename VectorType>
+template <typename Number>
 void
 FEValuesBase<dim, spacedim>::CellIteratorContainer::get_interpolated_dof_values(
-  const VectorType &                       in,
-  Vector<typename VectorType::value_type> &out) const
+  const ReadVector<Number> &in,
+  Vector<Number> &          out) const
 {
   Assert(is_initialized(), ExcNotReinited());
   Assert(dof_handler != nullptr, ExcNeedsDoFHandler());
@@ -3265,13 +3249,12 @@ namespace internal
 
 
 template <int dim, int spacedim>
-template <class InputVector>
+template <typename Number>
 void
 FEValuesBase<dim, spacedim>::get_function_values(
-  const InputVector &                            fe_function,
-  std::vector<typename InputVector::value_type> &values) const
+  const ReadVector<Number> &fe_function,
+  std::vector<Number> &     values) const
 {
-  using Number = typename InputVector::value_type;
   Assert(this->update_flags & update_values,
          ExcAccessToUninitializedField("update_values"));
   AssertDimension(fe->n_components(), 1);
@@ -3290,24 +3273,22 @@ FEValuesBase<dim, spacedim>::get_function_values(
 
 
 template <int dim, int spacedim>
-template <class InputVector>
+template <typename Number>
 void
 FEValuesBase<dim, spacedim>::get_function_values(
-  const InputVector &                             fe_function,
+  const ReadVector<Number> &                      fe_function,
   const ArrayView<const types::global_dof_index> &indices,
-  std::vector<typename InputVector::value_type> & values) const
+  std::vector<Number> &                           values) const
 {
-  using Number = typename InputVector::value_type;
   Assert(this->update_flags & update_values,
          ExcAccessToUninitializedField("update_values"));
   AssertDimension(fe->n_components(), 1);
   AssertDimension(indices.size(), dofs_per_cell);
 
   boost::container::small_vector<Number, 200> 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(make_array_view(dof_values.begin(),
-                                               dof_values.end()),
+  auto view = make_array_view(dof_values.begin(), dof_values.end());
+  fe_function.extract_subvector_to(indices, view);
+  internal::do_function_values(view,
                                this->finite_element_output.shape_values,
                                values);
 }
@@ -3315,13 +3296,12 @@ FEValuesBase<dim, spacedim>::get_function_values(
 
 
 template <int dim, int spacedim>
-template <class InputVector>
+template <typename Number>
 void
 FEValuesBase<dim, spacedim>::get_function_values(
-  const InputVector &                                    fe_function,
-  std::vector<Vector<typename InputVector::value_type>> &values) const
+  const ReadVector<Number> &   fe_function,
+  std::vector<Vector<Number>> &values) const
 {
-  using Number = typename InputVector::value_type;
   Assert(present_cell.is_initialized(), ExcNotReinited());
 
   Assert(this->update_flags & update_values,
@@ -3342,14 +3322,13 @@ FEValuesBase<dim, spacedim>::get_function_values(
 
 
 template <int dim, int spacedim>
-template <class InputVector>
+template <typename Number>
 void
 FEValuesBase<dim, spacedim>::get_function_values(
-  const InputVector &                                    fe_function,
-  const ArrayView<const types::global_dof_index> &       indices,
-  std::vector<Vector<typename InputVector::value_type>> &values) const
+  const ReadVector<Number> &                      fe_function,
+  const ArrayView<const types::global_dof_index> &indices,
+  std::vector<Vector<Number>> &                   values) const
 {
-  using Number = typename InputVector::value_type;
   // Size of indices must be a multiple of dofs_per_cell such that an integer
   // number of function values is generated in each point.
   Assert(indices.size() % dofs_per_cell == 0,
@@ -3358,10 +3337,10 @@ FEValuesBase<dim, spacedim>::get_function_values(
          ExcAccessToUninitializedField("update_values"));
 
   boost::container::small_vector<Number, 200> 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]);
+  auto view = make_array_view(dof_values.begin(), dof_values.end());
+  fe_function.extract_subvector_to(indices, view);
   internal::do_function_values(
-    make_array_view(dof_values.begin(), dof_values.end()),
+    view,
     this->finite_element_output.shape_values,
     *fe,
     this->finite_element_output.shape_function_to_row_table,
@@ -3373,15 +3352,14 @@ FEValuesBase<dim, spacedim>::get_function_values(
 
 
 template <int dim, int spacedim>
-template <class InputVector>
+template <typename Number>
 void
 FEValuesBase<dim, spacedim>::get_function_values(
-  const InputVector &                                      fe_function,
-  const ArrayView<const types::global_dof_index> &         indices,
-  ArrayView<std::vector<typename InputVector::value_type>> values,
+  const ReadVector<Number> &                      fe_function,
+  const ArrayView<const types::global_dof_index> &indices,
+  ArrayView<std::vector<Number>>                  values,
   const bool quadrature_points_fastest) const
 {
-  using Number = typename InputVector::value_type;
   Assert(this->update_flags & update_values,
          ExcAccessToUninitializedField("update_values"));
 
@@ -3390,11 +3368,11 @@ FEValuesBase<dim, spacedim>::get_function_values(
   Assert(indices.size() % dofs_per_cell == 0,
          ExcNotMultiple(indices.size(), dofs_per_cell));
 
-  boost::container::small_vector<Number, 200> dof_values(indices.size());
-  for (unsigned int i = 0; i < indices.size(); ++i)
-    dof_values[i] = internal::get_vector_element(fe_function, indices[i]);
+  boost::container::small_vector<Number, 200> dof_values(dofs_per_cell);
+  auto view = make_array_view(dof_values.begin(), dof_values.end());
+  fe_function.extract_subvector_to(indices, view);
   internal::do_function_values(
-    make_array_view(dof_values.begin(), dof_values.end()),
+    view,
     this->finite_element_output.shape_values,
     *fe,
     this->finite_element_output.shape_function_to_row_table,
index 04e7ea0aaa004cb1cb339fc7b36dd9e4c1c7995a..54ba212b8f5bd3b583cf829a4b950802599b308c 100644 (file)
@@ -88,6 +88,65 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS;
                                       deal_II_space_dimension>> &);
 #  endif
   }
+for (S : REAL_AND_COMPLEX_SCALARS; deal_II_dimension : DIMENSIONS;
+     deal_II_space_dimension : SPACE_DIMENSIONS)
+  {
+#  if deal_II_dimension <= deal_II_space_dimension
+    template void
+    FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension>::
+      get_function_values<S>(const dealii::ReadVector<S> &,
+                             std::vector<ProductType<S, value_type>::type> &)
+        const;
+
+    template void
+    FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
+      get_function_values<S>(
+        const dealii::ReadVector<S> &,
+        std::vector<
+          ProductType<S, dealii::Tensor<1, deal_II_space_dimension>>::type> &)
+        const;
+
+    template void FEValuesViews::SymmetricTensor<2,
+                                                 deal_II_dimension,
+                                                 deal_II_space_dimension>::
+      get_function_values<S>(
+        const dealii::ReadVector<S> &,
+        std::vector<ProductType<
+          S,
+          dealii::SymmetricTensor<2, deal_II_space_dimension>>::type> &) const;
+
+    template void
+    FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension>::
+      get_function_values<S>(
+        const dealii::ReadVector<S> &,
+        std::vector<
+          ProductType<S, dealii::Tensor<2, deal_II_space_dimension>>::type> &)
+        const;
+
+    template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
+      get_function_values<S>(const ReadVector<S> &, std::vector<S> &) const;
+
+    template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
+      get_function_values<S>(const ReadVector<S> &,
+                             const ArrayView<const types::global_dof_index> &,
+                             std::vector<S> &) const;
+
+    template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
+      get_function_values<S>(const ReadVector<S> &, std::vector<Vector<S>> &)
+        const;
+
+    template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
+      get_function_values<S>(const ReadVector<S> &,
+                             const ArrayView<const types::global_dof_index> &,
+                             std::vector<Vector<S>> &) const;
+
+    template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
+      get_function_values<S>(const ReadVector<S> &,
+                             const ArrayView<const types::global_dof_index> &,
+                             ArrayView<std::vector<S>>,
+                             bool) const;
+#  endif
+  }
 
 
 
@@ -96,12 +155,6 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
   {
 #  if deal_II_dimension <= deal_II_space_dimension
     template void
-    FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension>::
-      get_function_values<dealii::VEC>(
-        const dealii::VEC &,
-        std::vector<ProductType<dealii::VEC::value_type, value_type>::type> &)
-        const;
-    template void
     FEValuesViews::Scalar<deal_II_dimension, deal_II_space_dimension>::
       get_function_gradients<dealii::VEC>(
         const dealii::VEC &,
@@ -133,14 +186,6 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
         const;
 
     template void
-    FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
-      get_function_values<dealii::VEC>(
-        const dealii::VEC &,
-        std::vector<
-          ProductType<dealii::VEC::value_type,
-                      dealii::Tensor<1, deal_II_space_dimension>>::type> &)
-        const;
-    template void
     FEValuesViews::Vector<deal_II_dimension, deal_II_space_dimension>::
       get_function_gradients<dealii::VEC>(
         const dealii::VEC &,
@@ -192,14 +237,6 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
                       dealii::Tensor<4, deal_II_space_dimension>>::type> &)
         const;
 
-    template void FEValuesViews::SymmetricTensor<2,
-                                                 deal_II_dimension,
-                                                 deal_II_space_dimension>::
-      get_function_values<dealii::VEC>(
-        const dealii::VEC &,
-        std::vector<ProductType<
-          dealii::VEC::value_type,
-          dealii::SymmetricTensor<2, deal_II_space_dimension>>::type> &) const;
     template void FEValuesViews::
       SymmetricTensor<2, deal_II_dimension, deal_II_space_dimension>::
         get_function_divergences<dealii::VEC>(
@@ -210,14 +247,6 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
           const;
 
     template void
-    FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension>::
-      get_function_values<dealii::VEC>(
-        const dealii::VEC &,
-        std::vector<
-          ProductType<dealii::VEC::value_type,
-                      dealii::Tensor<2, deal_II_space_dimension>>::type> &)
-        const;
-    template void
     FEValuesViews::Tensor<2, deal_II_dimension, deal_II_space_dimension>::
       get_function_divergences<dealii::VEC>(
         const dealii::VEC &,
@@ -358,29 +387,6 @@ for (VEC : VECTOR_TYPES; deal_II_dimension : DIMENSIONS;
   {
 #  if deal_II_dimension <= deal_II_space_dimension
 
-    template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
-      get_function_values<VEC>(const VEC &, std::vector<VEC::value_type> &)
-        const;
-    template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
-      get_function_values<VEC>(const VEC &,
-                               const ArrayView<const types::global_dof_index> &,
-                               std::vector<VEC::value_type> &) const;
-
-    template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
-      get_function_values<VEC>(const VEC &,
-                               std::vector<Vector<VEC::value_type>> &) const;
-
-    template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
-      get_function_values<VEC>(const VEC &,
-                               const ArrayView<const types::global_dof_index> &,
-                               std::vector<Vector<VEC::value_type>> &) const;
-
-    template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
-      get_function_values<VEC>(const VEC &,
-                               const ArrayView<const types::global_dof_index> &,
-                               ArrayView<std::vector<VEC::value_type>>,
-                               bool) const;
-
     template void FEValuesBase<deal_II_dimension, deal_II_space_dimension>::
       get_function_gradients<VEC>(
         const VEC &,

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.