12#ifndef DESCENDANT_IO_H
13#define DESCENDANT_IO_H
15#include "gadgetconfig.h"
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"
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"
33class descendant_io :
public IO_Def
36 mergertree *MergerTree;
39 descendant_io(mergertree *MergerTree_ptr, MPI_Comm comm,
int format);
41 void mergertree_save_descendants(
int num);
42 void mergertree_read_descendants(
int num);
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,
63 long long TotNsubhalos;
69 long long TotNsubhalos;
72 static void io_func_descsubhalonr(
IO_Def *ptr,
int particle,
int components,
void *buffer,
int mode)
74 descendant_io *thisobj = (descendant_io *)ptr;
78 long long *out_buffer = (
long long *)buffer;
79 out_buffer[0] = thisobj->MergerTree->Descendants[particle].DescSubhaloNr;
85 long long *in_buffer = (
long long *)buffer;
86 thisobj->MergerTree->Descendants[particle].DescSubhaloNr = in_buffer[0];
87 if(thisobj->MergerTree->Descendants[particle].DescSubhaloNr == -1)
88 thisobj->MergerTree->Descendants[particle].DescSubhaloNr =
HALONR_MAX;
92 static void io_func_firstdescsubhalonr(
IO_Def *ptr,
int particle,
int components,
void *buffer,
int mode)
94 descendant_io *thisobj = (descendant_io *)ptr;
98 long long *out_buffer = (
long long *)buffer;
99 out_buffer[0] = thisobj->MergerTree->Descendants[particle].FirstDescSubhaloNr;
105 long long *in_buffer = (
long long *)buffer;
106 thisobj->MergerTree->Descendants[particle].FirstDescSubhaloNr = in_buffer[0];
107 if(thisobj->MergerTree->Descendants[particle].FirstDescSubhaloNr == -1)
108 thisobj->MergerTree->Descendants[particle].FirstDescSubhaloNr =
HALONR_MAX;
112 static void io_func_nextsubhalonr(
IO_Def *ptr,
int particle,
int components,
void *buffer,
int mode)
114 descendant_io *thisobj = (descendant_io *)ptr;
118 long long *out_buffer = (
long long *)buffer;
119 out_buffer[0] = thisobj->MergerTree->Descendants[particle].NextProgSubhaloNr;
125 long long *in_buffer = (
long long *)buffer;
126 thisobj->MergerTree->Descendants[particle].NextProgSubhaloNr = in_buffer[0];
127 if(thisobj->MergerTree->Descendants[particle].NextProgSubhaloNr == -1)
128 thisobj->MergerTree->Descendants[particle].NextProgSubhaloNr =
HALONR_MAX;
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