[Top] [Prev] [Next] [Bottom]

DFSDputslice/dspslc

intn DFSDputslice(int32 windims[], VOIDP source, int32 dims[])
windims

IN:

Window dimensions specifying the size of the slice to be written

source

IN:

Buffer for the slice

dims

IN:

Dimensions of the source array

Purpose

Writes part of a scientific dataset to a file.

Return value

Returns SUCCEED (or 0) if successful and FAIL (or -1) otherwise.

Description

DFSDputslice read a subset of an array in memory and stores it as part of the scientific dataset array last specified by DFSDsetdims. Slices must be stored contiguously.

Array windims ("window dimensions") specifies the size of the slice to be written. The windims array must contain as many elements as there are dimensions in the entire scientific dataset array. The source argument is an array in memory containing the slice and dims is an array containing the dimensions of the array source.

Notice that windims and dims need not be the same. The windims argument could refer to a sub-array of source, in which case only a portion of source is written to the scientific data array.

All parameters assume Fortran-77-style one-based arrays.

DFSDputslice is obsolete in favor of DFSDwriteslab. DFSDwriteslab is the recommended function call to use when writing hyperslabs (previously known as data slices). HDF will continue to support DFSDputslice only to maintain backward compatibility withearlier versions of the library.

Example

Suppose we want to create a 7 x 12 scientific dataset array, and we want to write it using slices. Suppose also that the array from which we get our data is a 10 x 12 array in memory called source, and we want to write the 7 x 12 "window" from top of that array. The following example will do this.

     intn rank;
     int SDSdims[2], sourcedims[2], windims[2];
     float data[10][12];

     /*code that builds the array source goes here */
     ...

     SDSdims[0]=7;
     SDSdims[1]=12;
     sourcedims[0]=10;
     sourcedims[1]=12;

     DFSDsetdims(2, SDSdims);

     /*write out scientific dataset in slices */

     DFSDstartslice(filename);

     windims[0]=2;
     windims[1]=12; /* {(1,1) to (2,12)} */
     DFSDputslice(windims, &data[0][0], sourcedims);

     windims[0]=4;
     windims[1]=12; /* {(3,1) to (6,12)} */
     DFSDputslice(windims, &data[2][0], sourcedims);

     windims[0]=1;
     windims[1]=4; /* {(7,1) to (7,4)} */
     DFSDputslice(windims, &data[6][0], sourcedims);

     windims[0]=1;
     windims[1]=8; /* {(7,5) to (7,12)} */
     DFSDputslice(windims, &data[6][4], sourcedims);

     windims[0]=3;
     windims[1]=12; /* {(8,1) to (10,12)} */
     DFSDputslice(windims, &data[7][0], sourcedims);

     DFSDendslice();
 
FORTRAN

integer function dspslc(windims, source, dims)

integer windims(*), dims(*), source(*)



[Top] [Prev] [Next] [Bottom]

hdfhelp@ncsa.uiuc.edu
HDF User's Reference Manual, Draft 06/09/97, NCSA HDF Development Group.