Adds a class to allow slicing ModelArrays in order to use part of the data within. Also includes the ArraySlicer::Slice class that provides the slicing syntax and an iterator class for accessing data.
Test Description
Several test cases that check that the slicing syntax is correctly interpreted and that making reasonable slices produces expected results. To fully test the slice syntax, a comprehensive suite of cases is defined. As far as possible, the class is designed to behave like the numpy Python library.
Documentation Impact
A section will need to be added to the eventual ModelArray developer documentation. As this does not yet exist, there is nothing to add as part of this PR.
just mentioning for future reference... If we move to c++23 we may wish to consider using mdspans. This would allow us to easily switch between 1D and N-D array views.
ModelArraySlice and slicing infrastructure
Fixes #735
Change Description
Adds a class to allow slicing
ModelArray
s in order to use part of the data within. Also includes theArraySlicer::Slice
class that provides the slicing syntax and an iterator class for accessing data.Test Description
Several test cases that check that the slicing syntax is correctly interpreted and that making reasonable slices produces expected results. To fully test the slice syntax, a comprehensive suite of cases is defined. As far as possible, the class is designed to behave like the numpy Python library.
Documentation Impact
A section will need to be added to the eventual ModelArray developer documentation. As this does not yet exist, there is nothing to add as part of this PR.