MP-Gadget  5.0.1.dev1-76bc7d4726-dirty
timebinmgr.h
Go to the documentation of this file.
1 #ifndef TIMEBINMGR_H
2 #define TIMEBINMGR_H
3 /* This file manages the integer timeline,
4  * and converts from integers ti to double loga.*/
5 
13 #define TIMEBINS 20
14 #define TIMEBASE (1u<<TIMEBINS)
15 #define MAXSNAPSHOTS (1u<<(30-TIMEBINS))
16 
17 #include "types.h"
18 #include "utils/paramset.h"
19 
20 typedef struct SyncPoint SyncPoint;
21 
22 struct SyncPoint
23 {
24  double a;
25  double loga;
27  int write_fof;
29 };
30 
31 
32 /*Convert an integer to and from loga*/
33 double loga_from_ti(inttime_t ti);
34 inttime_t ti_from_loga(double loga);
35 
36 /*Convert changes in loga to and from ti*/
37 inttime_t dti_from_dloga(double loga, const inttime_t Ti_Current);
38 double dloga_from_dti(inttime_t dti, const inttime_t Ti_Current);
39 
40 /*Get dloga from a timebin*/
41 double get_dloga_for_bin(int timebin, const inttime_t Ti_Current);
42 
43 /*Get the dti from the timebin*/
44 static inline inttime_t dti_from_timebin(int bin) {
45  /*Casts to work around bug in intel compiler 18.0*/
46  return bin > 0 ? (1u << (unsigned) bin) : 0;
47 }
48 
49 /* Enforce that an integer timestep is a power
50  * of two subdivision of TIMEBASE, rounding down
51  * to the first power of two less than the ti passed in.
52  * Note TIMEBASE is the maximum value returned.*/
54 
57 
58 /*Get whatever is the last output number from ti*/
60 
61 int OutputListAction(ParameterSet * ps, const char * name, void * data);
62 void set_sync_params(int OutputListLength, double * OutputListTimes);
63 void setup_sync_points(double TimeIC, double TimeMax, double no_snapshot_until_time, int SnapshotWithFOF);
64 
65 SyncPoint *
67 
68 SyncPoint *
70 
71 SyncPoint *
73 
74 #endif
const char * name
Definition: densitykernel.c:93
inttime_t ti
Definition: timebinmgr.h:28
double a
Definition: timebinmgr.h:24
int write_fof
Definition: timebinmgr.h:27
double loga
Definition: timebinmgr.h:25
int write_snapshot
Definition: timebinmgr.h:26
#define OutputListLength
inttime_t round_down_power_of_two(inttime_t ti)
Definition: timebinmgr.c:286
inttime_t dti_from_dloga(double loga, const inttime_t Ti_Current)
Definition: timebinmgr.c:271
inttime_t ti_from_loga(double loga)
Definition: timebinmgr.c:236
inttime_t out_from_ti(inttime_t ti)
SyncPoint * find_next_sync_point(inttime_t ti)
Definition: timebinmgr.c:174
int OutputListAction(ParameterSet *ps, const char *name, void *data)
Definition: timebinmgr.c:31
double dloga_from_dti(inttime_t dti, const inttime_t Ti_Current)
Definition: timebinmgr.c:256
double get_dloga_for_bin(int timebin, const inttime_t Ti_Current)
Definition: timebinmgr.c:279
double loga_from_ti(inttime_t ti)
Definition: timebinmgr.c:223
SyncPoint * find_current_sync_point(inttime_t ti)
Definition: timebinmgr.c:188
SyncPoint * make_unplanned_sync_point(inttime_t ti)
void setup_sync_points(double TimeIC, double TimeMax, double no_snapshot_until_time, int SnapshotWithFOF)
Definition: timebinmgr.c:97
void set_sync_params(int OutputListLength, double *OutputListTimes)
Definition: timebinmgr.c:76
inttime_t find_next_outputtime(inttime_t ti_curr)
static inttime_t dti_from_timebin(int bin)
Definition: timebinmgr.h:44
int32_t inttime_t
Definition: types.h:8