30.01.2013 Views

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

TotalView Users Guide - CI Wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Examining and Analyzing Arrays<br />

This syntax differs from Fortran 90 syntax in that Fortran 90 requires that<br />

you explicitly enter the upper and lower bounds when you’re reversing the<br />

order for displaying array elements.<br />

Because the default value for the stride is 1, you can omit the stride (and<br />

the colon that precedes it) from your definition. For example, the following<br />

two definitions display array elements 0 through 9:<br />

[0:9:1]<br />

[0:9]<br />

If the lower and upper bounds are the same, just use a single number. For<br />

example, the following two definitions tell <strong>TotalView</strong> to display array element<br />

9:<br />

[9:9:1]<br />

[9]<br />

The lower_bound, upper_bound, and stride must be constants. They cannot be expressions.<br />

Example 1 A slice declaration of [::2] for a C or C++ array (with a default lower bound<br />

of 0) tells <strong>TotalView</strong> to display elements with even indices of the array; that<br />

is, 0, 2, 4, and so on. However, if this were defined for a Fortran array<br />

(where the default lower bound is 1), <strong>TotalView</strong> displays elements with odd<br />

indices of the array; that is, 1, 3, 5, and so on.<br />

Example 2 The following figure displays a stride of (::9,::9). This definition displays the<br />

four corners of a ten-element by ten-element Fortran array.<br />

Figure 211: Stride Displaying<br />

the Four Corners of an<br />

Array<br />

Example 3 You can use a stride to invert the order and skip elements. For example, the<br />

following slice begins with the upper bound of the array and displays every<br />

other element until it reaches the lower bound of the array:<br />

(::–2)<br />

Using (::–2) with a Fortran integer(10) array tells <strong>TotalView</strong> to display the<br />

elements 10, 8, 6, 4, and 2.<br />

Example 4 You can simultaneously invert the array’s order and limit its extent to display<br />

a small section of a large array. The following figure shows how to<br />

<strong>TotalView</strong> <strong>Users</strong> <strong>Guide</strong>: version 8.7 335

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!