Come analyze HEASARC, IRSA, and MAST data in the cloud! The Fornax Initiative is now welcoming all interested beta users.
Calling Model Functions From C++, C, And Fortran
XSPEC supplies standard wrapper routines for all models from C++, C, and Fortran. The names are CXX_modelname, C_modelname, and modelname, respectively. Here modelname is the name of the model. The function interfaces for each language are described in Appendix C. The wrappers are stored in the files funcWrappers.h and funcWrappers.cxx in the XSFunctions directory.
As an example here are the wrappers for the powerlaw model.
void CXX_powerlaw(const RealArray& energyArray, const RealArray& params,
int spectrumNumber, RealArray& fluxArray, RealArray& fluxErrArray,
const string& initString);
void C_powerlaw(const double* energy, int nFlux, const double* params,
int spectrumNumber, double* flux, double* fluxError,
const char* initStr);
void powerLaw(const float* energy, int nFlux, const float* params,
int spectrumNumber, float* flux, float* fluxError);
The second function is intended to be called from C programs, while
Fortran programs may call either the second or the third
(funcWrappers.cxx also includes CERN
<cfortran.h> definitions to make these accessible to Fortran).