#ifndef _MAIN_H
#define _MAIN_H
#ifdef _WIN64
#define _LP64
#endif
#ifdef _WIN32
#include <WinSock2.h>
#define _WINSOCKAPI_
#include <windows.h>
#define REB_RESTRICT
#define DLLEXPORT __declspec(dllexport)
#define __restrict__
#elif __EMSCRIPTEN__
#include <emscripten.h>
#include <emscripten/html5.h>
#define REB_RESTRICT
#define DLLEXPORT
#else
#define REB_RESTRICT restrict
#define DLLEXPORT
#endif
#include <stdio.h>
#include <inttypes.h>
#include <stdint.h>
#include <signal.h>
#define _USE_MATH_DEFINES
#include <math.h>
#ifdef _WIN32
typedef struct reb_timeval {
int64_t tv_sec;
int64_t tv_usec;
} reb_timeval;
int gettimeofday(struct reb_timeval * tp, struct timezone * tzp);
int asprintf(char **strp, const char *fmt, ...);
int rand_r (unsigned int *seed);
#include <io.h>
#define _TIMEVAL_DEFINED
#else
#define reb_timeval timeval
#include <sys/time.h>
#include <unistd.h>
#include <pthread.h>
#endif
#ifdef AVX512
#include <immintrin.h>
#endif
#ifdef MPI
#include "mpi.h"
#endif
#ifndef GITHASH
#define GITHASH notavailable0000000000000000000000000001
#endif
#ifndef __GNUC__
# define __attribute__(x)
#endif
DLLEXPORT extern const char* reb_build_str; DLLEXPORT extern const char* reb_version_str; DLLEXPORT extern const char* reb_githash_str; DLLEXPORT extern const char* reb_logo[26]; DLLEXPORT extern const unsigned char reb_favicon_png[]; DLLEXPORT extern const unsigned int reb_favicon_len;
DLLEXPORT extern const int reb_max_messages_length;
DLLEXPORT extern const int reb_N_max_messages;
extern volatile sig_atomic_t reb_sigint;
struct reb_simulation;
struct reb_simulationarchive;
struct reb_display_data;
struct reb_server_data;
struct reb_treecell;
struct reb_variational_configuration;
struct reb_display_settings;
struct reb_particle {
double x; double y;
double z;
double vx;
double vy;
double vz;
double ax;
double ay;
double az;
double m; double r; double last_collision; struct reb_treecell* c; #if !defined(_LP64)
char pad1[4]; #endif
uint32_t hash; #if !defined(_LP64)
char pad2[4]; #endif
void* ap; #if !defined(_LP64)
char pad3[4]; #endif
struct reb_simulation* sim; #if !defined(_LP64)
char pad4[4]; #endif
};
struct reb_vec3d {
double x;
double y;
double z;
};
struct reb_mat4df {
float m[16];
};
struct reb_vec6d{
double x;
double y;
double z;
double vx;
double vy;
double vz;
};
struct reb_rotation {
double ix;
double iy;
double iz;
double r;
};
struct reb_collision{
int p1; int p2; struct reb_vec6d gb; int ri; };
struct reb_dp7 {
double* REB_RESTRICT p0;
double* REB_RESTRICT p1;
double* REB_RESTRICT p2;
double* REB_RESTRICT p3;
double* REB_RESTRICT p4;
double* REB_RESTRICT p5;
double* REB_RESTRICT p6;
};
struct reb_integrator_ias15 {
double epsilon; double min_dt; enum {
REB_IAS15_INDIVIDUAL = 0, REB_IAS15_GLOBAL = 1, REB_IAS15_PRS23 = 2, REB_IAS15_AARSETH85 = 3, } adaptive_mode;
uint64_t iterations_max_exceeded; unsigned int N_allocated;
double* REB_RESTRICT at;
double* REB_RESTRICT x0;
double* REB_RESTRICT v0;
double* REB_RESTRICT a0;
double* REB_RESTRICT csx;
double* REB_RESTRICT csv;
double* REB_RESTRICT csa0;
struct reb_dp7 g;
struct reb_dp7 b;
struct reb_dp7 csb; struct reb_dp7 e;
struct reb_dp7 br; struct reb_dp7 er; int* map; unsigned int N_allocated_map; };
struct reb_integrator_mercurius {
double (*L) (const struct reb_simulation* const r, double d, double dcrit); double r_crit_hill; unsigned int recalculate_coordinates_this_timestep; unsigned int recalculate_r_crit_this_timestep; unsigned int safe_mode;
unsigned int is_synchronized;
unsigned int mode; unsigned int encounter_N; unsigned int encounter_N_active; unsigned int tponly_encounter; unsigned int N_allocated;
unsigned int N_allocated_additional_forces;
unsigned int N_allocated_dcrit; double* dcrit; struct reb_particle* REB_RESTRICT particles_backup; struct reb_particle* REB_RESTRICT particles_backup_additional_forces; int* encounter_map; struct reb_vec3d com_pos; struct reb_vec3d com_vel;
};
struct reb_integrator_sei {
double OMEGA; double OMEGAZ;
double lastdt; double sindt; double tandt; double sindtz; double tandtz; };
struct reb_integrator_leapfrog {
unsigned int order;
};
struct reb_integrator_trace {
int (*S) (struct reb_simulation* const r, const unsigned int i, const unsigned int j);
int (*S_peri) (struct reb_simulation* const r, const unsigned int j);
enum {
REB_TRACE_PERI_PARTIAL_BS = 0,
REB_TRACE_PERI_FULL_BS = 1,
REB_TRACE_PERI_FULL_IAS15 = 2,
} peri_mode;
double r_crit_hill;
double peri_crit_eta;
enum {
REB_TRACE_MODE_INTERACTION = 0, REB_TRACE_MODE_KEPLER = 1, REB_TRACE_MODE_NONE = 2, REB_TRACE_MODE_FULL = 3, } mode;
unsigned int encounter_N; unsigned int encounter_N_active;
unsigned int N_allocated;
unsigned int N_allocated_additional_forces;
unsigned int tponly_encounter;
struct reb_particle* REB_RESTRICT particles_backup; struct reb_particle* REB_RESTRICT particles_backup_kepler; struct reb_particle* REB_RESTRICT particles_backup_additional_forces;
int* encounter_map; struct reb_vec3d com_pos; struct reb_vec3d com_vel;
int* current_Ks; unsigned int current_C; unsigned int force_accept; };
struct reb_integrator_saba {
enum {
REB_SABA_1 = 0x0, REB_SABA_2 = 0x1, REB_SABA_3 = 0x2, REB_SABA_4 = 0x3, REB_SABA_CM_1 = 0x100, REB_SABA_CM_2 = 0x101, REB_SABA_CM_3 = 0x102, REB_SABA_CM_4 = 0x103, REB_SABA_CL_1 = 0x200, REB_SABA_CL_2 = 0x201, REB_SABA_CL_3 = 0x202, REB_SABA_CL_4 = 0x203, REB_SABA_10_4 = 0x4, REB_SABA_8_6_4 = 0x5, REB_SABA_10_6_4 = 0x6, REB_SABA_H_8_4_4 = 0x7, REB_SABA_H_8_6_4 = 0x8, REB_SABA_H_10_6_4 = 0x9, } type; unsigned int safe_mode; unsigned int is_synchronized; unsigned int keep_unsynchronized; };
struct reb_integrator_whfast {
unsigned int corrector; unsigned int corrector2; enum {
REB_WHFAST_KERNEL_DEFAULT = 0,
REB_WHFAST_KERNEL_MODIFIEDKICK = 1,
REB_WHFAST_KERNEL_COMPOSITION = 2,
REB_WHFAST_KERNEL_LAZY = 3,
} kernel; enum {
REB_WHFAST_COORDINATES_JACOBI = 0, REB_WHFAST_COORDINATES_DEMOCRATICHELIOCENTRIC = 1, REB_WHFAST_COORDINATES_WHDS = 2, REB_WHFAST_COORDINATES_BARYCENTRIC = 3, } coordinates; unsigned int recalculate_coordinates_this_timestep; unsigned int safe_mode; unsigned int keep_unsynchronized;
struct reb_particle* REB_RESTRICT p_jh; struct reb_particle* REB_RESTRICT p_temp; unsigned int is_synchronized;
unsigned int N_allocated;
unsigned int N_allocated_tmp; unsigned int timestep_warning;
unsigned int recalculate_coordinates_but_not_synchronized_warning;
};
struct reb_particle_avx512{
#ifdef AVX512
__m512d m __attribute__ ((aligned (64)));
__m512d x __attribute__ ((aligned (64)));
__m512d y __attribute__ ((aligned (64)));
__m512d z __attribute__ ((aligned (64)));
__m512d vx __attribute__ ((aligned (64)));
__m512d vy __attribute__ ((aligned (64)));
__m512d vz __attribute__ ((aligned (64)));
#else
double m[8]; double x[8];
double y[8];
double z[8];
double vx[8];
double vy[8];
double vz[8];
#endif };
struct reb_integrator_whfast512 {
unsigned int gr_potential; unsigned int N_systems; unsigned int keep_unsynchronized;
unsigned int is_synchronized;
unsigned int N_allocated;
unsigned int recalculate_constants;
struct reb_particle_avx512* p_jh;
struct reb_particle p_jh0[4];
};
struct reb_integrator_bs {
double eps_abs; double eps_rel; double min_dt; double max_dt;
struct reb_ode* nbody_ode; int* sequence; int* cost_per_step; double* cost_per_time_unit; double* optimal_step; double* coeff; double dt_proposed;
int first_or_last_step;
int previous_rejected;
int target_iter;
int user_ode_needs_nbody; };
enum REB_EOS_TYPE {
REB_EOS_LF = 0x00,
REB_EOS_LF4 = 0x01,
REB_EOS_LF6 = 0x02,
REB_EOS_LF8 = 0x03,
REB_EOS_LF4_2 = 0x04,
REB_EOS_LF8_6_4= 0x05,
REB_EOS_PLF7_6_4= 0x06,
REB_EOS_PMLF4 = 0x07,
REB_EOS_PMLF6 = 0x08,
};
enum REB_COLLISION_RESOLVE_OUTCOME {
REB_COLLISION_RESOLVE_OUTCOME_REMOVE_NONE = 0,
REB_COLLISION_RESOLVE_OUTCOME_REMOVE_P1 = 1,
REB_COLLISION_RESOLVE_OUTCOME_REMOVE_P2 = 2,
REB_COLLISION_RESOLVE_OUTCOME_REMOVE_BOTH = 3,
};
struct reb_integrator_eos {
enum REB_EOS_TYPE phi0; enum REB_EOS_TYPE phi1; unsigned int n; unsigned int safe_mode;
unsigned int is_synchronized;
};
#define REB_PARTICLE_INT_TYPE int64_t
struct reb_particle_int {
REB_PARTICLE_INT_TYPE x;
REB_PARTICLE_INT_TYPE y;
REB_PARTICLE_INT_TYPE z;
REB_PARTICLE_INT_TYPE vx;
REB_PARTICLE_INT_TYPE vy;
REB_PARTICLE_INT_TYPE vz;
};
struct reb_integrator_janus {
double scale_pos; double scale_vel; unsigned int order; unsigned int recalculate_integer_coordinates_this_timestep;
struct reb_particle_int* REB_RESTRICT p_int;
unsigned int N_allocated;
};
enum REB_STATUS {
REB_STATUS_SINGLE_STEP = -10, REB_STATUS_SCREENSHOT_READY=-5, REB_STATUS_SCREENSHOT = -4, REB_STATUS_PAUSED = -3, REB_STATUS_LAST_STEP = -2, REB_STATUS_RUNNING = -1, REB_STATUS_SUCCESS = 0, REB_STATUS_GENERIC_ERROR = 1, REB_STATUS_NO_PARTICLES = 2, REB_STATUS_ENCOUNTER = 3, REB_STATUS_ESCAPE = 4, REB_STATUS_USER = 5, REB_STATUS_SIGINT = 6, REB_STATUS_COLLISION = 7, };
struct reb_hash_pointer_pair{
uint32_t hash;
int index;
};
struct reb_simulation {
double t; double G; double softening; double dt; double dt_last_done; uint64_t steps_done; unsigned int N; int N_var; unsigned int N_var_config;
struct reb_variational_configuration* var_config; int var_rescale_warning;
int N_active; int testparticle_type; int testparticle_hidewarnings;
struct reb_hash_pointer_pair* particle_lookup_table;
int hash_ctr;
int N_lookup; int N_allocated_lookup; unsigned int N_allocated; struct reb_particle* particles; struct reb_vec3d* gravity_cs;
int N_allocated_gravity_cs;
struct reb_treecell** tree_root;
int tree_needs_update; double opening_angle2; enum REB_STATUS status; int exact_finish_time;
unsigned int force_is_velocity_dependent; unsigned int gravity_ignore_terms;
double output_timing_last; int save_messages; char** messages; double exit_max_distance; double exit_min_distance; double usleep; struct reb_display_settings* display_settings; struct reb_display_data* display_data; struct reb_server_data* server_data; int track_energy_offset; double energy_offset; double walltime; double walltime_last_step; double walltime_last_steps; double walltime_last_steps_sum;
int walltime_last_steps_N;
uint32_t python_unit_l; uint32_t python_unit_m; uint32_t python_unit_t;
struct reb_vec3d boxsize; double boxsize_max; double root_size; int N_root; int N_root_x; int N_root_y;
int N_root_z;
int N_ghost_x; int N_ghost_y;
int N_ghost_z;
#ifdef MPI
int mpi_id; int mpi_num; struct reb_particle** particles_send; int* N_particles_send; int* N_particles_send_max; struct reb_particle** particles_recv; int* N_particles_recv; int* N_particles_recv_max;
struct reb_treecell** tree_essential_send; int* N_tree_essential_send; int* N_tree_essential_send_max; struct reb_treecell** tree_essential_recv; int* N_tree_essential_recv; int* N_tree_essential_recv_max; #endif
int collision_resolve_keep_sorted; struct reb_collision* collisions; int N_allocated_collisions;
unsigned int collisions_N; double minimum_collision_velocity; double collisions_plog; int64_t collisions_log_n;
int calculate_megno; double megno_Ys; double megno_Yss; double megno_cov_Yt; double megno_var_t; double megno_mean_t; double megno_mean_Y; double megno_initial_t; int64_t megno_n;
unsigned int rand_seed;
int simulationarchive_version; double simulationarchive_auto_interval; double simulationarchive_auto_walltime; uint64_t simulationarchive_auto_step; double simulationarchive_next; uint64_t simulationarchive_next_step; char* simulationarchive_filename;
enum {
REB_COLLISION_NONE = 0, REB_COLLISION_DIRECT = 1, REB_COLLISION_TREE = 2, REB_COLLISION_LINE = 4, REB_COLLISION_LINETREE = 5, } collision;
enum {
REB_INTEGRATOR_IAS15 = 0, REB_INTEGRATOR_WHFAST = 1, REB_INTEGRATOR_SEI = 2, REB_INTEGRATOR_LEAPFROG = 4, REB_INTEGRATOR_NONE = 7, REB_INTEGRATOR_JANUS = 8, REB_INTEGRATOR_MERCURIUS = 9, REB_INTEGRATOR_SABA = 10, REB_INTEGRATOR_EOS = 11, REB_INTEGRATOR_BS = 12, REB_INTEGRATOR_WHFAST512 = 21, REB_INTEGRATOR_TRACE = 25, } integrator;
enum {
REB_BOUNDARY_NONE = 0, REB_BOUNDARY_OPEN = 1, REB_BOUNDARY_PERIODIC = 2, REB_BOUNDARY_SHEAR = 3, } boundary;
enum {
REB_GRAVITY_NONE = 0, REB_GRAVITY_BASIC = 1, REB_GRAVITY_COMPENSATED = 2, REB_GRAVITY_TREE = 3, REB_GRAVITY_MERCURIUS = 4, REB_GRAVITY_JACOBI = 5, REB_GRAVITY_TRACE = 6, } gravity;
struct reb_integrator_sei ri_sei; struct reb_integrator_leapfrog ri_leapfrog; struct reb_integrator_whfast ri_whfast; struct reb_integrator_whfast512 ri_whfast512; struct reb_integrator_saba ri_saba; struct reb_integrator_ias15 ri_ias15; struct reb_integrator_mercurius ri_mercurius; struct reb_integrator_trace ri_trace; struct reb_integrator_janus ri_janus; struct reb_integrator_eos ri_eos; struct reb_integrator_bs ri_bs;
struct reb_ode** odes; int N_odes; int N_allocated_odes;
int ode_warnings;
void (*additional_forces) (struct reb_simulation* const r); void (*pre_timestep_modifications) (struct reb_simulation* const r); void (*post_timestep_modifications) (struct reb_simulation* const r); void (*heartbeat) (struct reb_simulation* r); int (*key_callback) (struct reb_simulation* r, int key); double (*coefficient_of_restitution) (const struct reb_simulation* const r, double v); enum REB_COLLISION_RESOLVE_OUTCOME (*collision_resolve) (struct reb_simulation* const r, struct reb_collision); void (*free_particle_ap) (struct reb_particle* p); void (*extras_cleanup) (struct reb_simulation* r); void* extras; };
DLLEXPORT struct reb_simulation* reb_simulation_create(void);
DLLEXPORT struct reb_simulation* reb_simulation_create_from_file(char* filename, int64_t snapshot);
DLLEXPORT struct reb_simulation* reb_simulation_create_from_simulationarchive(struct reb_simulationarchive* sa, int64_t snapshot);
DLLEXPORT void reb_simulation_free(struct reb_simulation* const r);
DLLEXPORT void reb_simulation_free_pointers(struct reb_simulation* const r);
DLLEXPORT int reb_simulation_reset_function_pointers(struct reb_simulation* const r);
DLLEXPORT void reb_simulation_reset_integrator(struct reb_simulation* r);
DLLEXPORT struct reb_simulation* reb_simulation_copy(struct reb_simulation* r);
DLLEXPORT int reb_simulation_diff(struct reb_simulation* r1, struct reb_simulation* r2, int output_option);
DLLEXPORT void reb_simulation_configure_box(struct reb_simulation* const r, const double boxsize, const int N_root_x, const int N_root_y, const int N_root_z);
DLLEXPORT int reb_simulation_start_server(struct reb_simulation* r, int port);
DLLEXPORT void reb_simulation_stop_server(struct reb_simulation* r);
DLLEXPORT void reb_exit(const char* const msg);
DLLEXPORT void reb_simulation_stop(struct reb_simulation* const r);
DLLEXPORT void reb_simulation_warning(struct reb_simulation* const r, const char* const msg);
DLLEXPORT void reb_simulation_error(struct reb_simulation* const r, const char* const msg);
DLLEXPORT void reb_simulation_save_to_file(struct reb_simulation* r, const char* filename);
DLLEXPORT void reb_simulation_save_to_file_interval(struct reb_simulation* const r, const char* filename, double interval);
DLLEXPORT void reb_simulation_save_to_file_walltime(struct reb_simulation* const r, const char* filename, double walltime);
DLLEXPORT void reb_simulation_save_to_file_step(struct reb_simulation* const r, const char* filename, uint64_t step);
DLLEXPORT void reb_simulation_save_to_stream(struct reb_simulation* r, char** bufp, size_t* sizep);
DLLEXPORT void reb_simulation_output_timing(struct reb_simulation* r, const double tmax);
DLLEXPORT void reb_simulation_output_orbits(struct reb_simulation* r, char* filename);
DLLEXPORT void reb_simulation_output_ascii(struct reb_simulation* r, char* filename);
DLLEXPORT void reb_simulation_output_velocity_dispersion(struct reb_simulation* r, char* filename);
DLLEXPORT int reb_simulation_output_check(struct reb_simulation* r, double interval);
DLLEXPORT int reb_simulation_output_screenshot(struct reb_simulation* r, const char* filename);
DLLEXPORT void reb_simulation_step(struct reb_simulation* const r);
DLLEXPORT void reb_simulation_steps(struct reb_simulation* const r, unsigned int N_steps);
DLLEXPORT enum REB_STATUS reb_simulation_integrate(struct reb_simulation* const r, double tmax);
DLLEXPORT void reb_simulation_synchronize(struct reb_simulation* r);
DLLEXPORT void reb_simulation_move_to_hel(struct reb_simulation* const r);
DLLEXPORT void reb_simulation_move_to_com(struct reb_simulation* const r);
DLLEXPORT void reb_simulation_imul(struct reb_simulation* r, double scalar_pos, double scalar_vel);
DLLEXPORT int reb_simulation_iadd(struct reb_simulation* r, struct reb_simulation* r2);
DLLEXPORT int reb_simulation_isub(struct reb_simulation* r, struct reb_simulation* r2);
DLLEXPORT void reb_simulation_two_largest_particles(struct reb_simulation* r, int* p1, int* p2);
DLLEXPORT double reb_simulation_energy(struct reb_simulation* const r);
DLLEXPORT struct reb_vec3d reb_simulation_angular_momentum(const struct reb_simulation* const r);
DLLEXPORT struct reb_particle reb_simulation_com(struct reb_simulation* r);
DLLEXPORT struct reb_particle reb_particle_com_of_pair(struct reb_particle p1, struct reb_particle p2);
DLLEXPORT struct reb_particle reb_simulation_com_range(struct reb_simulation* r, int first, int last);
DLLEXPORT double reb_integrator_ias15_timescale(struct reb_simulation* r);
DLLEXPORT void reb_simulation_add(struct reb_simulation* const r, struct reb_particle pt);
DLLEXPORT void reb_simulation_add_fmt(struct reb_simulation* r, const char* fmt, ...);
DLLEXPORT struct reb_particle reb_particle_from_fmt(struct reb_simulation* r, const char* fmt, ...);
DLLEXPORT void reb_simulation_add_plummer(struct reb_simulation* r, int _N, double M, double R);
DLLEXPORT struct reb_particle reb_particle_from_orbit_err(double G, struct reb_particle primary, double m, double a, double e, double i, double Omega, double omega, double f, int* err);
DLLEXPORT struct reb_particle reb_particle_from_orbit(double G, struct reb_particle primary, double m, double a, double e, double i, double Omega, double omega, double f);
DLLEXPORT struct reb_particle reb_particle_from_pal(double G, struct reb_particle primary, double m, double a, double lambda, double k, double h, double ix, double iy);
DLLEXPORT struct reb_particle reb_particle_nan(void);
DLLEXPORT void reb_simulation_remove_all_particles(struct reb_simulation* const r);
DLLEXPORT int reb_simulation_remove_particle(struct reb_simulation* const r, int index, int keep_sorted);
DLLEXPORT int reb_simulation_remove_particle_by_hash(struct reb_simulation* const r, uint32_t hash, int keep_sorted);
DLLEXPORT struct reb_particle* reb_simulation_particle_by_hash(struct reb_simulation* const r, uint32_t hash);
DLLEXPORT struct reb_particle reb_simulation_particle_by_hash_mpi(struct reb_simulation* const r, uint32_t hash);
DLLEXPORT int reb_simulation_particle_index(struct reb_particle* p);
DLLEXPORT void reb_particle_isub(struct reb_particle* p1, struct reb_particle* p2);
DLLEXPORT void reb_particle_iadd(struct reb_particle* p1, struct reb_particle* p2);
DLLEXPORT void reb_particle_imul(struct reb_particle* p1, double value);
DLLEXPORT double reb_particle_distance(struct reb_particle* p1, struct reb_particle* p2);
DLLEXPORT int reb_particle_diff(struct reb_particle p1, struct reb_particle p2);
DLLEXPORT void reb_simulation_init_megno(struct reb_simulation* const r);
DLLEXPORT void reb_simulation_init_megno_seed(struct reb_simulation* const r, unsigned int seed);
DLLEXPORT double reb_simulation_megno(struct reb_simulation* r);
DLLEXPORT double reb_simulation_lyapunov(struct reb_simulation* r);
DLLEXPORT double reb_integrator_mercurius_L_mercury(const struct reb_simulation* const r, double d, double dcrit); DLLEXPORT double reb_integrator_mercurius_L_infinity(const struct reb_simulation* const r, double d, double dcrit);
DLLEXPORT double reb_integrator_mercurius_L_C4(const struct reb_simulation* const r, double d, double dcrit);
DLLEXPORT double reb_integrator_mercurius_L_C5(const struct reb_simulation* const r, double d, double dcrit);
DLLEXPORT int reb_integrator_trace_switch_peri_default(struct reb_simulation* const r, const unsigned int j);
DLLEXPORT int reb_integrator_trace_switch_peri_none(struct reb_simulation* const r, const unsigned int j);
DLLEXPORT int reb_integrator_trace_switch_default(struct reb_simulation* const r, const unsigned int i, const unsigned int j);
DLLEXPORT enum REB_COLLISION_RESOLVE_OUTCOME reb_collision_resolve_halt(struct reb_simulation* const r, struct reb_collision c); DLLEXPORT enum REB_COLLISION_RESOLVE_OUTCOME reb_collision_resolve_hardsphere(struct reb_simulation* const r, struct reb_collision c);
DLLEXPORT enum REB_COLLISION_RESOLVE_OUTCOME reb_collision_resolve_merge(struct reb_simulation* const r, struct reb_collision c);
DLLEXPORT double reb_random_uniform(struct reb_simulation* r, double min, double max);
DLLEXPORT double reb_random_powerlaw(struct reb_simulation* r, double min, double max, double slope);
DLLEXPORT double reb_random_normal(struct reb_simulation* r, double variance);
DLLEXPORT double reb_random_rayleigh(struct reb_simulation* r, double sigma);
DLLEXPORT uint32_t reb_hash(const char* str);
DLLEXPORT double reb_mod2pi(double f);
DLLEXPORT double reb_M_to_f(double e, double M);
DLLEXPORT double reb_E_to_f(double e, double M);
DLLEXPORT double reb_M_to_E(double e, double M);
struct reb_simulationarchive{
FILE* inf; char* filename; int version; int reb_version_major; int reb_version_minor; int reb_version_patch; double auto_interval; double auto_walltime; uint64_t auto_step; int64_t nblobs; uint64_t* offset; double* t; };
DLLEXPORT struct reb_simulationarchive* reb_simulationarchive_create_from_file(const char* filename);
DLLEXPORT void reb_simulationarchive_free(struct reb_simulationarchive* sa);
struct reb_orbit {
double d; double v; double h; double P; double n; double a; double e; double inc; double Omega; double omega; double pomega; double f; double M; double l; double theta; double T; double rhill; double pal_h; double pal_k; double pal_ix; double pal_iy; struct reb_vec3d hvec; struct reb_vec3d evec; };
DLLEXPORT struct reb_orbit reb_orbit_from_particle(double G, struct reb_particle p, struct reb_particle primary);
struct reb_ode{
unsigned int length; double* y; unsigned int needs_nbody; void* ref; void (*derivatives)(struct reb_ode* const ode, double* const yDot, const double* const y, const double t); void (*getscale)(struct reb_ode* const ode, const double* const y0, const double* const y1); void (*pre_timestep)(struct reb_ode* const ode, const double* const y0); void (*post_timestep)(struct reb_ode* const ode, const double* const y0);
unsigned int N_allocated;
double* scale;
double* C; double** D; double* y1; double* y0Dot; double* yDot; double* yTmp; struct reb_simulation* r; };
DLLEXPORT struct reb_ode* reb_ode_create(struct reb_simulation* r, unsigned int length);
DLLEXPORT void reb_ode_free(struct reb_ode* ode);
struct reb_variational_configuration{
struct reb_simulation* sim; int order; int index; int testparticle; int index_1st_order_a; int index_1st_order_b; double lrescale; };
DLLEXPORT int reb_simulation_add_variation_1st_order(struct reb_simulation* const r, int testparticle);
DLLEXPORT int reb_simulation_add_variation_2nd_order(struct reb_simulation* const r, int testparticle, int index_1st_order_a, int index_1st_order_b);
DLLEXPORT void reb_simulation_rescale_var(struct reb_simulation* const r);
DLLEXPORT struct reb_particle reb_particle_derivative_lambda(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_h(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_k(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_k_k(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_h_h(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_lambda_lambda(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_k_lambda(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_h_lambda(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_k_h(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a_a(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_ix(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_ix_ix(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_iy(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_iy_iy(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_k_ix(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_h_ix(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_lambda_ix(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_lambda_iy(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_h_iy(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_k_iy(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_ix_iy(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a_ix(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a_iy(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a_lambda(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a_h(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a_k(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_a(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_lambda(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_h(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_k(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_ix(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_iy(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_m(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_e(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_e_e(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_inc(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_inc_inc(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_Omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_Omega_Omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_omega_omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_f(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_f_f(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a_e(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a_inc(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a_Omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a_omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_a_f(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_e_inc(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_e_Omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_e_omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_e_f(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_e(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_inc_Omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_inc_omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_inc_f(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_inc(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_omega_Omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_Omega_f(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_Omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_omega_f(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_omega(double G, struct reb_particle primary, struct reb_particle po);
DLLEXPORT struct reb_particle reb_particle_derivative_m_f(double G, struct reb_particle primary, struct reb_particle po);
enum REB_FREQUENCY_ANALYSIS_TYPE {
REB_FREQUENCY_ANALYSIS_MFT = 0,
REB_FREQUENCY_ANALYSIS_FMFT = 1,
REB_FREQUENCY_ANALYSIS_FMFT2 = 2,
};
DLLEXPORT int reb_frequency_analysis(double *output, int nfreq, double minfreq, double maxfreq, enum REB_FREQUENCY_ANALYSIS_TYPE type, double *input, unsigned long ndata);
DLLEXPORT struct reb_rotation reb_rotation_inverse(const struct reb_rotation q);
DLLEXPORT struct reb_rotation reb_rotation_mul(const struct reb_rotation p, const struct reb_rotation q);
DLLEXPORT struct reb_rotation reb_rotation_identity();
DLLEXPORT struct reb_rotation reb_rotation_normalize(const struct reb_rotation q);
DLLEXPORT struct reb_rotation reb_rotation_conjugate(const struct reb_rotation q);
DLLEXPORT struct reb_rotation reb_rotation_init_angle_axis(const double angle, struct reb_vec3d axis);
DLLEXPORT struct reb_rotation reb_rotation_init_from_to(struct reb_vec3d from, struct reb_vec3d to);
DLLEXPORT struct reb_rotation reb_rotation_init_orbit(const double Omega, const double inc, const double omega);
DLLEXPORT struct reb_rotation reb_rotation_init_to_new_axes(struct reb_vec3d newz, struct reb_vec3d newx);
DLLEXPORT struct reb_rotation reb_rotation_slerp(struct reb_rotation q1, struct reb_rotation q2, double t);
DLLEXPORT struct reb_vec3d reb_tools_spherical_to_xyz(const double mag, const double theta, const double phi);
DLLEXPORT void reb_tools_xyz_to_spherical(struct reb_vec3d const xyz, double* mag, double* theta, double* phi);
DLLEXPORT struct reb_vec3d reb_vec3d_mul(const struct reb_vec3d v, const double s);
DLLEXPORT struct reb_vec3d reb_vec3d_add(const struct reb_vec3d v, const struct reb_vec3d w);
DLLEXPORT double reb_vec3d_length_squared(const struct reb_vec3d v);
DLLEXPORT double reb_vec3d_dot(const struct reb_vec3d a, const struct reb_vec3d b);
DLLEXPORT struct reb_vec3d reb_vec3d_cross(const struct reb_vec3d a, const struct reb_vec3d b);
DLLEXPORT struct reb_vec3d reb_vec3d_normalize(const struct reb_vec3d v);
DLLEXPORT struct reb_vec3d reb_vec3d_rotate(struct reb_vec3d v, const struct reb_rotation q);
DLLEXPORT void reb_vec3d_irotate(struct reb_vec3d *v, const struct reb_rotation q);
DLLEXPORT void reb_particle_irotate(struct reb_particle* p, const struct reb_rotation q);
DLLEXPORT void reb_simulation_irotate(struct reb_simulation* const sim, const struct reb_rotation q);
DLLEXPORT void reb_rotation_to_orbital(struct reb_rotation q, double* Omega, double* inc, double* omega);
#ifdef MPI
void reb_mpi_init(struct reb_simulation* const r);
void reb_mpi_finalize(struct reb_simulation* const r);
#endif
#ifdef OPENMP
DLLEXPORT void reb_omp_set_num_threads(int num_threads);
#endif
struct reb_orbit_opengl {
float x,y,z;
float a, e, f;
float omega, Omega, inc;
};
struct reb_vec3df {
float x,y,z;
};
struct reb_vec4df {
float x,y,z,r;
};
struct reb_server_data {
struct reb_simulation* r;
void* screenshot; size_t N_screenshot; enum REB_STATUS status_before_screenshot;
int port;
int need_copy;
int ready;
#ifdef SERVER
int mutex_locked_by_integrate; #ifdef _WIN32
SOCKET socket;
HANDLE mutex; #else
int socket;
pthread_mutex_t mutex; pthread_t server_thread;
#endif #endif };
struct reb_display_settings {
struct reb_mat4df view;
int spheres; int pause; int wire; unsigned int breadcrumbs; int onscreentext; int onscreenhelp; int multisample; int ghostboxes; int reference; };
struct reb_display_data {
struct reb_display_settings s;
struct reb_simulation* r;
struct reb_simulation* r_copy;
void* screenshot; struct reb_vec4df* particle_data;
struct reb_orbit_opengl* orbit_data;
uint64_t N_allocated;
double mouse_x;
double mouse_y;
double retina;
int take_one_screenshot;
#ifndef _WIN32
int need_copy;
pthread_mutex_t mutex; pthread_t compute_thread;
#endif #ifdef __EMSCRIPTEN__
int connection_status;
#endif
uint64_t breadcrumb_last_steps_done;
unsigned int breadcrumb_N_allocated;
unsigned int breadcrumb_current_index;
unsigned int mouse_action;
unsigned int key_mods;
unsigned int particle_buffer;
unsigned int particle_buffer_current;
unsigned int orbit_buffer;
unsigned int orbit_buffer_current;
void* window;
struct {
unsigned int texture;
unsigned int program;
unsigned int vao;
unsigned int pos_location;
unsigned int ypos_location;
unsigned int scale_location;
unsigned int aspect_location;
unsigned int screen_aspect_location;
unsigned int rotation_location;
unsigned int texture_location;
unsigned int charval_buffer;
} shader_simplefont;
struct {
unsigned int program;
unsigned int box_vao;
unsigned int cross_vao;
unsigned int ruler_vao;
unsigned int mvp_location;
unsigned int color_location;
} shader_box;
struct {
unsigned int mvp_location;
unsigned int color_location;
unsigned int current_index_location;
unsigned int breadcrumb_N_location;
unsigned int N_real_location;
unsigned int program;
unsigned int particle_vao;
} shader_point;
struct {
unsigned int mvp_location;
unsigned int program;
unsigned int particle_vao_current;
unsigned int particle_vao;
} shader_sphere;
struct {
unsigned int mvp_location;
unsigned int current_index_location;
unsigned int breadcrumb_N_location;
unsigned int N_real_location;
unsigned int vertex_count_location;
unsigned int program;
unsigned int particle_vao_current;
unsigned int particle_vao;
unsigned int vertex_count;
} shader_orbit;
struct {
unsigned int mvp_location;
unsigned int vertex_count_location;
unsigned int program;
unsigned int particle_vao_current;
unsigned int vertex_count;
} shader_plane;
};
DLLEXPORT void reb_simulation_add_display_settings(struct reb_simulation* r);
DLLEXPORT struct reb_mat4df reb_mat4df_identity();
DLLEXPORT struct reb_mat4df reb_mat4df_scale(struct reb_mat4df m, float x, float y, float z);
DLLEXPORT void reb_mat4df_print(struct reb_mat4df m);
DLLEXPORT int reb_mat4df_eq(struct reb_mat4df A, struct reb_mat4df B);
DLLEXPORT struct reb_vec3df reb_mat4df_get_scale(struct reb_mat4df m);
DLLEXPORT struct reb_mat4df reb_mat4df_translate(struct reb_mat4df m, float x, float y, float z);
DLLEXPORT struct reb_mat4df reb_mat4df_multiply(struct reb_mat4df A, struct reb_mat4df B);
DLLEXPORT struct reb_mat4df reb_rotation_to_mat4df(struct reb_rotation A);
DLLEXPORT struct reb_mat4df reb_mat4df_ortho(float l, float r, float b, float t, float n, float f);
void reb_sigint_handler(int signum);
struct reb_simulationarchive_blob {
int32_t index; int32_t offset_prev; int32_t offset_next; };
struct reb_binary_field_descriptor {
uint32_t type; enum {
REB_DOUBLE = 0,
REB_INT = 1,
REB_UINT = 2, REB_UINT32 = 3,
REB_INT64 = 4,
REB_UINT64 = 5,
REB_VEC3D = 7,
REB_PARTICLE = 8,
REB_POINTER = 9,
REB_POINTER_ALIGNED = 10, REB_DP7 = 11, REB_OTHER = 12, REB_FIELD_END = 13, REB_FIELD_NOT_FOUND = 14, REB_PARTICLE4 = 15, REB_POINTER_FIXED_SIZE = 16, } dtype;
char name[1024];
size_t offset; size_t offset_N; size_t element_size; };
DLLEXPORT extern const struct reb_binary_field_descriptor reb_binary_field_descriptor_list[]; DLLEXPORT struct reb_binary_field_descriptor reb_binary_field_descriptor_for_type(int type);
DLLEXPORT struct reb_binary_field_descriptor reb_binary_field_descriptor_for_name(const char* name);
enum reb_simulation_binary_error_codes {
REB_SIMULATION_BINARY_WARNING_NONE = 0,
REB_SIMULATION_BINARY_ERROR_NOFILE = 1,
REB_SIMULATION_BINARY_WARNING_VERSION = 2,
REB_SIMULATION_BINARY_WARNING_POINTERS = 4,
REB_SIMULATION_BINARY_WARNING_PARTICLES = 8,
REB_SIMULATION_BINARY_ERROR_FILENOTOPEN = 16,
REB_SIMULATION_BINARY_ERROR_OUTOFRANGE = 32,
REB_SIMULATION_BINARY_ERROR_SEEK = 64,
REB_SIMULATION_BINARY_WARNING_FIELD_UNKOWN = 128,
REB_SIMULATION_BINARY_ERROR_INTEGRATOR = 256,
REB_SIMULATION_BINARY_WARNING_CORRUPTFILE = 512,
REB_SIMULATION_BINARY_ERROR_OLD = 1024,
};
struct reb_binary_field { uint32_t type; uint64_t size; };
DLLEXPORT void reb_simulation_init(struct reb_simulation* r); DLLEXPORT void reb_simulation_update_acceleration(struct reb_simulation* r); DLLEXPORT void reb_simulation_update_tree(struct reb_simulation* const r);
DLLEXPORT int reb_simulation_get_next_message(struct reb_simulation* const r, char* const buf); DLLEXPORT int reb_check_fp_contract(); DLLEXPORT size_t reb_simulation_struct_size();
DLLEXPORT char* reb_simulation_diff_char(struct reb_simulation* r1, struct reb_simulation* r2); DLLEXPORT void reb_simulation_set_collision_resolve(struct reb_simulation* r, enum REB_COLLISION_RESOLVE_OUTCOME (*resolve) (struct reb_simulation* const r, struct reb_collision c)); DLLEXPORT void reb_simulation_get_serialized_particle_data(struct reb_simulation* r, uint32_t* hash, double* m, double* radius, double (*xyz)[3], double (*vxvyvz)[3], double (*xyzvxvyvz)[6]); DLLEXPORT void reb_simulation_set_serialized_particle_data(struct reb_simulation* r, uint32_t* hash, double* m, double* radius, double (*xyz)[3], double (*vxvyvz)[3], double (*xyzvxvyvz)[6]); DLLEXPORT void reb_simulation_output_free_stream(char* buf);
DLLEXPORT struct reb_particle reb_simulation_jacobi_com(struct reb_particle* p); DLLEXPORT struct reb_orbit reb_orbit_from_particle_err(double G, struct reb_particle p, struct reb_particle primary, int* err);
DLLEXPORT void reb_simulation_create_from_simulationarchive_with_messages(struct reb_simulation* r, struct reb_simulationarchive* sa, int64_t snapshot, enum reb_simulation_binary_error_codes* warnings);
DLLEXPORT void reb_simulation_copy_with_messages(struct reb_simulation* r_copy, struct reb_simulation* r, enum reb_simulation_binary_error_codes* warnings); DLLEXPORT void reb_simulationarchive_init_from_buffer_with_messages(struct reb_simulationarchive* sa, char* buf, size_t size, struct reb_simulationarchive* sa_index, enum reb_simulation_binary_error_codes* warnings);
DLLEXPORT void reb_simulationarchive_create_from_file_with_messages(struct reb_simulationarchive* sa, const char* filename, struct reb_simulationarchive* sa_index, enum reb_simulation_binary_error_codes* warnings);
DLLEXPORT void reb_simulationarchive_free_pointers(struct reb_simulationarchive* sa);
DLLEXPORT void reb_particles_transform_inertial_to_jacobi_posvel(const struct reb_particle* const particles, struct reb_particle* const p_j, const struct reb_particle* const p_mass, const unsigned int N, const unsigned int N_active); DLLEXPORT void reb_particles_transform_inertial_to_jacobi_posvelacc(const struct reb_particle* const particles, struct reb_particle* const p_j, const struct reb_particle* const p_mass, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_inertial_to_jacobi_acc(const struct reb_particle* const particles, struct reb_particle* const p_j,const struct reb_particle* const p_mass, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_jacobi_to_inertial_posvel(struct reb_particle* const particles, const struct reb_particle* const p_j, const struct reb_particle* const p_mass, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_jacobi_to_inertial_pos(struct reb_particle* const particles, const struct reb_particle* const p_j, const struct reb_particle* const p_mass, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_jacobi_to_inertial_acc(struct reb_particle* const particles, const struct reb_particle* const p_j, const struct reb_particle* const p_mass, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_free(void* p);
DLLEXPORT void reb_particles_transform_inertial_to_democraticheliocentric_posvel(const struct reb_particle* const particles, struct reb_particle* const p_h, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_democraticheliocentric_to_inertial_pos(struct reb_particle* const particles, const struct reb_particle* const p_h, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_democraticheliocentric_to_inertial_posvel(struct reb_particle* const particles, const struct reb_particle* const p_h, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_inertial_to_whds_posvel(const struct reb_particle* const particles, struct reb_particle* const p_h, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_whds_to_inertial_pos(struct reb_particle* const particles, const struct reb_particle* const p_h, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_whds_to_inertial_posvel(struct reb_particle* const particles, const struct reb_particle* const p_h, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_inertial_to_barycentric_posvel(const struct reb_particle* const particles, struct reb_particle* const p_b, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_barycentric_to_inertial_pos(struct reb_particle* const particles, const struct reb_particle* const p_b, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_barycentric_to_inertial_posvel(struct reb_particle* const particles, const struct reb_particle* const p_b, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_inertial_to_barycentric_acc(const struct reb_particle* const particles, struct reb_particle* const p_b, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_particles_transform_barycentric_to_inertial_acc(struct reb_particle* const particles, const struct reb_particle* const p_b, const unsigned int N, const unsigned int N_active);
DLLEXPORT void reb_whfast_kepler_solver(const struct reb_simulation* const r, struct reb_particle* const restrict p_j, const double M, unsigned int i, double _dt);
DLLEXPORT void reb_integrator_ias15_reset(struct reb_simulation* r); DLLEXPORT void reb_integrator_ias15_step(struct reb_simulation* r); DLLEXPORT void reb_integrator_whfast_from_inertial(struct reb_simulation* const r); DLLEXPORT void reb_integrator_whfast_to_inertial(struct reb_simulation* const r); DLLEXPORT void reb_integrator_whfast_reset(struct reb_simulation* r); DLLEXPORT int reb_integrator_whfast_init(struct reb_simulation* const r); DLLEXPORT void reb_whfast_interaction_step(struct reb_simulation* const r, const double _dt);DLLEXPORT void reb_whfast_jump_step(const struct reb_simulation* const r, const double _dt); DLLEXPORT void reb_whfast_kepler_step(const struct reb_simulation* const r, const double _dt); DLLEXPORT void reb_whfast_com_step(const struct reb_simulation* const r, const double _dt); #endif