Hi all,
I want to divide an IteratorRange into smaller chunks and then run some tasks on those smaller ItegratorRanges.
I tried to do this as follows:
const auto
LargeRangeOfCells = filter_iterators(m_triangulation.active_cell_iterators(),
IteratorFilters::LocallyOwnedCell());
size_t total_cell_count = std::distance(
LargeRangeOfCells.begin(),
LargeRangeOfCells.end());
auto start_cell = LargeRangeOfCells.begin();
auto end_cell = start_cell;
for (size_t i = 0; i <
total_cell_count ; i += chunkSize)
{
for (auto j = i; j < std::min(i + chunkSize, total_task_count); j++)
{
++end_cell;
}
IteratorRange<FilteredIterator<FilteredIterator<TriaActiveIterator<dealii::CellAccessor<3, 3>>>>> SmallRangeOfCells(*start_cell, *end_cell);
AddToTaskQueue(tasksOnCells(
SmallRangeOfCells);
start_cell = end_cell;
}
But at one cell inside the method tasksOnCells, this assert fails:
An error occurred in line <996> of file </home/kdas/dealii/include/deal.II/grid/tria_iterator.h> in function
const Accessor& dealii::TriaRawIterator<Accessor>::operator*() const [with Accessor = dealii::CellAccessor<3, 3>]
The violated condition was:
Accessor::structure_dimension != Accessor::dimension || state() == IteratorState::valid
Additional information:
You tried to dereference a cell iterator for which this is not possible. More information on this iterator: level=-1, index=-1, state=past_the_end
What is the correct way to divide a filtered iterator range?
Thanks,
Kaushik