10.07.2015 Views

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

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

<strong>Fortran</strong> Data Types‣ For an allocatable variable, the value of a deferred type parameter is determined byallocation - either by a typed allocation, or by an intrinsic assignment with automaticreallocation.‣ For a pointer, the value of a deferred type parameter is the value of the type parameter of itstarget.2.5.1. Typed AllocationA length type parameter that is deferred has no defined value until it is given one by theALLOCATE statement or by pointer assignment. <strong>The</strong>re are a couple rules that apply with typedallocation and deferred type parameters:‣ If the length parameters of an item being allocated is assumed, it must be specified as anasterisk (*) in the type-spec of the ALLOCATE statement.‣ Since there can only be one type-spec in an ALLOCATE statement, it must be suitable for allthe items being allocated. For example, if any of the allocatable items is a dummy argument,then they must all be dummy arguments.2.6. ArraysArrays in <strong>Fortran</strong> are not data types, but are data objects of intrinsic or derived type with specialcharacteristics. A dimension statement provides a data type with one or more dimensions. <strong>The</strong>reare several differences between <strong>Fortran</strong> 2003 and traditional FORTRAN 77 arrays.<strong>Fortran</strong> 2003 supports all FORTRAN 77 array semantics.An array is a group of consecutive, contiguous storage locations associated with a symbolicname which is the array name. Each individual element of storage, called the array element,is referenced by the array name modified by a list of subscripts. Arrays are declared with typedeclaration statements, DIMENSION statements and COMMON statements; they are not definedby implicit reference. <strong>The</strong>se declarations will introduce an array name and establish the numberof dimensions and the bounds and size of each dimension. If a symbol, modified by a list ofsubscripts is not defined as an array, then it will be assumed to be a FUNCTION reference withan argument list.<strong>Fortran</strong> 2003 arrays are ‘objects’ and operations and expressions involving arrays may apply toevery element of the array in an unspecified order. For example, in the following code, where Aand B are arrays of the same shape (conformable arrays), the following expression adds six toevery element of B and assigns the results to the corresponding elements of A:A = B + 6<strong>Fortran</strong> arrays may be passed with unspecified shapes to subroutines and functions, and sectionsof arrays may be used and passed as well. Arrays of derived type are also valid. In addition,allocatable arrays may be created with deferred shapes (number of dimensions is specified atdeclaration, but the actual bounds and size of each dimension are determined when the array isallocated while the program is running).<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 25

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

Saved successfully!

Ooh no, something went wrong!