HNBody  Version 1.0.10
Data Structures | Macros | Typedefs | Functions
output.h File Reference

Facilities to manipulate HNBody output files. More...

#include "hnbody/opts.h"
Include dependency graph for output.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hnb_header_struct
 Output file header data structure. More...
 

Macros

#define HNB_MAGIC   462639
 Magic number identifying HNBody output files (think 1-800-HNBODY).
 

Typedefs

typedef struct hnb_header_struct hnb_header_t
 Output file header data structure.
 

Functions

DLLSPEC void hnb_fill_header (hnb_header_t *h, hnb_class_t fclass, hnb_format_t format, hnb_coord_t coord, double epoch, double G, double c, double M, double E0, const double L0[], double tinit, double stepsize, double rate, int id, int digits, const double offset[], const hnb_option_tag order[], int ncol)
 Fills a header structure with specific values. More...
 
DLLSPEC size_t hnb_read_file (double *ddata[], float *fdata[], size_t *nalloc, size_t nkeep, size_t nrec, size_t nresv, int raw, const hnb_header_t *h, FILE *f)
 
DLLSPEC size_t hnb_write_file (double *const ddata[], float *const fdata[], size_t nrec, int header, int raw, const hnb_header_t *h, FILE *f)
 Writes data arrays to an HNBody output file. More...
 
DLLSPEC int hnb_read_dataline (double data[], hnb_format_t format, int ncol, int size, const double offset[], FILE *f)
 
DLLSPEC int hnb_read_header (hnb_header_t *h, FILE *f)
 
DLLSPEC int hnb_seek_file (size_t rec, FILE *f)
 
DLLSPEC int hnb_tag2ctype (hnb_option_tag tag)
 
DLLSPEC int hnb_trim_file (const char *datafile, size_t nrec)
 
DLLSPEC int hnb_write_binary (const double data[], int nelem, int dprec, FILE *f)
 
DLLSPEC int hnb_write_dataline (const double data[], hnb_class_t fclass, hnb_format_t format, int ncol, int digits, const double offset[], FILE *f)
 
DLLSPEC int hnb_write_header (const hnb_header_t *h, FILE *f)
 
DLLSPEC int hnb_write_text (const double data[], int nelem, int digits, FILE *f)
 
DLLSPEC hnb_option_tag hnb_ctype2tag (int ctype)
 
DLLSPEC FILE * hnb_fopen (const char *file, const char *mode)
 Opens an HNBody output file in a standardized manner. More...
 

Detailed Description

Id
output.h,v 1.8 2004/02/04 23:19:15 rauch Exp
Author
Kevin P. Rauch

Function Documentation

DLLSPEC void hnb_fill_header ( hnb_header_t h,
hnb_class_t  fclass,
hnb_format_t  format,
hnb_coord_t  coord,
double  epoch,
double  G,
double  c,
double  M,
double  E0,
const double  L0[],
double  tinit,
double  dz,
double  rate,
int  id,
int  digits,
const double  offset[],
const hnb_option_tag  order[],
int  ntags 
)
DLLSPEC FILE* hnb_fopen ( const char *  file,
const char *  mode 
)

This method is similar to fopen() except that error handling is built in. In addition, binary mode is always enabled on the stream, and the special file name "-" is interpreted as stdin or stdout as appropriate. The returned stream is generic and should be closed with fclose() as usual.

Note
The call will not return if the open fails.
Parameters
fileis the name of the file to open
modeis the read/write mode setting
Returns
A valid file stream.
DLLSPEC size_t hnb_write_file ( double *const  ddata[],
float *const  fdata[],
size_t  nrec,
int  header,
int  raw,
const hnb_header_t h,
FILE *  f 
)

This method writes a specified number of records to an open stream, optionally preceded by a standard HNBody output header. Either single or double precision data columns can be supplied and will be converted to the appropriate output format (double precision takes precedence).

Parameters
ddatais the array of data columns to output (double precision format; set to NULL if unavailable).
fdatais the array of data columns to output (single precision format; set to NULL if unavailable).
nrecis the number of data records to output.
headeris non-zero if and only if an HNBody file header should be written.
rawis non-zero if and only if SMARTFLOAT offsets have already been subtracted from the input data columns (meaningful only for SMARTFLOAT output format).
his the header corresponding the file f.
fis a stream pointing to HNBody output file records.
Returns
The number of records successfully written.

References hnb_header_struct::fclass, hnb_header_struct::format, HNB_ORDER_MAX, hnb_header_struct::ncol, hnb_header_struct::offset, and hnb_header_struct::size.