15#include "gadgetconfig.h"
17#if defined(LIGHTCONE) && defined(LIGHTCONE_PARTICLES)
19#include "../data/intposconvert.h"
20#include "../data/lcparticles.h"
22#include "../lightcone/lightcone.h"
23#include "../mergertree/mergertree.h"
25class lightcone_particle_io :
public IO_Def
29 lightcone_particle_io(lcparticles *Lp_ptr, lightcone *LightCone_ptr, mergertree *MergerTree_ptr, MPI_Comm comm,
int format);
31 lightcone_particle_io(lcparticles *Lp_ptr, lightcone *LightCone_ptr, MPI_Comm comm,
int format);
34 void lightcone_save(
int num,
int conenr,
bool reordered_flag);
35 void lightcone_read(
int num,
int conenr);
38 void fill_file_header(
int writeTask,
int lastTask,
long long *nloc_part,
long long *npart);
39 void read_file_header(
const char *fname,
int filenr,
int readTask,
int lastTask,
long long *nloc_part,
long long *npart,
56 long long npartTotal[
NTYPES];
72 mergertree *MergerTree;
77 long long ntot_type_all[
NTYPES];
83 static void io_func_pos(
IO_Def *ptr,
int particle,
int components,
void *buffer,
int mode)
86 lightcone_particle_io *thisobj = (lightcone_particle_io *)ptr;
93 thisobj->Lp->signedintpos_to_pos((
MySignedIntPosType *)thisobj->Lp->P[particle].IntPos, xyz);
95 for(
int k = 0; k < 3; k++)
96 out_buffer[k] = xyz[k];
107 for(
int k = 0; k < 3; k++)
108 xyz[k] = in_buffer[k];
111 thisobj->Lp->pos_to_signedintpos(xyz, (
MySignedIntPosType *)thisobj->Lp->P[particle].IntPos);
115#if defined(LIGHTCONE_OUTPUT_ACCELERATIONS) && defined(OUTPUT_ACCELERATIONS_IN_HALF_PRECISION)
116 static void io_func_accel(
IO_Def *ptr,
int particle,
int components,
void *buffer,
int mode)
118 lightcone_particle_io *thisobj = (lightcone_particle_io *)ptr;
123 for(
int k = 0; k < 3; k++)
129 for(
int k = 0; k < components; k++)
135 static void io_func_id(
IO_Def *ptr,
int particle,
int components,
void *buffer,
int mode)
137 lightcone_particle_io *thisobj = (lightcone_particle_io *)ptr;
142 out_buffer[0] = thisobj->Lp->P[particle].ID.get();
147 thisobj->Lp->P[particle].ID.set(in_buffer[0]);
151 static void io_func_mass(
IO_Def *ptr,
int particle,
int components,
void *buffer,
int mode)
153 lightcone_particle_io *thisobj = (lightcone_particle_io *)ptr;
158 out_buffer[0] = thisobj->Lp->P[particle].getMass();
163 thisobj->Lp->P[particle].setMass(in_buffer[0]);
global_data_all_processes All
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
int32_t MySignedIntPosType
double accel_normalize_fac