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 CS_W0 1.3151863206839112188842497282388625143519535061590
34 #define CS_W1 -1.1776799841788710069464156809643157346392692526343
35 #define CS_W2 0.2355732133593581336847931829785346016864680821033
36 #define CS_W3 0.7845136104775572638194976338663498757768244174514
39 #define NZP(sys) (sys->Ltype==LWP_ZWP ? sys->nHL : sys->nH)
42 #define NCM(sys) (sys->fixedH>0 ? sys->nH : sys->nHL)
45 #define FIXEDH(sys) (sys->fixedH && sys->nH==sys->nHL)
46 #define FIXEDZP(sys) ( sys->fixedH && \
47 (sys->nH==sys->nHL || sys->Ltype==LWP_NONE))
50 #define IS_BARY(it) (((it)&Origin)==Barycentric)
51 #define IS_BODY(it) (((it)&Origin)==Bodycentric)
52 #define IS_JACOBI(it) (((it)&Origin)==Jacobi)
53 #define IS_REG(it) (((it)&Regularized)!=0)
54 #define IS_MOD(it) (((it)&TWform)!=0)
55 #define IS_4TH(it) (((it)&Order)==Order4)
56 #define IS_PN(it) (((it)&Gravity)==PostNewtonian)
57 #define IS_CS(it) (((it)&Order)!=0)
58 #define IS_KD(it) (((it)&Splitting)==Kick_Drift)
59 #define IS_DK(it) (((it)&Splitting)==Drift_Kick)
60 #define IS_SD(it) (((it)&Splitting)==Shift_Drift)
63 #define IMAP(j, nL, nHL) ((j)<=(nL) ? ((j) ? (nHL)-(j) : 0) : (j)-(nL))
66 #define ABSLT(x, y) (fabs(x)<fabs(y))
67 #define ABSLE(x, y) (fabs(x)<=fabs(y))
68 #define ABSGT(x, y) (fabs(x)>fabs(y))
69 #define ABSGE(x, y) (fabs(x)>=fabs(y))
72 #define memzero(x, n) memset(x, 0, (n)*sizeof(double))
75 #define hnb_ksum(S, C, Xj) do {double Y=Xj-C, T=S+Y; C=(T-S)-Y; S=T;} while (0)
109 const double x[][3],
const double v[][3],
110 const double m[],
int n,
const hnb_data_t *sys),
111 (*hnb_user_prune_func)(
hnb_data_t *sys,
int index),
112 (*hnb_user_init_func)(
hnb_data_t *sys,
const char *file),
113 (*hnb_user_exit_func)(
hnb_data_t *sys,
const char *file),
114 (*hnb_user_save_func)(
hnb_data_t *sys,
double key),
115 (*hnb_user_rest_func)(
hnb_data_t *sys,
double key),
119 DLLSPEC
extern const char *hnb_user_init_file;
126 *
hnb_raw_init(
double tinit,
const double xinit[][3],
const double vinit[][3],
127 const double m[],
const int id[],
const int jindex[],
const int smult[],
128 int nH,
int nL,
int nZ,
hnb_LWP_t ltype,
int fixedH,
130 const double renc[],
const double rcapt[],
double G,
double c,
double Msun,
131 double J2,
double J4,
double J6,
double obRadius,
132 double dm,
double dzH,
double dzZ,
double eps,
139 hnb_drift(
hnb_data_t *sys,
double dz,
int output),
140 hnb_kick(
hnb_data_t *sys,
double dz,
int output),
141 hnb_shift(
hnb_data_t *sys,
double dz,
int output),
143 *hnb_mtsort(
void *vsys),
153 zwp_regdata(
double *,
double *,
double *,
154 const double *,
const double *,
hnb_data_t *),
156 hcoord_to_zcoord(
double (*)[3],
double (*)[3],
hnb_data_t *),
157 hl_dkick(
double dv[][3],
double x[][3],
double dt,
hnb_data_t *sys),
162 hl_etas(
double *,
double *,
const double *,
const int *,
int),
164 hl_inter(
double [],
double [],
double,
int,
hnb_data_t *),
166 hnb_normalize(
double x[][3],
double dx[][3],
int n),
167 hnb_partition(
int *imin,
int *imax,
int ipart,
int npart),
169 oblate_kick(
double (*dv)[3],
double (*x)[3],
const double m[],
172 postn_bary2pseudo(
double (*vpseudo)[3],
double (*xbody)[3],
173 double (*vbary)[3],
const double m[],
int n,
double G,
double c2),
174 postn_pseudo2bary(
double (*vbary)[3],
double (*xbody)[3],
175 double (*vpseudo)[3],
const double m[],
int n,
double G,
double c2),
176 postn_jacobi2pseudo(
double (*dv)[3],
double (*x)[3],
double (*v)[3],
177 const double ieta[],
const int imap[],
int n,
double GM,
double c2),
178 postn_pseudo2jacobi(
double (*dv)[3],
double (*x)[3],
double (*v)[3],
179 const double ieta[],
const int imap[],
int n,
double GM,
double c2),
180 postn_shift(
double (*dx)[3],
double (*v)[3],
const double m[],
182 postn_kick(
double (*dv)[3],
double (*x)[3],
183 const double m[],
const double ieta[],
const int imap[],
186 DLLSPEC
extern double
187 oblate_energy(
double (*x)[3],
const double m[],
int n,
hnb_data_t *sys),
188 postn_energy(
double (*x)[3],
double (*v)[3],
hnb_data_t *sys);
193 create_imap(
int imap[],
const int jindex[],
int nhl),
196 close_enc(
const double xc0[],
const double vc0[],
const double xc1[],
197 const double vc1[],
const double xp0[],
const double vp0[],
198 const double xp1[],
const double vp1[],
double renc,
double GM,
double dt);
200 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.
Core user-visible package declarations for the HNBody library.
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[], const int smult[], 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:330
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:99
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).
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:112
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:95
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 * prune
Definition: expert.h:96
Main HNBody system data structure.
Definition: kernel.h:118
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:108
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:103
double(* hnb_vector_t)[3]
System particle 3-vector type.
Definition: kernel.h:92
enum hnb_integ_enum hnb_integ_t
Integration scheme choices.