HNBody Version 1.0.10

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

output.h
Go to the documentation of this file.
1 #ifndef HNBODY_OUTPUT_H
2 #define HNBODY_OUTPUT_H
3
13 #include "hnbody/opts.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 namespace HNBODY {
18 #endif
19
20
22 #define HNB_MAGIC 462639
23
24
26 typedef struct hnb_header_struct {
27 double G, c, M, epoch, tinit, stepsize, rate, offset[HNB_ORDER_MAX];
28 int magic, id, size, ncol, ctype[HNB_ORDER_MAX];
29 hnb_class_t fclass;
30 hnb_format_t format;
31 hnb_coord_t coord;
32 } hnb_header_t;
33
34
35 DLLSPEC extern void
36 hnb_fill_header(hnb_header_t *h, hnb_class_t fclass, hnb_format_t format,
37 hnb_coord_t coord, double epoch, double G, double c, double M,
38 double E0, const double L0[], double tinit, double stepsize, double rate,
39 int id, int digits, const double offset[],
40 const hnb_option_tag order[], int ncol);
41
42 DLLSPEC extern size_t
43 hnb_read_file(double *ddata[], float *fdata[], size_t *nalloc,
44 size_t nkeep, size_t nrec, size_t nresv, int raw,
45 const hnb_header_t *h, FILE *f),
46 hnb_write_file(double *const ddata[], float *const fdata[], size_t nrec,
47 int header, int raw, const hnb_header_t *h, FILE *f);
48
49 DLLSPEC extern int
50 hnb_read_dataline(double data[], hnb_format_t format, int ncol, int size,
51 const double offset[], FILE *f),
52 hnb_read_header(hnb_header_t *h, FILE *f),
53 hnb_seek_file(size_t rec, FILE *f),
54 hnb_tag2ctype(hnb_option_tag tag),
55 hnb_trim_file(const char *datafile, size_t nrec),
56 hnb_write_binary(const double data[], int nelem, int dprec, FILE *f),
57 hnb_write_dataline(const double data[], hnb_class_t fclass,
58 hnb_format_t format, int ncol, int digits, const double offset[], FILE *f),
59 hnb_write_header(const hnb_header_t *h, FILE *f),
60 hnb_write_text(const double data[], int nelem, int digits, FILE *f);
61
62 DLLSPEC extern hnb_option_tag
63 hnb_ctype2tag(int ctype);
64
65 DLLSPEC extern FILE
66 *hnb_fopen(const char *file, const char *mode);
67
68 #ifdef __cplusplus
69 } // namespace HNBODY
70 } // extern "C"
71 #endif
72
73 #endif /* HNBODY_OUTPUT_H */
hnb_header_struct::fclass
hnb_class_t fclass
Output file class.
Definition: output.h:29
hnb_option_tag
enum hnb_option_enum hnb_option_tag
Input (a.k.a. option) file tags.
hnb_coord_t
enum hnb_coord_enum hnb_coord_t
Output file coordinate systems.
opts.h
Enumerations and functions related to HNBody input and output files.
hnb_header_struct::format
hnb_format_t format
Output file format.
Definition: output.h:30
hnb_class_t
enum hnb_class_enum hnb_class_t
Output file classes.
hnb_header_struct::size
int size
sizeof() binary numbers, or digits precision for Text.
Definition: output.h:28
hnb_fopen
DLLSPEC FILE * hnb_fopen(const char *file, const char *mode)
Opens an HNBody output file in a standardized manner.
Definition: output.c:228
HNB_ORDER_MAX
#define HNB_ORDER_MAX
Maximum number of columns allowed in InputOrder, OutputOrder, etc.
Definition: opts.h:28
hnb_header_struct::coord
hnb_coord_t coord
Output file coordinate system.
Definition: output.h:31
hnb_header_t
struct hnb_header_struct hnb_header_t
Output file header data structure.
hnb_format_t
enum hnb_format_enum hnb_format_t
Output file formats.
hnb_write_file
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.
Definition: output.c:1591
hnb_header_struct
Output file header data structure.
Definition: output.h:26
hnb_fill_header
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.
Definition: output.c:464
hnb_header_struct::tinit
double tinit
Tinitial of the integration.
Definition: output.h:27