GADGET-4
subfind_readid_io.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 SUBREADID_IO_H
13 #define SUBREADID_IO_H
14 
15 #include "gadgetconfig.h"
16 
17 #ifdef SUBFIND_ORPHAN_TREATMENT
18 
19 #include "../data/allvars.h"
20 #include "../data/dtypes.h"
21 #include "../data/mymalloc.h"
22 #include "../data/particle_data.h"
23 #include "../fof/fof.h"
24 #include "../io/hdf5_util.h"
25 #include "../io/io.h"
26 #include "../logs/timer.h"
27 #include "../main/simulation.h"
28 #include "../mergertree/mergertree.h"
29 #include "../mpi_utils/mpi_utils.h"
30 #include "../sort/parallel_sort.h"
31 #include "../subfind/subfind.h"
32 #include "../system/system.h"
33 
34 class subreadid_io : public IO_Def
35 {
36  private:
37  idstoredata *IdStore;
38 
39  public:
40  subreadid_io(idstoredata *IdStore_ptr, MPI_Comm comm, int format);
41 
42  void previously_bound_read_snap_ids(int num);
43 
44  /* supplied virtual functions */
45  void fill_file_header(int writeTask, int lastTask, long long *nloc_part, long long *npart);
46  void read_file_header(const char *fname, int filenr, int readTask, int lastTask, long long *nloc_part, long long *npart,
47  int *nstart);
48  void get_datagroup_name(int grnr, char *gname);
49  void write_header_fields(hid_t);
50  void read_header_fields(const char *fname);
51  void read_increase_numbers(int type, int n_for_this_task);
52  int get_filenr_from_header(void);
53  void set_filenr_in_header(int);
54  void *get_base_address_of_structure(enum arrays array, int index);
55  int get_type_of_element(int index);
56  void set_type_of_element(int index, int type);
57 
60 #ifdef GADGET2_HEADER
61  struct io_header
62  {
63  int npart[NTYPES_HEADER];
64  double mass[NTYPES_HEADER];
66  double time;
67  double redshift;
68  int flag_sfr;
69  int flag_feedback;
70  unsigned int npartTotal[NTYPES_HEADER];
72  int flag_cooling;
73  int num_files;
74  double BoxSize;
75  double Omega0;
76  double OmegaLambda;
77  double HubbleParam;
78  double Hubble;
79  unsigned int npartTotalHighWord[NTYPES_HEADER];
80  int flag_entropy_instead_u;
81  int flag_doubleprecision;
82  int flag_ic_info;
90  float lpt_scalingfactor;
91  char fill[48];
92  };
93  io_header header;
94 #else
95 
96  /* new simplified header */
97  struct io_header
98  {
99  long long npart[NTYPES_HEADER];
100  long long npartTotal[NTYPES_HEADER];
101  double mass[NTYPES_HEADER];
103  double time;
104  double redshift;
105  double BoxSize;
106  int num_files;
107  };
108  io_header header;
110 #endif
111 };
112 
113 #endif
114 
115 #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