GADGET-4
io_readsnap.h
Go to the documentation of this file.
1/*******************************************************************************
2 * \copyright This file is part of the GADGET4 N-body/SPH code developed
3 * \copyright by Volker Springel. Copyright (C) 2014-2020 by Volker Springel
4 * \copyright (vspringel@mpa-garching.mpg.de) and all contributing authors.
5 *******************************************************************************/
6
12#ifndef READSNAP_IO_H
13#define READSNAP_IO_H
14
15#include "gadgetconfig.h"
16
17#ifdef MERGERTREE
18
19#include "../data/allvars.h"
20#include "../data/dtypes.h"
21#include "../data/mymalloc.h"
22#include "../fof/fof.h"
23#include "../io/hdf5_util.h"
24#include "../io/io.h"
25#include "../logs/timer.h"
26#include "../main/simulation.h"
27#include "../mergertree/mergertree.h"
28#include "../mpi_utils/mpi_utils.h"
29#include "../sort/parallel_sort.h"
30#include "../subfind/subfind.h"
31#include "../system/system.h"
32
33class readsnap_io : public IO_Def
34{
35 private:
36 mergertree *MergerTree;
37
38 public:
39 readsnap_io(mergertree *MergerTree_ptr, MPI_Comm comm, int format);
40
41 void mergertree_read_snap_ids(int num);
42
43 /* supplied virtual functions */
44 void fill_file_header(int writeTask, int lastTask, long long *nloc_part, long long *npart);
45 void read_file_header(const char *fname, int filenr, int readTask, int lastTask, long long *nloc_part, long long *npart,
46 int *nstart);
47 void get_datagroup_name(int grnr, char *gname);
48 void write_header_fields(hid_t);
49 void read_header_fields(const char *fname);
50 void read_increase_numbers(int type, int n_for_this_task);
51 int get_filenr_from_header(void);
52 void set_filenr_in_header(int);
53 void *get_base_address_of_structure(enum arrays array, int index);
54 int get_type_of_element(int index);
55 void set_type_of_element(int index, int type);
56
59#ifdef GADGET2_HEADER
60 struct io_header
61 {
62 int npart[NTYPES_HEADER];
63 double mass[NTYPES_HEADER];
65 double time;
66 double redshift;
67 int flag_sfr;
68 int flag_feedback;
69 unsigned int npartTotalLowWord[NTYPES_HEADER];
71 int flag_cooling;
72 int num_files;
73 double BoxSize;
74 double Omega0;
75 double OmegaLambda;
76 double HubbleParam;
77 double Hubble;
78 unsigned int npartTotalHighWord[NTYPES_HEADER];
79 int flag_entropy_instead_u;
80 int flag_doubleprecision;
81 int flag_ic_info;
89 float lpt_scalingfactor;
90 long long npartTotal[NTYPES_HEADER];
91 };
92 io_header header;
93#else
94
95 /* new simplified header */
96 struct io_header
97 {
98 long long npart[NTYPES_HEADER];
99 long long npartTotal[NTYPES_HEADER];
100 double mass[NTYPES_HEADER];
102 double time;
103 double redshift;
104 double BoxSize;
105 int num_files;
106 };
107 io_header header;
109#endif
110};
111
112#endif
113
114#endif /* READSNAP_IO_H */
Definition: io.h:129
virtual int get_filenr_from_header(void)=0
virtual void * get_base_address_of_structure(enum arrays array, int index)=0
virtual void set_type_of_element(int index, int type)=0
virtual void read_increase_numbers(int type, int n_for_this_task)=0
virtual void fill_file_header(int writeTask, int lastTask, long long *nloc_part, long long *npart)=0
virtual void read_header_fields(const char *fname)=0
virtual void read_file_header(const char *fname, int filenr, int readTask, int lastTask, long long *nloc_part, long long *npart, int *nstart)=0
virtual void set_filenr_in_header(int)=0
virtual void write_header_fields(hid_t)=0
virtual void get_datagroup_name(int grnr, char *gname)=0
virtual int get_type_of_element(int index)=0
arrays
Definition: io.h:30
#define NTYPES_HEADER
Definition: io.h:268