Fix Index self-overwriting
The Index
class offers a split function split(Index&, Index&, ...)
that splits its domain and writes the new domains into the reference parameters. The function is marked as const
but Partitioner
passes the same object as one of the parameters, which means that, despite this const
ness, the object overwrites itself.
Originally, the function made local copies of the data members. These were removed in !164 (merged), which broke the partitioning under certain conditions.
This MR tweaks the partitioning algorithm to prevent this self-overwrite and also makes some stylistic changes for consistency with the rest of the codebase.
Related: #173 to rewrite the partitioner altogether.