*/
template <typename VectorType, typename VectorOperation>
void
- read_write_operation(const VectorOperation &operation,
- VectorType * vectors[],
+ read_write_operation(const VectorOperation & operation,
+ const std::array<VectorType *, n_components_> &vectors,
const std::bitset<VectorizedArrayType::size()> &mask,
const bool apply_constraints = true) const;
void
read_write_operation_contiguous(
const VectorOperation & operation,
- VectorType * vectors[],
+ const std::array<VectorType *, n_components_> & vectors,
const std::bitset<VectorizedArrayType::size()> &mask) const;
/**
*/
template <typename VectorType, typename VectorOperation>
void
- read_write_operation_global(const VectorOperation &operation,
- VectorType * vectors[]) const;
+ read_write_operation_global(
+ const VectorOperation & operation,
+ const std::array<VectorType *, n_components_> &vectors) const;
/**
* This field stores the values for local degrees of freedom (e.g. after
template <typename VectorType, typename VectorOperation>
inline void
FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
- read_write_operation(const VectorOperation &operation,
- VectorType * src[],
+ read_write_operation(const VectorOperation & operation,
+ const std::array<VectorType *, n_components_> &src,
const std::bitset<VectorizedArrayType::size()> &mask,
const bool apply_constraints) const
{
template <typename VectorType, typename VectorOperation>
inline void
FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
- read_write_operation_global(const VectorOperation &operation,
- VectorType * src[]) const
+ read_write_operation_global(
+ const VectorOperation & operation,
+ const std::array<VectorType *, n_components_> &src) const
{
Assert(!local_dof_indices.empty(), ExcNotInitialized());
FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
read_write_operation_contiguous(
const VectorOperation & operation,
- VectorType * src[],
+ const std::array<VectorType *, n_components_> & src,
const std::bitset<VectorizedArrayType::size()> &mask) const
{
// This functions processes the functions read_dof_values,
}
}
+namespace internal
+{
+ template <typename Number,
+ typename VectorType,
+ typename std::enable_if<!IsBlockVector<VectorType>::value,
+ VectorType>::type * = nullptr>
+ decltype(std::declval<VectorType>().begin())
+ get_beginning(VectorType &vec)
+ {
+ return vec.begin();
+ }
+
+ template <typename Number,
+ typename VectorType,
+ typename std::enable_if<IsBlockVector<VectorType>::value,
+ VectorType>::type * = nullptr>
+ typename VectorType::value_type *
+ get_beginning(VectorType &)
+ {
+ return nullptr;
+ }
+
+ template <int n_components, typename VectorType>
+ std::array<typename internal::BlockVectorSelector<
+ typename std::remove_const<VectorType>::type,
+ IsBlockVector<typename std::remove_const<VectorType>::type>::
+ value>::BaseVectorType *,
+ n_components>
+ get_vector_data(VectorType &src, const unsigned int first_index)
+ {
+ // select between block vectors and non-block vectors. Note that the number
+ // of components is checked in the internal data
+ std::array<typename internal::BlockVectorSelector<
+ typename std::remove_const<VectorType>::type,
+ IsBlockVector<typename std::remove_const<VectorType>::type>::
+ value>::BaseVectorType *,
+ n_components>
+ src_data;
+ for (unsigned int d = 0; d < n_components; ++d)
+ src_data[d] = internal::BlockVectorSelector<
+ typename std::remove_const<VectorType>::type,
+ IsBlockVector<typename std::remove_const<VectorType>::type>::value>::
+ get_vector_component(
+ const_cast<typename std::remove_const<VectorType>::type &>(src),
+ d + first_index);
+
+ return src_data;
+ }
+} // namespace internal
+
template <int dim,
FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
read_dof_values(const VectorType &src, const unsigned int first_index)
{
- // select between block vectors and non-block vectors. Note that the number
- // of components is checked in the internal data
- typename internal::BlockVectorSelector<
- VectorType,
- IsBlockVector<VectorType>::value>::BaseVectorType *src_data[n_components];
- for (unsigned int d = 0; d < n_components; ++d)
- src_data[d] =
- internal::BlockVectorSelector<VectorType,
- IsBlockVector<VectorType>::value>::
- get_vector_component(const_cast<VectorType &>(src), d + first_index);
+ const auto src_data =
+ internal::get_vector_data<n_components_>(src, first_index);
internal::VectorReader<Number, VectorizedArrayType> reader;
read_write_operation(reader,
FEEvaluationBase<dim, n_components_, Number, is_face, VectorizedArrayType>::
read_dof_values_plain(const VectorType &src, const unsigned int first_index)
{
- // select between block vectors and non-block vectors. Note that the number
- // of components is checked in the internal data
- typename internal::BlockVectorSelector<
- VectorType,
- IsBlockVector<VectorType>::value>::BaseVectorType *src_data[n_components];
- for (unsigned int d = 0; d < n_components; ++d)
- src_data[d] =
- internal::BlockVectorSelector<VectorType,
- IsBlockVector<VectorType>::value>::
- get_vector_component(const_cast<VectorType &>(src), d + first_index);
+ const auto src_data =
+ internal::get_vector_data<n_components_>(src, first_index);
internal::VectorReader<Number, VectorizedArrayType> reader;
read_write_operation(reader,
internal::ExcAccessToUninitializedField());
# endif
- // select between block vectors and non-block vectors. Note that the number
- // of components is checked in the internal data
- typename internal::BlockVectorSelector<
- VectorType,
- IsBlockVector<VectorType>::value>::BaseVectorType *dst_data[n_components];
- for (unsigned int d = 0; d < n_components; ++d)
- dst_data[d] = internal::BlockVectorSelector<
- VectorType,
- IsBlockVector<VectorType>::value>::get_vector_component(dst,
- d + first_index);
+ const auto dst_data =
+ internal::get_vector_data<n_components_>(dst, first_index);
internal::VectorDistributorLocalToGlobal<Number, VectorizedArrayType>
distributor;
internal::ExcAccessToUninitializedField());
# endif
- // select between block vectors and non-block vectors. Note that the number
- // of components is checked in the internal data
- typename internal::BlockVectorSelector<
- VectorType,
- IsBlockVector<VectorType>::value>::BaseVectorType *dst_data[n_components];
- for (unsigned int d = 0; d < n_components; ++d)
- dst_data[d] = internal::BlockVectorSelector<
- VectorType,
- IsBlockVector<VectorType>::value>::get_vector_component(dst,
- d + first_index);
+ const auto dst_data =
+ internal::get_vector_data<n_components_>(dst, first_index);
internal::VectorSetter<Number, VectorizedArrayType> setter;
read_write_operation(setter, dst_data, mask);
internal::ExcAccessToUninitializedField());
# endif
- // select between block vectors and non-block vectors. Note that the number
- // of components is checked in the internal data
- typename internal::BlockVectorSelector<
- VectorType,
- IsBlockVector<VectorType>::value>::BaseVectorType *dst_data[n_components];
- for (unsigned int d = 0; d < n_components; ++d)
- dst_data[d] = internal::BlockVectorSelector<
- VectorType,
- IsBlockVector<VectorType>::value>::get_vector_component(dst,
- d + first_index);
+ const auto dst_data =
+ internal::get_vector_data<n_components_>(dst, first_index);
internal::VectorSetter<Number, VectorizedArrayType> setter;
read_write_operation(setter, dst_data, mask, false);
{
return false;
}
-
- template <typename Number,
- typename VectorType,
- typename std::enable_if<!IsBlockVector<VectorType>::value,
- VectorType>::type * = nullptr>
- decltype(std::declval<VectorType>().begin())
- get_beginning(VectorType &vec)
- {
- return vec.begin();
- }
-
- template <typename Number,
- typename VectorType,
- typename std::enable_if<IsBlockVector<VectorType>::value,
- VectorType>::type * = nullptr>
- typename VectorType::value_type *
- get_beginning(VectorType &)
- {
- return nullptr;
- }
} // namespace internal