cosmotool/load_data.h

85 lines
1.6 KiB
C
Raw Normal View History

2008-12-02 18:00:28 +01:00
#ifndef _LOAD_GADGET_DATA_H
#define _LOAD_GADGET_DATA_H
typedef struct io_header_1
{
int npart[6];
double mass[6];
double time;
double redshift;
int flag_sfr;
int flag_feedback;
int npartTotal[6];
int flag_cooling;
int num_files;
double BoxSize;
double Omega0;
double OmegaLambda;
double HubbleParam;
char fill[256- 6*4- 6*8- 2*8- 2*4- 6*4- 2*4 - 4*8]; /* fills to 256 Bytes */
} GadgetHeader;
typedef struct particle_data
{
float Pos[3];
float Init[3];
float Vel[3];
float VelInit[3];
float Mass;
int Type;
float Rho, U, Temp, Ne;
int Id;
} ParticleState;
typedef struct {
GadgetHeader header;
ParticleState *particles;
int NumPart;
int ntot_withmasses;
} GadgetData;
typedef struct {
int Ntypes;
float BoxSize;
float RedShift;
char header[256 - 4 - 2*4];
} ParticleSetHeader;
typedef struct {
ParticleSetHeader header;
// Particle description
int *Npart;
ParticleState **particles;
} ParticleSet;
typedef float FCoordinates[3];
typedef struct {
unsigned int NumPart;
double BoxSize;
FCoordinates *pos;
} PurePositionData;
#ifdef __cplusplus
extern "C" {
#endif
void writeGadget(GadgetData *data, const char *fname);
GadgetData *loadGadget(const char *fname);
void freeGadget(GadgetData *data);
GadgetData *loadSimulationData(const char *fname);
GadgetData *loadHydra(const char *fname);
void writePersoSet(ParticleSet *set, const char *fname);
ParticleSet *loadPersoSet(const char *fname);
void freePersoSet(ParticleSet *set);
#ifdef __cplusplus
}
#endif
#endif