libgravix2  0.1.0
A fast simulation of attractive forces acting on point-like particles embedded onto the surface of a sphere.
api.h
Go to the documentation of this file.
1 
55 #pragma once
56 
57 #include "libgravix2/libgravix2_export.h"
58 #include <stdint.h>
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
69 GRVX_EXPORT const char *grvx_version(void);
70 
71 struct GrvxPlanets;
72 
80 
89  double x[100][3];
90  double v[100][3];
91 };
92 
103 GRVX_EXPORT GrvxPlanetsHandle grvx_new_planets(uint32_t n);
104 
111 GRVX_EXPORT void grvx_delete_planets(GrvxPlanetsHandle handle);
112 
119 GRVX_EXPORT uint32_t grvx_count_planets(GrvxPlanetsHandle handle);
120 
135 GRVX_EXPORT int32_t grvx_set_planet(GrvxPlanetsHandle handle,
136  uint32_t i,
137  double lat,
138  double lon);
139 
152 GRVX_EXPORT int32_t grvx_get_planet(GrvxPlanetsHandle handle,
153  uint32_t i,
154  double *lat,
155  double *lon);
156 
167 GRVX_EXPORT uint32_t grvx_pop_planet(GrvxPlanetsHandle handle);
168 
176 
187 GRVX_EXPORT GrvxTrajectoryBatch grvx_new_missiles(uint32_t n);
188 
194 GRVX_EXPORT void grvx_delete_missiles(GrvxTrajectoryBatch batch);
195 
207 GRVX_EXPORT struct GrvxTrajectory *
209 
238 GRVX_EXPORT int32_t grvx_init_missile(struct GrvxTrajectory *trj,
239  double lat,
240  double lon,
241  double v,
242  double dlat,
243  double dlon);
244 
267 GRVX_EXPORT int32_t grvx_launch_missile(struct GrvxTrajectory *trj,
268  GrvxPlanetsHandle planets_handle,
269  uint32_t planet_id,
270  double v_abs,
271  double psi);
272 
309 GRVX_EXPORT uint32_t grvx_propagate_missile(struct GrvxTrajectory *trj,
310  GrvxPlanetsHandle planets,
311  double h,
312  int32_t *premature);
313 
321 GRVX_EXPORT double grvx_lat(double z);
322 
331 GRVX_EXPORT double grvx_lon(double x, double y);
332 
344 GRVX_EXPORT double
345 grvx_vlat(double vx, double vy, double vz, double lat, double lon);
346 
357 GRVX_EXPORT double grvx_vlon(double vx, double vy, double vz, double lon);
358 
368 GRVX_EXPORT double grvx_v_esc(void);
369 
379 GRVX_EXPORT double grvx_v_scrcl(double r);
380 
398 GRVX_EXPORT double grvx_orb_period(double v0, double h);
399 
415 GRVX_EXPORT void grvx_perturb_measurement(GrvxPlanetsHandle planets_handle,
416  uint32_t planet_id,
417  double angular_error,
418  double *lat,
419  double *lon);
420 
444 struct GrvxConfig {
454  const char *pot_type;
455 
476  int32_t n_pot;
477 
487 
497  int32_t int_steps;
498 
507  double min_dist;
508 
515  const char *composition_scheme;
516 
522  int32_t n_stages;
523 };
524 
533 GRVX_EXPORT struct GrvxConfig *grvx_get_config(void);
534 
543 GRVX_EXPORT void grvx_free_config(struct GrvxConfig *cfg);
544 
545 #ifdef __cplusplus
546 } // extern "C"
547 #endif
548  // end of group API
GRVX_EXPORT double grvx_v_scrcl(double r)
Velocity of a missile on a small circle for isolated planets.
Definition: pot.c:107
struct GrvxPlanets * GrvxPlanetsHandle
Handle to a set of planets forming a closed universe.
Definition: api.h:79
GRVX_EXPORT double grvx_lat(double z)
Computes the latitudinal position, , from Cartesian coordinates.
Definition: helpers.c:8
GRVX_EXPORT const char * grvx_version(void)
Returns the version of the library.
Definition: version.c:4
GRVX_EXPORT double grvx_vlon(double vx, double vy, double vz, double lon)
Computes the (scaled) longitudinal speed, , from Cartesian coordinates.
Definition: helpers.c:31
GRVX_EXPORT void grvx_delete_missiles(GrvxTrajectoryBatch batch)
Deletes a batch of missiles and frees the allocated memory.
Definition: missile.c:17
GRVX_EXPORT GrvxTrajectoryBatch grvx_new_missiles(uint32_t n)
Creates a new batch of uninitialized missiles.
GRVX_EXPORT int32_t grvx_init_missile(struct GrvxTrajectory *trj, double lat, double lon, double v, double dlat, double dlon)
Initializes the position and velocity of a missile on the sphere.
Definition: missile.c:28
GRVX_EXPORT double grvx_lon(double x, double y)
Computes the longitudinal position, , from Cartesian coordinates.
Definition: helpers.c:13
GRVX_EXPORT GrvxPlanetsHandle grvx_new_planets(uint32_t n)
Creates a new planets handle.
GRVX_EXPORT void grvx_perturb_measurement(GrvxPlanetsHandle planets_handle, uint32_t planet_id, double angular_error, double *lat, double *lon)
Perturbs measurement by assuming finite angular resolution.
Definition: missile.c:242
GRVX_EXPORT struct GrvxTrajectory * grvx_get_trajectory(GrvxTrajectoryBatch batch, uint32_t i)
Extracts a missile by ID from the given missile batch.
struct GrvxTrajectory * GrvxTrajectoryBatch
Handle to a batch of trajectories.
Definition: api.h:175
GRVX_EXPORT void grvx_delete_planets(GrvxPlanetsHandle handle)
Deletes all planets of the associated handle and frees the allocated memory.
Definition: planet.c:17
GRVX_EXPORT uint32_t grvx_count_planets(GrvxPlanetsHandle handle)
Counts the planets.
Definition: planet.c:23
GRVX_EXPORT int32_t grvx_set_planet(GrvxPlanetsHandle handle, uint32_t i, double lat, double lon)
Initializes or overwrites the spatial position of a planet.
GRVX_EXPORT uint32_t grvx_pop_planet(GrvxPlanetsHandle handle)
Removes the last planet from the universe.
Definition: planet.c:64
GRVX_EXPORT int32_t grvx_get_planet(GrvxPlanetsHandle handle, uint32_t i, double *lat, double *lon)
Retrieves the spatial position of a planet.
GRVX_EXPORT struct GrvxConfig * grvx_get_config(void)
Returns static configuration.
Definition: config.c:7
GRVX_EXPORT double grvx_v_esc(void)
Escape velocity for isolated planets.
Definition: pot.c:96
GRVX_EXPORT uint32_t grvx_propagate_missile(struct GrvxTrajectory *trj, GrvxPlanetsHandle planets, double h, int32_t *premature)
Propagates a missile in the gravitational force field of planets.
GRVX_EXPORT double grvx_orb_period(double v0, double h)
Orbital period for isolated planets.
Definition: missile.c:196
GRVX_EXPORT double grvx_vlat(double vx, double vy, double vz, double lat, double lon)
Computes the latitudinal speed, , from Cartesian coordinates.
Definition: helpers.c:18
GRVX_EXPORT void grvx_free_config(struct GrvxConfig *cfg)
Frees GrvxConfig instance.
Definition: config.c:28
GRVX_EXPORT int32_t grvx_launch_missile(struct GrvxTrajectory *trj, GrvxPlanetsHandle planets_handle, uint32_t planet_id, double v_abs, double psi)
Initializes a missile on the rim of a given planet.
Static configurations.
Definition: api.h:444
int32_t int_steps
Number of integration steps between trajectory points.
Definition: api.h:497
double min_dist
Minimal allowed distance between missiles and planets.
Definition: api.h:507
int32_t n_pot
Approximation order of potential.
Definition: api.h:476
const char * pot_type
Type of potential.
Definition: api.h:454
int32_t trajectory_size
Size of trajectory.
Definition: api.h:486
int32_t n_stages
Number of stages of the composition method.
Definition: api.h:522
const char * composition_scheme
Composition method of integrator.
Definition: api.h:515
Set of planets.
Definition: planet.h:20
Sequence of spatial and velocity data of a missile.
Definition: api.h:88
double x[100][3]
Definition: api.h:89
double v[100][3]
Definition: api.h:90