->component_dof_indices_offset[this->active_fe_index]
[this->first_selected_component] *
n_lanes;
+
+ std::array<typename VectorType::value_type *, n_components> src_ptrs;
+ if (n_components == 1 || this->n_fe_components == 1)
+ for (unsigned int comp = 0; comp < n_components; ++comp)
+ src_ptrs[comp] =
+ const_cast<typename VectorType::value_type *>(src[comp]->begin());
+ else
+ src_ptrs[0] =
+ const_cast<typename VectorType::value_type *>(src[0]->begin());
+
if (n_components == 1 || this->n_fe_components == 1)
for (unsigned int i = 0; i < dofs_per_component;
++i, dof_indices += n_lanes)
operation.process_dof_gather(dof_indices,
*src[comp],
0,
+ src_ptrs[comp],
values_dofs[comp][i],
vector_selector);
else
for (unsigned int comp = 0; comp < n_components; ++comp)
for (unsigned int i = 0; i < dofs_per_component;
++i, dof_indices += n_lanes)
- operation.process_dof_gather(
- dof_indices, *src[0], 0, values_dofs[comp][i], vector_selector);
+ operation.process_dof_gather(dof_indices,
+ *src[0],
+ 0,
+ src_ptrs[0],
+ values_dofs[comp][i],
+ vector_selector);
return;
}
internal::MatrixFreeFunctions::DoFInfo::IndexStorageVariants::
interleaved_contiguous_strided)
{
+ std::array<typename VectorType::value_type *, n_components> src_ptrs;
+ if (n_components == 1 || this->n_fe_components == 1)
+ for (unsigned int comp = 0; comp < n_components; ++comp)
+ src_ptrs[comp] = const_cast<typename VectorType::value_type *>(
+ src[comp]->begin());
+ else
+ src_ptrs[0] =
+ const_cast<typename VectorType::value_type *>(src[0]->begin());
+
if (n_components == 1 || this->n_fe_components == 1)
for (unsigned int i = 0; i < dofs_per_component; ++i)
{
operation.process_dof_gather(dof_indices.data(),
*src[comp],
i * n_lanes,
+ src_ptrs[comp] + i * n_lanes,
values_dofs[comp][i],
vector_selector);
}
for (unsigned int comp = 0; comp < n_components; ++comp)
for (unsigned int i = 0; i < dofs_per_component; ++i)
{
- operation.process_dof_gather(dof_indices.data(),
- *src[0],
- (comp * dofs_per_component + i) *
- n_lanes,
- values_dofs[comp][i],
- vector_selector);
+ operation.process_dof_gather(
+ dof_indices.data(),
+ *src[0],
+ (comp * dofs_per_component + i) * n_lanes,
+ src_ptrs[0] + (comp * dofs_per_component + i) * n_lanes,
+ values_dofs[comp][i],
+ vector_selector);
}
}
else
internal::MatrixFreeFunctions::DoFInfo::
IndexStorageVariants::interleaved_contiguous_mixed_strides,
ExcNotImplemented());
+ std::array<typename VectorType::value_type *, n_components> src_ptrs;
+ if (n_components == 1 || this->n_fe_components == 1)
+ for (unsigned int comp = 0; comp < n_components; ++comp)
+ src_ptrs[comp] = const_cast<typename VectorType::value_type *>(
+ src[comp]->begin());
+ else
+ src_ptrs[0] =
+ const_cast<typename VectorType::value_type *>(src[0]->begin());
+
const unsigned int *offsets =
&dof_info.dof_indices_interleave_strides[ind][n_lanes * this->cell];
if (n_components == 1 || this->n_fe_components == 1)
operation.process_dof_gather(dof_indices.data(),
*src[comp],
0,
+ src_ptrs[comp],
values_dofs[comp][i],
vector_selector);
DEAL_II_OPENMP_SIMD_PRAGMA
operation.process_dof_gather(dof_indices.data(),
*src[0],
0,
+ src_ptrs[0],
values_dofs[comp][i],
vector_selector);
DEAL_II_OPENMP_SIMD_PRAGMA
// gather
template <typename VectorType>
void
- process_dof_gather(const unsigned int *indices,
- VectorType &vec,
- const unsigned int constant_offset,
- VectorizedArrayType &res,
+ process_dof_gather(const unsigned int *indices,
+ VectorType &vec,
+ const unsigned int constant_offset,
+ typename VectorType::value_type *vec_ptr,
+ VectorizedArrayType &res,
std::integral_constant<bool, true>) const
{
+ (void)constant_offset;
+ (void)vec;
+
#ifdef DEBUG
// in debug mode, run non-vectorized version because this path
// has additional checks (e.g., regarding ghosting)
+ Assert(vec_ptr == vec.begin() + constant_offset, ExcInternalError());
process_dof_gather(indices,
vec,
constant_offset,
+ vec_ptr,
res,
std::integral_constant<bool, false>());
#else
- res.gather(vec.begin() + constant_offset, indices);
+ res.gather(vec_ptr, indices);
#endif
}
// manually load the data
template <typename VectorType>
void
- process_dof_gather(const unsigned int *indices,
- const VectorType &vec,
- const unsigned int constant_offset,
+ process_dof_gather(const unsigned int *indices,
+ const VectorType &vec,
+ const unsigned int constant_offset,
+ typename VectorType::value_type *,
VectorizedArrayType &res,
std::integral_constant<bool, false>) const
{
// scatter
template <typename VectorType>
void
- process_dof_gather(const unsigned int *indices,
- VectorType &vec,
- const unsigned int constant_offset,
- VectorizedArrayType &res,
+ process_dof_gather(const unsigned int *indices,
+ VectorType &vec,
+ const unsigned int constant_offset,
+ typename VectorType::value_type *vec_ptr,
+ VectorizedArrayType &res,
std::integral_constant<bool, true>) const
{
+ (void)constant_offset;
+ (void)vec_ptr;
+ (void)vec;
+
#if DEAL_II_VECTORIZATION_WIDTH_IN_BITS < 512
for (unsigned int v = 0; v < VectorizedArrayType::size(); ++v)
vector_access(vec, indices[v] + constant_offset) += res[v];
#else
// only use gather in case there is also scatter.
VectorizedArrayType tmp;
- tmp.gather(vec.begin() + constant_offset, indices);
+ tmp.gather(vec_ptr, indices);
tmp += res;
- tmp.scatter(indices, vec.begin() + constant_offset);
+ tmp.scatter(indices, vec_ptr);
#endif
}
// manually append all data
template <typename VectorType>
void
- process_dof_gather(const unsigned int *indices,
- VectorType &vec,
- const unsigned int constant_offset,
+ process_dof_gather(const unsigned int *indices,
+ VectorType &vec,
+ const unsigned int constant_offset,
+ typename VectorType::value_type *,
VectorizedArrayType &res,
std::integral_constant<bool, false>) const
{
template <typename VectorType>
void
- process_dof_gather(const unsigned int *indices,
- VectorType &vec,
- const unsigned int constant_offset,
- VectorizedArrayType &res,
+ process_dof_gather(const unsigned int *indices,
+ VectorType &vec,
+ const unsigned int constant_offset,
+ typename VectorType::value_type *vec_ptr,
+ VectorizedArrayType &res,
std::integral_constant<bool, true>) const
{
- res.scatter(indices, vec.begin() + constant_offset);
+ (void)vec_ptr;
+ (void)constant_offset;
+ (void)vec;
+ Assert(vec_ptr == vec.begin() + constant_offset, ExcInternalError());
+ res.scatter(indices, vec_ptr);
}
template <typename VectorType>
void
- process_dof_gather(const unsigned int *indices,
- VectorType &vec,
- const unsigned int constant_offset,
+ process_dof_gather(const unsigned int *indices,
+ VectorType &vec,
+ const unsigned int constant_offset,
+ typename VectorType::value_type *,
VectorizedArrayType &res,
std::integral_constant<bool, false>) const
{