// Step 2: fix single contiguous cell among others with interleaved
// storage
if (n_interleaved > 0 && index_kinds[static_cast<unsigned int>(
- IndexStorageVariants::contiguous)])
+ IndexStorageVariants::contiguous)] > 0)
for (unsigned int i = 0; i < irregular_cells.size(); ++i)
if (index_storage_variants[dof_access_cell][i] ==
IndexStorageVariants::contiguous)
IndexStorageVariants::interleaved_contiguous_mixed_strides)]++;
}
- n_interleaved =
- index_kinds[static_cast<unsigned int>(
- IndexStorageVariants::interleaved_contiguous)] +
- index_kinds[static_cast<unsigned int>(
- IndexStorageVariants::interleaved_contiguous_strided)] +
- index_kinds[static_cast<unsigned int>(
- IndexStorageVariants::interleaved_contiguous_mixed_strides)];
-
// Step 3: Interleaved cells are left but also some non-contiguous ones
// -> revert all to full storage
if (n_interleaved > 0 &&
const bool evaluate_gradients,
const bool evaluate_hessians)
{
- if (this->dof_info->index_storage_variants
+ // If the index storage is interleaved and contiguous and the vector storage
+ // has the correct alignment, we can directly pass the pointer into the
+ // vector to the evaluate() call, without reading the vector entries into a
+ // separate data field. This saves some operations.
+ if (std::is_same<typename VectorType::value_type, Number>::value &&
+ this->dof_info->index_storage_variants
[internal::MatrixFreeFunctions::DoFInfo::dof_access_cell]
[this->cell] == internal::MatrixFreeFunctions::DoFInfo::
IndexStorageVariants::interleaved_contiguous &&
const bool integrate_gradients,
VectorType &destination)
{
- if (this->dof_info->index_storage_variants
+ // If the index storage is interleaved and contiguous and the vector storage
+ // has the correct alignment, we can directly pass the pointer into the
+ // vector to the integrate() call, without writing temporary results into a
+ // separate data field that will later be added into the vector. This saves
+ // some operations.
+ if (std::is_same<typename VectorType::value_type, Number>::value &&
+ this->dof_info->index_storage_variants
[internal::MatrixFreeFunctions::DoFInfo::dof_access_cell]
[this->cell] == internal::MatrixFreeFunctions::DoFInfo::
IndexStorageVariants::interleaved_contiguous &&