Slice Definitions
A slice definition has the following form:
lower_bound:upper_bound:stride
This tells TotalView to display every stride element of the array, starting at the lower_bound and continuing through the upper_bound, inclusive. (A stride tells TotalView that it should skip over elements and not display them.)
For example, if you specified a slice of [0:9:9] for a 10-element C array, TotalView displays the first element and last element, which is the ninth element beyond the lower bound.
If a slice is defined as [lb:ub:stride], TotalView represents the set of values of i generated by the append statements in the following way:
i = lb
if (stride > 0)
while ( i <= ub )
append i
i = i + stride
else
while ( i >= ub )
append i
i = i + stride
If stride < 0 and ub > lb, TotalView treats the slice as if it were:
[ub : lb : stride]
(This is an extension to the way Fortran displays slices.) Consequently, TotalView lets you view a dimension with reversed indexing. For example, the following definition tells TotalView to display an array beginning at its last value and moving to its first:
[::-1]
In contrast, Fortran 90 requires that you explicitly enter the upper and lower bounds when you are reversing the order in which it displays array elements.
Because the default value for the stride is 1, you can omit the stride (and the colon that precedes it) if your stride value is 1. For example, the following two definitions display array elements 0 through 9:
[0:9:1]
[0:9]
If the lower and upper bound are the same number, you can specify the slice with just a single number. This number indicates the lower and upper bound. For example, the following two definitions tell TotalView to display array element 9:
[9:9:1]
[9]
Note: The lower_bound, upper_bound, and stride can only be constants.
Here is how you specify a slice for each dimension in a multidimensional array:
C and C++:
[slice][slice]...
Fortran:
(slice,slice,...)
Example 1
A slice declaration of [::2] for a C or C++ array (with a default lower bound of 0) tells TotalView to display elements with even indices of the array: 0, 2, 4, and so on. However, if this were defined for a Fortran array (with a default lower bound of 1), TotalView displays elements with odd indices of the array: 1, 3, 5, and so on.
Example 2
The following example displays a slice of (::9,::9). This definition displays the four corners of a 10-element by 10-element Fortran array.
Slice Displaying the Four Corners of an Array 
|
Example 3
You can use a stride to invert the order and skip elements. For example, here is a slice that begins with the upper bound of the array and display every other element until it reaches the lower bound of the array: (::-2). Thus, using (::-2) with a Fortran integer(10) array tells TotalView to displays the following elements:
(10)
(8)
(6)
...
Example 4
You can simultaneously invert the array's order and limit its extent to display a small section of a large array. The following example specifies a (2:3,7::-1) slice with an integer*4(-1:5,2:10) Fortran array:
Fortran Array with Inverse Order and Limited Extent 
|
After you enter this slice value, TotalView only shows elements in rows 2 and 3 of the array, beginning with column 10 and ending with column 7.