Image Details
Caption: Figure 5.
Minimal C implementation of galpy's LogarithmicHaloPotential. This figure illustrates the steps necessary for implementing a potential in C in such a way that it can automatically be used in the galpy framework. The top file is a new C file that has the implementation of the potential and its radial and vertical force law. These new C functions need to be declared in the general galpy_potentials.h header file on line 42. The following two files that require editing provide the glue between C and python: integrateFullOrbit.c's parse_leapFuncArgs_Full function contains the code that specifies the functions that implement the forces and the number of parameters (line 52); the python function _parse_pot in integrateFullOrbit.py contains the code that stores the potential parameters in an array that will be passed to the C code (line 61). Finally, the initialization of the LogarithmicHaloPotential instance needs to set the attribute hasC to True, such that all relevant code can automatically use C for speeding up calculations. To use this potential for action–angle calculations in C, more glue needs to be written that is similar to that in integrateFullOrbit.c.
© 2015. The American Astronomical Society. All rights reserved.