1 #ifndef HNBODY_EXPERT_H
2 #define HNBODY_EXPERT_H
24 #define vecsize (3*sizeof(double))
28 #define CS_A 1.3512071919596576
29 #define CS_B -1.7024143839193153
30 #define CS_BA -1.2599210498948732
33 #define NZP(sys) (sys->Ltype==LWP_ZWP ? sys->nHL : sys->nH)
36 #define NCM(sys) (sys->fixedH>0 ? sys->nH : sys->nHL)
39 #define FIXEDH(sys) (sys->fixedH && sys->nH==sys->nHL)
40 #define FIXEDZP(sys) ( sys->fixedH && \
41 (sys->nH==sys->nHL || sys->Ltype==LWP_NONE))
44 #define IS_BARY(it) (((it)&Origin)==Barycentric)
45 #define IS_BODY(it) (((it)&Origin)==Bodycentric)
46 #define IS_JACOBI(it) (((it)&Origin)==Jacobi)
47 #define IS_REG(it) (((it)&Regularized)!=0)
48 #define IS_MOD(it) (((it)&TWform)!=0)
49 #define IS_4TH(it) (((it)&Order)!=0)
50 #define IS_PN(it) (((it)&Gravity)==PostNewtonian)
51 #define IS_CS(it) (((it)&Order)==Order4)
52 #define IS_KD(it) (((it)&Splitting)==Kick_Drift)
53 #define IS_DK(it) (((it)&Splitting)==Drift_Kick)
54 #define IS_SD(it) (((it)&Splitting)==Shift_Drift)
57 #define IMAP(j, nL, nHL) ((j)<=(nL) ? ((j) ? (nHL)-(j) : 0) : (j)-(nL))
60 #define ABSLT(x, y) (fabs(x)<fabs(y))
61 #define ABSLE(x, y) (fabs(x)<=fabs(y))
62 #define ABSGT(x, y) (fabs(x)>fabs(y))
63 #define ABSGE(x, y) (fabs(x)>=fabs(y))
66 #define memzero(x, n) memset(x, 0, (n)*sizeof(double))
69 #define hnb_ksum(S, C, Xj) do {double Y=Xj-C, T=S+Y; C=(T-S)-Y; S=T;} while (0)
103 const double x[][3],
const double v[][3],
104 const double m[],
int n,
const hnb_data_t *sys),
105 (*hnb_user_prune_func)(
hnb_data_t *sys,
int index),
106 (*hnb_user_init_func)(
hnb_data_t *sys,
const char *file),
107 (*hnb_user_exit_func)(
hnb_data_t *sys,
const char *file),
108 (*hnb_user_save_func)(
hnb_data_t *sys,
double key),
109 (*hnb_user_rest_func)(
hnb_data_t *sys,
double key),
113 DLLSPEC
extern const char *hnb_user_init_file;
120 *
hnb_raw_init(
double tinit,
const double xinit[][3],
const double vinit[][3],
121 const double m[],
const int id[],
const int jindex[],
122 int nH,
int nL,
int nZ,
hnb_LWP_t ltype,
int fixedH,
124 const double renc[],
const double rcapt[],
double G,
double c,
double Msun,
125 double J2,
double J4,
double J6,
double obRadius,
126 double dm,
double dzH,
double dzZ,
double eps,
133 hnb_drift(
hnb_data_t *sys,
double dz,
int output),
134 hnb_kick(
hnb_data_t *sys,
double dz,
int output),
135 hnb_shift(
hnb_data_t *sys,
double dz,
int output),
137 *hnb_mtsort(
void *vsys),
147 zwp_regdata(
double *,
double *,
double *,
148 const double *,
const double *,
hnb_data_t *),
150 hcoord_to_zcoord(
double (*)[3],
double (*)[3],
hnb_data_t *),
151 hl_dkick(
double dv[][3],
double x[][3],
double dt,
hnb_data_t *sys),
156 hl_etas(
double *,
double *,
const double *,
const int *,
int),
158 hl_inter(
double [],
double [],
double,
int,
hnb_data_t *),
160 hnb_normalize(
double x[][3],
double dx[][3],
int n),
161 hnb_partition(
int *imin,
int *imax,
int ipart,
int npart),
163 oblate_kick(
double (*dv)[3],
double (*x)[3],
const double m[],
166 postn_bary2pseudo(
double (*vpseudo)[3],
double (*xbody)[3],
167 double (*vbary)[3],
const double m[],
int n,
double G,
double c2),
168 postn_pseudo2bary(
double (*vbary)[3],
double (*xbody)[3],
169 double (*vpseudo)[3],
const double m[],
int n,
double G,
double c2),
170 postn_jacobi2pseudo(
double (*dv)[3],
double (*x)[3],
double (*v)[3],
171 const double ieta[],
const int imap[],
int n,
double GM,
double c2),
172 postn_pseudo2jacobi(
double (*dv)[3],
double (*x)[3],
double (*v)[3],
173 const double ieta[],
const int imap[],
int n,
double GM,
double c2),
174 postn_shift(
double (*dx)[3],
double (*v)[3],
const double m[],
176 postn_kick(
double (*dv)[3],
double (*x)[3],
177 const double m[],
const double ieta[],
const int imap[],
180 DLLSPEC
extern double
181 oblate_energy(
double (*x)[3],
const double m[],
int n,
hnb_data_t *sys),
182 postn_energy(
double (*x)[3],
double (*v)[3],
hnb_data_t *sys);
187 create_imap(
int imap[],
const int jindex[],
int nhl),
190 close_enc(
const double xc0[],
const double vc0[],
const double xc1[],
191 const double vc1[],
const double xp0[],
const double vp0[],
192 const double xp1[],
const double vp1[],
double renc,
double GM,
double dt);
194 DLLSPEC
extern double encke_g(
double);
DLLSPEC double encke_g(double)
Computes 1-(1+2*q)^-3/2, maintaining relative precision for |q|<<1.
Definition: zwp.c:27
struct hnb_ctrl_struct hnb_ctrl_t
User control callback information.
void(* hnb_drift_t)(hnb_vector_t dx, hnb_vector_t dv, double t, hnb_vector_t x, hnb_vector_t v, const double m[], int nHL, int n, double dt, const struct hnb_data_struct *sys)
Prototype for extra_drift() functions.
Definition: kernel.h:100
double(* hnb_energy_t)(double t, hnb_vector_t x, hnb_vector_t v, const double m[], int nHL, const struct hnb_data_struct *sys)
Prototype for extra_energy() functions.
Definition: kernel.h:105
Core user-visible package declarations for the HNBody library.
enum LWP_enum hnb_LWP_t
Choices for LWP perturbations type.
enum hnb_integcoord_enum hnb_integcoord_t
Symplectic integration scheme variations (bit-mask layout).
DLLSPEC hnb_ctrl_t hnb_user_ctrl_data
Passed to hnb_user_exam_func to allow increased user integration control.
Definition: init.c:28
User control callback information.
Definition: expert.h:89
DLLSPEC hnb_data_t * hnb_raw_init(double tinit, const double xinit[][3], const double vinit[][3], const double m[], const int id[], const int jindex[], int nH, int nL, int nZ, hnb_LWP_t ltype, int fixedH, int enc, int prune, const double renc[], const double rcapt[], double G, double c, double Msun, double J2, double J4, double J6, double obRadius, double dm, double dzH, double dzZ, double eps, hnb_integ_t integ, hnb_integcoord_t itH, hnb_integcoord_t itZ, hnb_extra_t extra_kick, hnb_extra_t extra_shift, hnb_drift_t extra_drift, hnb_derivs_t extra_derivs, hnb_energy_t extra_energy, int nthreads)
Allocates and initializes a system data structure.
Definition: init.c:312
int * prune
Definition: expert.h:90
DLLSPEC void(* hnb_user_exam_func)(hnb_ctrl_t *ctrl, double t, const double x[][3], const double v[][3], const double m[], int n, const hnb_data_t *sys)
Definition: init.c:36
int(* hnb_derivs_t)(hnb_vector_t dxdt, hnb_vector_t dvdt, double t, hnb_vector_t x, hnb_vector_t v, const double m[], int nHL, int n, const struct hnb_data_struct *sys)
Prototype for extra_derivs() functions.
Definition: kernel.h:109
void(* hnb_extra_t)(hnb_vector_t, double t, hnb_vector_t, const double m[], int nHL, int n, double dt, const struct hnb_data_struct *sys)
Prototype for extra_kick() and extra_shift() functions.
Definition: kernel.h:96
Main HNBody system data structure.
Definition: kernel.h:115
double(* hnb_vector_t)[3]
System particle 3-vector type.
Definition: kernel.h:89
enum hnb_integ_enum hnb_integ_t
Integration scheme choices.