next up previous
Next: TEMPORARY OBJECTS
Up: HDS Hierarchical Data System
Previous: COPYING AND DELETING OBJECTS

SUBSETS OF OBJECTS  

The routine DAT_CELL accesses a single element of an array (an example was shown in §[*]). The routine DAT_SLICE accesses a subset of an arbitrarily dimensioned object. This subset can then be treated for most purposes as if it were an object in its own right. For example:

      ...
      CHARACTER * ( DAT__SZLOC ) SLICE
      INTEGER LOWER( 2 ), UPPER( 2 )
      DATA LOWER / 100, 100 /
      DATA UPPER / 200, 200 /

*  Get a locator to the subset DATA_ARRAY(100:200,100:200).
      CALL DAT_FIND( NLOC, 'DATA_ARRAY', LOC, STATUS )
      CALL DAT_SLICE( LOC, 2, LOWER, UPPER, SLICE, STATUS )

*  Map the subset as a vector.
      CALL DAT_MAPV( SLICE, '_REAL', 'UPDATE', PNTR, EL, STATUS )
      ...

In contrast to DAT_SLICE, DAT_ALTER makes a permanent change to a non-scalar object. The object can be made larger or smaller, but only the last dimension can be ALTERed. This function is entirely dynamic, i.e. can be done at any time provided that the object is not mapped for access. Note that DAT_ALTER works on both primitives and structures. It is important to realise that the number of dimensions cannot be changed by DAT_ALTER.



next up previous
Next: TEMPORARY OBJECTS
Up: HDS Hierarchical Data System
Previous: COPYING AND DELETING OBJECTS

HDS Hierarchical Data System
Starlink User Note 92
R.F. Warren-Smith & M.D. Lawden
23rd February 1999
E-mail:rfws@star.rl.ac.uk

Copyright (C) 1999 Central Laboratory of the Research Councils