Table of Contents


common - access routines for high speed I/O common blocks


set_common(cid, byte_size)int cid, byte_size;
int get_common(cid, elt_size,
bucket_size)int cid, elt_size, bucket_size;
byte *open_common(cid)int cid;
Descriptioncommon provide a set of simple interface routines to safely
define and access a common block in memory which can be used for high speed
I/O operations. A common block can be useful to prevent frequent allocation
and de-allocation of memory in a long serialized  operation, or to prevent
allocating large buffers when multi-dimensional data need to be transposed
between disk and memory (see e.g. Iget_snap(3NEMO)). Although a common block
will have a default size (commonly 1024 bytes), one can re-define its size
with set_common(cid, byte_size), with cid the common id (any non-zero integer
up to a maximum define by the library code), and byte_size the size of
the common in bytes. 
The address of a common block can be obtained with
 open_common(cid), however, it is often useful how many buckets of a certain
size fit in this common block.  get_common(cid, elt_size, bucket_size) will
return this. 
Finally, close_common(cid) should be called to free the common
for subsequent use. 
ExamplesHere is some code to transfer data from a large
array to a small array using random access I/O routines: 
    int n;
    float *fp;
    set_common(0, 8196);
    n = get_common(0, sizeof(float), nx);
    fp = open_common(0);


The common id (cid) is not used yet, just one "blank" common can be defined.


Peter Teuben

See Also


Update History

7-jan-99    developed for get_snap/put_snap                  PJT

Table of Contents