Next: 4.2 Programming
Up: 4 Data Structures
Prev: 4 Data Structures
Index
Contents
Calling a module generally has the form:
CALL MODULE(M, NF1, NI1, NF2, NI2, ...)
In this manner, each DS is referenced by two integers, NF and NI, where:
Furthermore, certain utilities may be called from outside the modules: IMtysd, NOFOSD, and TUERSD.
This section investigates these different notions.
This section describes the cases
NF = 0 and
NF , and then gives some indications regarding the options to choose from.
Conventionally, NF = 0 signifies that the DS resides in main memory.
In particular,
Conventionally, NF signifies that the DS resides in secondary memory (disk file).
In particular,
The sign of NF specifies the access mode:
NF > 0 for a sequential access file,
NF < 0 for a direct access file.
( For a direct access ODS, first call utility
DEFDIR (p.
).)
Certain modules offer a choice between two access modes in this manner, but the majority
only accepts sequential access.
In all cases, the absolute value |NF| corresponds to the file unit number. The file must be previously opened by a call to OUVRIR or OUVRIS (section 1.6).
Whatever the file number NF may be, a DS must be present in main memory to be manipulated.
The DS is identified by its level number, an integer between 0 and 36. ( This limitation is due to utility
NUMALP (p.
).)
The aim is to obtain a mesh of disc D by "gluing together" the three sectors, A, B and C (figure 4.1).
Figure 4.1: Disc D formed by three sectors A, B and C
The three sectors, A, B and C, and the disc, D, to be created are described by a NOPO type DS.
Assume that the corresponding files with numbers, NFA, NFB, NFC and NFD respectively,
are already open.
Assume also that a module, called RECOL,( The
actual MODULEF module used for "gluing together" meshes is called RECOLC
and needs a larger number of parameters.)
"glues together" the meshes contained in two IDS, X and Y,
and creates an ODS Z:
SUBROUTINE RECOL(M, NFX, NIX, NFY, NIY, NFZ, NIZ)
A solution is to read DS A with level 1, and DS B with level 2, and to create a DS with level 3 by "gluing together" A and B. The result is then "glued together" with DS C with level 4, thus creating the DS D sought, with level 5:
...CALL RECOL(M, NFA, 1, NFB, 2, 0, 3)
CALL RECOL(M, 0, 3, NFC, 4, NFD, 5)
...
After these two calls, five DS reside simultaneously in main memory,
referenced by their level numbers 1 to 5. If the size of the super-array
is insufficient, it is preferable to delete the DS that become unnecessary
(utility TUERSD, p. ):
...CALL RECOL(M, NFA, 1, NFB, 2, 0, 3)
CALL TUERSD(..., 1, ...)
CALL TUERSD(..., 2, ...)
CALL RECOL(M, 0, 3, NFC, 4, NFD, 5)
...
In fact, the level number only serves to distinguish between two DS of the same type: if two DS of different types reside simultaneously in main memory, they may have the same level numbers.
Therefore, in the preceding example, the DS are of the same type: NOPO. It is possible to use a DS MAIL with the same level (1 to 5) in the same program.
Many modules allow us to give the same level number to an IDS and an ODS of the same type. In this case, the IDS is killed and replaced by the ODS.
The user can print a DS ( IMtysd), format a DS ( NOFOSD), or free the space in memory ( TUERSD).
The notation used for the utilities below |
is the usual notation (see Appendix A). |
SUBROUTINE IMtysd(,
,
,
)
INTEGER M(*), NF, NI, IMPRE
This utility prints the contents of the arrays of a DS, where IMPRE is the print parameter from 0 to 10:
Processor IMAGXX determines the DS type and calls the appropriate printing utility ( IMNOPO, IMMUA, IMB, ...).
SUBROUTINE NOFOSD(,
,
,
,
,
,
)
INTEGER M(*)
REAL XM(*)
DOUBLE PRECISION DM(*)
INTEGER NF1, NF2, NI, NOPT
In general, the DS are saved on "unformatted"( Fortran keyword: UNFORMATTED,
i.e. binary.) files rather than "formatted"(
Fortran keyword: FORMATTED,
i.e. ASCII.).
This choice is more efficient, but may pose problems when the same file
is used by different computers
(for example: a work station for the pre- and post-processing, and
a super-computer for computation).
The solution adopted consists of using intermediate files which are formatted. More precisely, to transfer a DS from computer A to computer B which is incompatible with A, the following steps must be followed:
The formatting and unformatting operations are performed by preprocessor
[4] NOFOXX, which calls utility NOFOSD:
SUBROUTINE TUERSD(,
,
,
)
INTEGER M(*), NI, NOPT
CHARACTER*4 TYSD
This utility frees the memory space occupied by a DS.