-
Notifications
You must be signed in to change notification settings - Fork 0
/
snapshot.h
65 lines (57 loc) · 1.58 KB
/
snapshot.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* Copyright (c) 2017 Jose M. Dana
*
* This file is part of gadget_snapshots.
* http://github.com/jmdana/gadget_snapshots
*
* gadget_snapshots is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation (version 3 of the License only).
*
* gadget_snapshots is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with gadget_snapshots. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#define TAG_SIZE 8
#define HEADER_SIZE 256
int SWAP;
int SNAP_FORMAT;
typedef struct {
int size1;
char *data;
int size2;
} block;
typedef struct {
block *tag;
block *data;
} datablock;
typedef struct gadget_header {
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;
} header;
datablock *read_datablock(FILE *src);
int free_datablock(datablock *db);
int write_datablock(FILE *dst, datablock *db);
int print_header(header h);
int snapformat(FILE *f);
int endianness(FILE *f);
header construct_header(datablock *db);
int mass_handler(header h, datablock *db);
int onlygas_handler(header h, datablock *db);
int init_snapshot(FILE *src);