Catálogo de publicaciones - libros

Compartir en
redes sociales


Introduction to Programming with Fortran

Ian D. Chivers Jane Sleightholme

Resumen/Descripción – provisto por la editorial

No disponible.

Palabras clave – provistas por la editorial

No disponibles.

Disponibilidad
Institución detectada Año de publicación Navegá Descargá Solicitá
No detectada 2006 SpringerLink

Información

Tipo de recurso:

libros

ISBN impreso

978-1-84628-053-5

ISBN electrónico

978-1-84628-054-2

Editor responsable

Springer Nature

País de edición

Reino Unido

Fecha de publicación

Información sobre derechos de publicación

© Springer-Verlag London Limited 2006

Tabla de contenidos

Whole Array and Additional Array Features

Ian D. Chivers; Jane Sleightholme

We can now perform operations on whole arrays and partial arrays (array sections) without having to refer to individual elements. This shortens program development time and greatly clarifies the meaning of programs.

Array constructors can be used to assign values to rank 1 arrays within a program unit. The RESHAPE function allows us to assign values to a two or higher rank array when used in conjunction with an array constructor.

We have introduced the concept of a deferred-shape array. Arrays do not need to have their shape specified at compile time, only their rank. Their actual shape is deferred until runtime. We achieve this by the combined use of the ALLOCATABLE attribute on the variable declaration and the ALLOCATE statement, which makes Fortran a very flexible language for array manipulation.

Pp. 133-149

Output of Results

Ian D. Chivers; Jane Sleightholme

You have been introduced in this chapter to the use of format or layout descriptors which will give you greater control over output.

The main features are:

Output can be directed to files as well as to the terminal through the WRITE statement.

The WRITE, together with the OPEN and CLOSE statements, also introduces the class of Fortran statements which use equated keywords, as well as positionally dependent parameters.

The FORMAT statement and its associated layout or edit descriptor are powerful and allow repetition of patterns of output (both explicitly and implicitly).

When output is to be directed to a line printer, the following four characters:

allow reasonable control over the layout. Care must to be taken with these characters, since it is possible to decimate forests with little effort.

Pp. 151-178

Reading in Data

Ian D. Chivers; Jane Sleightholme

Values may be read in from the keyboard, terminal or from another file through fixed formats.

Much of the structure of input format statements is very similar to that of the output formats. Broadly speaking, data written out in a particular format may be read in by the same format. However, there is greater flexibility, and quite a variety of forms can be accepted on input.

A key distinction to make is the interpretation of blanks, as either nulls or zeros; alternative interpretations can radically alter the structure of the input data.

Fortran allows file names to be associated with unit numbers through the OPEN statement. This statement allows control of the interpretation of blanks, although this can also be done through the BN and BZ formats.

Files can also be manipulated through REWIND and BACKSPACE.

Pp. 179-194

Files

Ian D. Chivers; Jane Sleightholme

The file is a fundamental entity within the operating system.

A file may be manipulated in Fortran by associating its name with a unit number. All subsequent communication within the program is through the unit number.

When a file is opened there are a large number of equatable keywords which may be employed to establish its characteristics.

The default file type used in Fortran is , but several other esoteric types may be used.

Pp. 195-202

Functions

Ian D. Chivers; Jane Sleightholme

The following are some practical rules and guidelines:

Pp. 203-222

Control Structures

Ian D. Chivers; Jane Sleightholme

We can now perform operations on whole arrays and partial arrays (array sections) without having to refer to individual elements. This shortens program development time and greatly clarifies the meaning of programs.

Array constructors can be used to assign values to rank 1 arrays within a program unit. The RESHAPE function allows us to assign values to a two or higher rank array when used in conjunction with an array constructor.

We have introduced the concept of a deferred-shape array. Arrays do not need to have their shape specified at compile time, only their rank. Their actual shape is deferred until runtime. We achieve this by the combined use of the ALLOCATABLE attribute on the variable declaration and the ALLOCATE statement, which makes Fortran a very flexible language for array manipulation.

Pp. 223-240

Characters

Ian D. Chivers; Jane Sleightholme

Characters represent a different data type to any other in Fortran, and as a consequence there is a restricted range of operations which may be carried out on them.

A character variable has a length which must be assigned in a CHARACTER declaration statement.

Character strings are delimited by apostrophes (’) or quotation marks (“). Within a character string, the blank is a significant character.

Character strings may be joined together (concatenated) with the // operator.

Substrings occurring within character strings may be also be manipulated. There are a number of functions especially for use with characters:

Pp. 241-252

Complex

Ian D. Chivers; Jane Sleightholme

COMPLEX is used to store and manipulate complex numbers: those with a real and an imaginary part.

There are standard functions which allow conversion between the numerical data types — CMPLX, REAL and INT.

Pp. 253-256

Logical

Ian D. Chivers; Jane Sleightholme

Another type of data — logical — is also recognised. A LOGICAL variable may take one of two values — or .

Pp. 257-262

User Defined Types

Ian D. Chivers; Jane Sleightholme

There are no compilers at this time that fully support the above. We hope this has whetted your appetite for what will be possible in the future with Fortran 2003 conformant compilers.

Pp. 263-268