SMILE
v2.5
Schwarzschild Modelling Interactive expLoratory Environment
|
provides simplified C interface to smile::CPotential class More...
Typedefs | |
typedef struct smilePotential | smilePotential |
Functions | |
const smilePotential * | smilepot_create (const char *filename) |
create a potential from parameters provided in an ini file, or from a potential coefs file. More... | |
const smilePotential * | smilepot_create_params (const int numParams, const char *const params[]) |
create a potential from parameters provided as a list of "key=value" strings (as if supplied via command-line arguments). More... | |
const smilePotential * | smilepot_create_from_particles (const int numParams, const char *const params[], const int numPoints, const double x[], const double y[], const double z[], const double mass[]) |
create a potential of a generic expansion type from a set of particles. More... | |
void | smilepot_delete (const smilePotential *pot) |
delete the potential using its appropriate destructor | |
const smilePotential * | smilepot_copy (const smilePotential *pot) |
make a deep copy of the potential using CPotential::clone | |
const char * | smilepot_name (const smilePotential *pot) |
return the SMILE name of the potential, or empty string if the input is NULL | |
double | smilepot_density (const smilePotential *pot, const double xyz[3]) |
return the density at a given location | |
double | smilepot_potential (const smilePotential *pot, const double xyz[3]) |
return the potential at a given location | |
void | smilepot_force (const smilePotential *pot, const double xyz[3], double force[]) |
return forces at a given location xyz in an output array that must be of length 3 | |
void | smilepot_force_deriv (const smilePotential *pot, const double xyz[3], double force[], double forceDeriv[]) |
return forces and force derivatives at a given location xyz in an output array force (of length 3) and forceDeriv (of length 6); the latter one contains dFx/dx, dFy/dy, dFz/dz, dFx/dy, dFy/dz, dFz/dx | |
int | smilepot_export (const smilePotential *pot, const char *filename) |
export potential expansion coefficients to a text file; returns 0 if the potential is not of an expansion type, or file could not be created, otherwise 1 | |
provides simplified C interface to smile::CPotential class
This file defines a simplified C interface to SMILE potential machinery. It is built around several functions that operate on pointers to smilePotential struct (which is itself a mere typedef to smile::CPotential, so C++ programs may make use of all other features of smile::CPotential class and associated routines).
A potential is created from a set of parameters provided in a text file *.ini, or from a text file with potential coefficients (BSE, BSECompact, Spline, CylSpline, or Spherical model given by a mass profile as a function of radius), or from a list of parameters given as "name=value" strings, or from a set of point masses.
Several other functions return the values of density, potential and forces at a given location, using the pointer to a previously created potential object. If the creation failed, NULL pointer is passed around without doing any harm.
const smilePotential* smilepot_create | ( | const char * | filename | ) |
create a potential from parameters provided in an ini file, or from a potential coefs file.
[in] | filename | determines the action; depending on the extension different types of potential coefficients will be attempted to load: .coef_bse will attempt to create a BSE potential, *.coef_bsec – BSECompact, .coef_spl – Spline, *.coef_cyl – CylSpline, *.mass – Spherical Otherwise the file is assumed to be an INI file. |
const smilePotential* smilepot_create_from_particles | ( | const int | numParams, |
const char *const | params[], | ||
const int | numPoints, | ||
const double | x[], | ||
const double | y[], | ||
const double | z[], | ||
const double | mass[] | ||
) |
create a potential of a generic expansion type from a set of particles.
[in] | numParams | determines the size of parameter list |
[in] | params | is the array of strings; one of these parameters must be "type=..." defining the potential type, which should be one of the general-purpose potential approximations: "BSE", "BSECompact", "Spline", "CylSpline", "Spherical", "Nbody" (the latter uses a tree-code solver). |
[in] | numPoints | is the size of particle list |
[in] | x | param[in] y, |
[in] | z | are the coordinates of particles and |
[in] | mass | are particle masses. |
const smilePotential* smilepot_create_params | ( | const int | numParams, |
const char *const | params[] | ||
) |
create a potential from parameters provided as a list of "key=value" strings (as if supplied via command-line arguments).
[in] | numParams | determines the size of parameter list |
[in] | params | is the array of strings; one of these parameters must be "type=..." defining the potential type. |