After editing, e.g., the cell regions for a given grid, grid[NumCellRegions] is not updated. See:
julia> grid = simplexgrid(0:10);
julia> num_cellregions(grid)
1
julia> grid[CellRegions][4] = 2 # edit something
2
julia> num_cellregions(grid) # still = 1
1
julia> trim!(grid) # remove pre-computed data
julia> num_cellregions(grid) # now it is correct again
2
For me, especially functions like num_cellregions should compute the current number of cell regions and not return a cached value.
So I vote for recomputing AbstranctGridIntegerConstant in every get_index call. Also rename the type to AbstractGridInteger, since this is not a constant.
After editing, e.g., the cell regions for a given grid,
grid[NumCellRegions]is not updated. See:For me, especially functions like
num_cellregionsshould compute the current number of cell regions and not return a cached value.So I vote for recomputing
AbstranctGridIntegerConstantin everyget_indexcall. Also rename the type toAbstractGridInteger, since this is not a constant.