gridio.h File Reference

#include "grid.h"
#include "offsets.h"
#include "parser.h"
#include "iwave_fopen.h"

Go to the source code of this file.

Defines

#define IWAVE_USE_FMGR

Functions

int fseeko (FILE *stream, off_t offset, int whence)
off_t ftello (FILE *stream)
int read_grid (grid *g, const char *fname, FILE *fp)
 read grid from SEP77/RSF header file
int par_grid (grid *g, PARARRAY par, FILE *fp)
 initialize grid from PARARRAY object
int extend_array (ireal *a, const IPNT rags, const IPNT ran, const IPNT gs, const IPNT n, int dim, int ax)
 extend by constant along axis ax an array of dimension dim defined by (rags,ran), assuming that its subarray defined by defined by (gs,n) has been initialized to correct values.
int adj_extend_array (ireal *a, const IPNT rags, const IPNT ran, const IPNT gs, const IPNT n, int dim, int ax)
 adjoint-extend by constant along axis ax an array of dimension dim defined by (rags,ran) - replaces boundary elements of array by sum over extended axis, elements outside array by zero.
int rsfread (ireal *a, const IPNT gs, const IPNT n, const char *fname, float scale, FILE *fp, int panelindex)
 read data from SEP77/RSF data cube, scale, add to target data cube
int rsfwrite_proto (ireal *a, const IPNT rags, const IPNT ran, const char *fname, const char *dname, const char *type, float scale, const char *protohdr, const char *protodata, const grid *protog, int extend, FILE *fp, int panelindex)
 write array to RSF file structure
int rsfwrite (ireal *a, const IPNT gs, const IPNT n, const char *fname, float scale, FILE *fp, int panelindex)


Define Documentation

#define IWAVE_USE_FMGR

Definition at line 5 of file gridio.h.


Function Documentation

int fseeko ( FILE *  stream,
off_t  offset,
int  whence 
)

off_t ftello ( FILE *  stream  ) 

int read_grid ( grid g,
const char *  fname,
FILE *  fp 
)

read grid from SEP77/RSF header file

Parameters:
[out] g (grid *) - grid to be initialized
[in] fname (char *) - name of RSF header file
[in] fp (FILE *) - verbose output strea
Returns:
0 on success, else nonzero error code (see utils.h)

int par_grid ( grid g,
PARARRAY  par,
FILE *  fp 
)

initialize grid from PARARRAY object

Parameters:
[out] g (grid *) - grid to be initialized
[in] par (PARARRAY) - param array from which to read grid data
[in] fp (FILE *) - verbose output stream
Returns:
0 on success, else nonzero error code (see utils.h)

int extend_array ( ireal a,
const IPNT  rags,
const IPNT  ran,
const IPNT  gs,
const IPNT  n,
int  dim,
int  ax 
)

extend by constant along axis ax an array of dimension dim defined by (rags,ran), assuming that its subarray defined by defined by (gs,n) has been initialized to correct values.

If the subarray is void (i.e. if (rags,ran) does not overlap (gs,n)) or if subarray is the entire array defined by (rags,ran), than this function is a no-op.

Written dimensionally, to avoid offset computations. All axis lengths assumed to be correctly representable as ints. No particular attention paid to efficiency - it is assumed that this routine will be account for an infinitesimal part of the flops of an application.

Parameters:
[out] a (ireal *) - array to be extended
[in] rags (IPNT) - global start indices
[in] ran (IPNT) - global axis lengths
[in] gs (IPNT) - start indices of already initialized subarray
[in] n (IPNT) - axis lengths of already initialized subarray
[in] dim (int) - dimension of grid
[in] ax (int) - axis along which to extend by const
Returns:
0 on success, else nonzero error code (see utils.h)

int adj_extend_array ( ireal a,
const IPNT  rags,
const IPNT  ran,
const IPNT  gs,
const IPNT  n,
int  dim,
int  ax 
)

adjoint-extend by constant along axis ax an array of dimension dim defined by (rags,ran) - replaces boundary elements of array by sum over extended axis, elements outside array by zero.

If the subarray is void (i.e. if (rags,ran) does not overlap (gs,n)) or if subarray is the entire array defined by (rags,ran), than this function is a no-op.

Written dimensionally, to avoid offset computations. All axis lengths assumed to be correctly representable as ints. No particular attention paid to efficiency - it is assumed that this routine will be account for an infinitesimal part of the flops of an application.

Parameters:
[out] a (ireal *) - array to be extended
[in] rags (IPNT) - global start indices
[in] ran (IPNT) - global axis lengths
[in] gs (IPNT) - start indices of already initialized subarray
[in] n (IPNT) - axis lengths of already initialized subarray
[in] dim (int) - dimension of grid
[in] ax (int) - axis along which to extend by const
Returns:
0 on success, else nonzero error code (see utils.h)

int rsfread ( ireal a,
const IPNT  gs,
const IPNT  n,
const char *  fname,
float  scale,
FILE *  fp,
int  panelindex 
)

read data from SEP77/RSF data cube, scale, add to target data cube

Parameters:
[out] a - target cube data array
[in] gs - global indices of target cube axis starts
[in] n - global axis lengths of target cube
[in] fname - name of RSF header file
in[ scale - scale input data by this factor before adding
[in] fp - verbose output unit
[in] panelindex - panel index of extended model (extrenal axes - 0 for models without external exteded axes)
Returns:
0 on success, else nonzero error code (see utils.h)
Preconditions:
  1. pathname fname describes existing SEP77/RSF metadata file, including (n,d,o) grid parameters, "in" key with data file name as value, and "data_format" key with either "native_float" or "xdr_float" as parameters.
  2. RSF data file (value of "in=" key in fname) contains loat data, either native or xdr. No other data types are currently admitted.
Postconditions:
  1. intersection of target and file cubes computed; data in intersection read, scaled, and added to target cube

int rsfwrite_proto ( ireal a,
const IPNT  rags,
const IPNT  ran,
const char *  fname,
const char *  dname,
const char *  type,
float  scale,
const char *  protohdr,
const char *  protodata,
const grid protog,
int  extend,
FILE *  fp,
int  panelindex 
)

write array to RSF file structure

Preconditions:

  1. file describes SEP77/RSF data structure, including (n,d,o) grid parameters, "in" key with data file name as value, and "data_format" key with either "native_float" or "xdr_float" as parameters.
  2. file pointed to by "in=" contains float data, either native or xdr. No other data types are currently admitted. Correct string signifying type (native_float or xdr_float) submitted as arg type.
  3. files must both exist; data file will be overwritten, but header file is left intact. [Major change 19.01.11 WWS]
Postconditions:
  1. intersection of array and file grids computed; data from intersection written from sub-rarray into file sector corresponding to intersection,
Parameters:
[in] a (ireal *) - array to be written
[in] gs (IPNT) - global indices of axis starts
[in] n (IPNT) - global axis lengths
[in] fname (char *) - file to which to write data
[in] extend (int) - extension flag - adjoint-extend along all axes in increasing axis order if set
[in] fp (FILE *) - verbose output parameter
[in] panelindex (int) - panel index of extended model (always be 0 for non-extended model)
Returns:
0 on success, else nonzero error code (see utils.h)

int rsfwrite ( ireal a,
const IPNT  gs,
const IPNT  n,
const char *  fname,
float  scale,
FILE *  fp,
int  panelindex 
)


Generated on 5 Jan 2017 for IWAVEGRID by  doxygen 1.4.7