openfoam/applications/test/List
Mark Olesen 805b76d4b9 ENH: support UList[labelRange] and SubList construction with labelRange
This uses a concept similar to what std::valarray and std::slice do.
A labelRange provides a convenient container for holding start/size
and lends itself to addressing 'sliced' views of lists.
For safety, the operations and constructors restricts the given input range
to a valid addressible region of the underlying list, while the labelRange
itself precludes negative sizes.

The SubList version is useful for patches or other things that have a
SubList as its parameter. Otherwise the UList [] operator will be the
more natural solution. The slices can be done with a labelRange, or
a {start,size} pair.

Examples,
     labelList list1 = identity(20);

     list1[labelRange(18,10)]  = -1;
     list1[{-20,25}] = -2;
     list1[{1000,5}] = -3;

     const labelList list2 = identity(20);
     list2[{5,10}] = -3;  // ERROR: cannot assign to const!
2017-05-01 14:01:09 +02:00
..
Make STYLE: uniform 'Test-' prefix for all applications/test 2010-11-23 16:26:04 +01:00
Test-List.C ENH: support UList[labelRange] and SubList construction with labelRange 2017-05-01 14:01:09 +02:00