- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

# hnbody/expert.h

Go to the documentation of this file.

    00001 #ifndef HNBODY_EXPERT_H
    00002 #define HNBODY_EXPERT_H
    00003
    00014 #include <mutils/platform.h>
    00015
    00016 #include "hnbody/kernel.h"
    00017
    00018 #ifdef __cplusplus
    00019 extern "C" {
    00020 namespace HNBODY {
    00021 #endif
    00022
    00023
    00024 #define vecsize (3*sizeof(double))
    00025 #define ACE_MAX 28
    00026
    00027 /* Constants to implement 4th order composition step. */
    00028 #define CS_A   1.3512071919596576
    00029 #define CS_B  -1.7024143839193153
    00030 #define CS_BA -1.2599210498948732
    00031
    00032 /* Number of ZWP-perturbing H&Ls. */
    00033 #define NZP(sys) (sys->Ltype==LWP_ZWP ? sys->nHL : sys->nH)
    00034
    00035 /* Number of planets contributing to the "effective" center of mass. */
    00036 #define NCM(sys) (sys->fixedH>0 ? sys->nH : sys->nHL)
    00037
    00038 /* Are all (Z-perturbing) H&Ls fixed? */
    00039 #define FIXEDH(sys)  (sys->fixedH &&  sys->nH==sys->nHL)
    00040 #define FIXEDZP(sys) ( sys->fixedH && \
    00041                       (sys->nH==sys->nHL || sys->Ltype==LWP_NONE))
    00042
    00043 /* Tests whether coordinates are heliocentric, regularized, etc. */
    00044 #define IS_BARY(it)   (((it)&Origin)==Barycentric)
    00045 #define IS_BODY(it)   (((it)&Origin)==Bodycentric)
    00046 #define IS_JACOBI(it) (((it)&Origin)==Jacobi)
    00047 #define IS_REG(it)    (((it)&Regularized)!=0)
    00048 #define IS_MOD(it)    (((it)&TWform)!=0)
    00049 #define IS_4TH(it)    (((it)&Order)!=0)
    00050 #define IS_PN(it)     (((it)&Gravity)==PostNewtonian)
    00051 #define IS_CS(it)     (((it)&Order)==Order4)
    00052 #define IS_KD(it)     (((it)&Splitting)==Kick_Drift)
    00053 #define IS_DK(it)     (((it)&Splitting)==Drift_Kick)
    00054 #define IS_SD(it)     (((it)&Splitting)==Shift_Drift)
    00055
    00056 /* Array index i corresponding to Jacobi index j. */
    00057 #define IMAP(j, nL, nHL) ((j)<=(nL) ? ((j) ? (nHL)-(j) : 0) : (j)-(nL))
    00058
    00059 /* Magnitude inequality operators. */
    00060 #define ABSLT(x, y) (fabs(x)<fabs(y))
    00061 #define ABSLE(x, y) (fabs(x)<=fabs(y))
    00062 #define ABSGT(x, y) (fabs(x)>fabs(y))
    00063 #define ABSGE(x, y) (fabs(x)>=fabs(y))
    00064
    00065 /* Procedure to zero double array of length n---assumes 0 bits --> float=0. */
    00066 #define memzero(x, n) memset(x, 0, (n)*sizeof(double))
    00067
    00068 /* Kahan summation formula---all arguments should be *variables*. */
    00069 #define hnb_ksum(S, C, Xj) do {double Y=Xj-C, T=S+Y; C=(T-S)-Y; S=T;} while (0)
    00070
    00071
    00072 /*
    00073    Extra user-defined initialization; init_step overrides built-in action and
    00074    half_step replaces default action in hnb_halfstep(). If defined,
    00075    save_func and rest_func are called each time hnb_save() and hnb_restore()
    00076    are called, respectively.
    00077 */
    00078 DLLSPEC extern void
    00079        (*hnb_user_exam_func)(double t,
    00080                              const double x[][3], const double v[][3],
    00081                              int n, const hnb_data_t *sys),
    00082        (*hnb_user_init_func)(hnb_data_t *sys, const char *file),
    00083        (*hnb_user_exit_func)(hnb_data_t *sys, const char *file),
    00084        (*hnb_user_save_func)(hnb_data_t *sys, double key),
    00085        (*hnb_user_rest_func)(hnb_data_t *sys, double key),
    00086        (*hnb_user_init_step)(hnb_data_t *sys),
    00087        (*hnb_user_half_step)(hnb_data_t *sys);
    00088
    00089 DLLSPEC extern const char *hnb_user_init_file;
    00090
    00091 hnb_vector_t
    00092   hnb_newvec(hnb_data_t *sys),
    00093   hnb_newvec_unlocked(hnb_data_t *sys);
    00094
    00095 DLLSPEC extern hnb_data_t
    00096  *hnb_raw_init(double tinit, const double xinit[][3], const double vinit[][3],
    00097      const double m[], const int id[], const int jindex[],
    00098      int nH, int nL, int nZ, hnb_LWP_t ltype, int fixedH,
    00099      int enc, int prune,
    00100      const double renc[], const double rcapt[], double G, double c, double Msun,
    00101      double J2, double J4, double J6, double obRadius,
    00102      double dm, double dzH, double dzZ, double eps,
    00103      hnb_integ_t integ, hnb_integcoord_t itH, hnb_integcoord_t itZ,
    00104      hnb_extra_t extra_kick, hnb_extra_t extra_shift, hnb_drift_t extra_drift,
    00105      hnb_derivs_t extra_derivs, hnb_energy_t extra_energy, int nthreads);
    00106
    00107 DLLSPEC extern void
    00108   hnb_setup_output(hnb_data_t *sys),
    00109   hnb_drift(hnb_data_t *sys, double dz, int output),
    00110   hnb_kick( hnb_data_t *sys, double dz, int output),
    00111   hnb_shift(hnb_data_t *sys, double dz, int output),
    00112
    00113  *hnb_mtsort(void *vsys),
    00114   hnb_init_threads(hnb_data_t *sys, int npart),
    00115   hnb_delvec(hnb_vector_t vec, hnb_data_t *sys),
    00116   hnb_delvec_unlocked(hnb_vector_t vec, hnb_data_t *sys),
    00117
    00118   hnb_halfstep(hnb_data_t *sys),
    00119
    00120   ode_step(hnb_data_t *sys),
    00121
    00122   zwp_iostep(hnb_data_t *, int), zwp_step(hnb_data_t *),
    00123   zwp_regdata(double *, double *, double *,
    00124     const double *, const double *, hnb_data_t *),
    00125
    00126   hcoord_to_zcoord(double (*)[3], double (*)[3], hnb_data_t *),
    00127   hl_dkick(double dv[][3], double x[][3], double dt, hnb_data_t *sys),
    00128   hl_drift(hnb_data_t *sys, double dz),
    00129   hl_kick0(hnb_data_t *sys, double dz),
    00130   hl_shift(hnb_data_t *sys, double dz),
    00131   hl_sync(hnb_data_t *, double), hl_reinit(hnb_data_t *, int),
    00132   hl_etas(double *, double *, const double *, const int *, int),
    00133   hl_iostep(hnb_data_t *, int), hl_step0(hnb_data_t *, double, int),
    00134   hl_inter(double [], double [], double, int, hnb_data_t *),
    00135
    00136   hnb_normalize(double x[][3], double dx[][3], int n),
    00137   hnb_partition(int *imin, int *imax, int ipart, int npart),
    00138
    00139   oblate_kick(double (*dv)[3], double (*x)[3], const double m[],
    00140               int n, double dt, hnb_data_t *sys),
    00141
    00142   postn_bary2pseudo(double (*vpseudo)[3], double (*xbody)[3],
    00143     double (*vbary)[3], const double m[], int n, double G, double c2),
    00144   postn_pseudo2bary(double (*vbary)[3], double (*xbody)[3],
    00145     double (*vpseudo)[3], const double m[], int n, double G, double c2),
    00146   postn_jacobi2pseudo(double (*dv)[3], double (*x)[3], double (*v)[3],
    00147     const double ieta[], const int imap[], int n, double GM, double c2),
    00148   postn_pseudo2jacobi(double (*dv)[3], double (*x)[3], double (*v)[3],
    00149     const double ieta[], const int imap[], int n, double GM, double c2),
    00150   postn_shift(double (*dx)[3],  double (*v)[3], const double m[],
    00151     int n, double dt, double G, double c2, hnb_integcoord_t it),
    00152   postn_kick(double (*dv)[3], double (*x)[3],
    00153     const double m[], const double ieta[], const int imap[],
    00154     int n, double dt, double G, double c2, hnb_integcoord_t it);
    00155
    00156 DLLSPEC extern double
    00157   oblate_energy(double (*x)[3], const double m[], int n, hnb_data_t *sys),
    00158   postn_energy(double (*x)[3], double (*v)[3], hnb_data_t *sys);
    00159
    00160 DLLSPEC extern int
    00161   hnb_extra_index(const hnb_data_t *),
    00162
    00163   create_imap(int imap[], const int jindex[], int nhl),
    00164
    00165   hl_filltab(hnb_data_t *, double),
    00166   close_enc(const double xc0[], const double vc0[], const double xc1[],
    00167     const double vc1[], const double xp0[], const double vp0[],
    00168     const double xp1[], const double vp1[], double renc, double GM, double dt);
    00169
    00170 DLLSPEC extern double encke_g(double);
    00171
    00172
    00173 #ifdef __cplusplus
    00174 }  // namespace HNBODY
    00175 }  // extern "C"
    00176 #endif
    00177
    00178 #endif  /* HNBODY_EXPERT_H */