-New: An IndexSet::split_by_block() function is added which partitions the set indices for example based on a block structure into blocks.
-IndexSet should be defined with respect to the global block structure. In particular, dofs_per_block should be defined consistently across MPI ranks.
+New: An IndexSet::split_by_block() function is added which partitions the set
+indices, for example based on a block structure, into blocks.
<br>
(Katrin Mang, 2020/02/14)
get_view(const size_type begin, const size_type end) const;
/**
- * Split the set indices represented by this object into blocks
- * given by the @p dofs_per_block structure.
+ * Split the set indices represented by this object into blocks given by the
+ * @p n_indices_per_block structure. The sum of its entries must match the
+ * global size of the current object.
+ *
*/
std::vector<IndexSet>
split_by_block(
- const std::vector<types::global_dof_index> &dofs_per_block) const;
+ const std::vector<types::global_dof_index> &n_indices_per_block) const;
/**
* Remove all elements contained in @p other from this set. In other words,
std::vector<IndexSet>
IndexSet::split_by_block(
- const std::vector<types::global_dof_index> &dofs_per_block) const
+ const std::vector<types::global_dof_index> &n_indices_per_block) const
{
std::vector<IndexSet> partitioned;
- const unsigned int n_block_dofs = dofs_per_block.size();
+ const unsigned int n_blocks = n_indices_per_block.size();
- partitioned.reserve(n_block_dofs);
+ partitioned.reserve(n_blocks);
types::global_dof_index start = 0;
types::global_dof_index sum = 0;
- for (const auto n_block_dofs : dofs_per_block)
+ for (const auto n_block_indices : n_indices_per_block)
{
- partitioned.push_back(this->get_view(start, start + n_block_dofs));
- start += n_block_dofs;
+ partitioned.push_back(this->get_view(start, start + n_block_indices));
+ start += n_block_indices;
sum += partitioned.back().size();
}
AssertDimension(sum, this->size());