This module implements the ExternalFunc structure referenced by black and glass box structures and external methods. The ExternalFunc structure stores the number of input and output parameters (formal) as well as 'help' string and 'name' string' for each of these 'calls'.
This header also provides functions for ExternalFunc library maintenance. This allows ASCEND to maintain a list of the ExternalFunc requests derived from statements in the model(s). When compilation completes, I suppose it should be possible to alert the user about any external functions that were not able to be resolved.
#include <utilities/ascConfig.h>
#include "relation_util.h"
Include dependency graph for extfunc.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | GlassBoxExternalFunc |
| struct | BBoxInterp |
| struct | BlackBoxExternalFunc |
| struct | MethodExternalFunc |
| struct | ExternalFunc |
Typedefs | |
| typedef int | ExtEvalFunc (int *mode, int *m, int *n, double *x, double *u, double *f, double *g) |
| typedef int | ExtBBoxInitFunc (struct BBoxInterp *interp, struct Instance *data, struct gl_list_t *arglist) |
| typedef void | ExtBBoxFinalFunc (struct BBoxInterp *interp) |
| typedef int | ExtBBoxFunc (struct BBoxInterp *interp, int ninputs, int noutputs, double *inputs, double *outputs, double *jacobian) |
| typedef int | ExtMethodRun (struct Instance *context, struct gl_list_t *args, void *user_data) |
| typedef int | ExtMethodInit (struct Instance *context) |
| typedef int | ExtMethodDestroyFn (void *user_data) |
Enumerations | |
| enum | ExternalFuncType { efunc_ERR = 0, efunc_BlackBox = 10, efunc_GlassBox = 20, efunc_Method = 30 } |
| enum | Calc_status { calc_converged, calc_diverged, calc_fp_error, calc_incorrect_args, calc_error, calc_all_ok } |
| enum | Request_type { bb_none, bb_first_call, bb_last_call, bb_check_args, bb_recalculate, bb_func_eval, bb_deriv_eval, bb_hess_eval, bb_single_step } |
Functions | |
| void | InitExternalFuncLibrary (void) |
| void | DestroyExtFuncLibrary (void) |
| int | AddExternalFunc (struct ExternalFunc *efunc, int force) |
| ASC_DLLSPEC struct ExternalFunc * | LookupExtFunc (CONST char *funcname) |
| ExternalFunc * | RemoveExternalFunc (char *name) |
| void | DestroyExternalFunc (struct ExternalFunc *name) |
| void | PrintExtFuncLibrary (FILE *f) |
| ASC_DLLSPEC char * | WriteExtFuncLibraryString (void) |
| ASC_DLLSPEC void | TraverseExtFuncLibrary (void(*)(void *, void *), void *secondparam) |
| ASC_DLLSPEC unsigned long | NumberInputArgs (CONST struct ExternalFunc *efunc) |
| ASC_DLLSPEC unsigned long | NumberOutputArgs (CONST struct ExternalFunc *efunc) |
| ASC_DLLSPEC CONST char * | ExternalFuncName (CONST struct ExternalFunc *efunc) |
| ASC_DLLSPEC int | CreateUserFunctionMethod (CONST char *name, ExtMethodRun *run, CONST long n_args, CONST char *help, void *user_data, ExtMethodDestroyFn *destroyfn) |
| ExtMethodRun * | GetExtMethodRun (struct ExternalFunc *efunc) |
| void * | GetExtMethodUserData (struct ExternalFunc *efunc) |
| ExtBBoxInitFunc * | GetInitFunc (struct ExternalFunc *efunc) |
| ExtBBoxFunc * | GetValueFunc (struct ExternalFunc *efunc) |
| ExtBBoxFunc * | GetDerivFunc (struct ExternalFunc *efunc) |
| ExtBBoxFunc * | GetDeriv2Func (struct ExternalFunc *efunc) |
| ExtBBoxFinalFunc * | GetFinalFunc (struct ExternalFunc *efunc) |
| double | GetValueFuncTolerance (struct ExternalFunc *efunc) |
| ASC_DLLSPEC int | CreateUserFunctionBlackBox (CONST char *name, ExtBBoxInitFunc *init, ExtBBoxFunc *value, ExtBBoxFunc *deriv, ExtBBoxFunc *deriv2, ExtBBoxFinalFunc *final, CONST unsigned long n_inputs, CONST unsigned long n_outputs, CONST char *help, double inputTolerance) |
| ASC_DLLSPEC int | DefaultExtBBoxInitFunc (struct BBoxInterp *interp, struct Instance *data, struct gl_list_t *arglist) |
| ASC_DLLSPEC int | ErrorExtBBoxValueFunc (struct BBoxInterp *interp, int ninputs, int noutputs, double *inputs, double *outputs, double *jacobian) |
| ASC_DLLSPEC int | DefaultExtBBoxFuncDerivFD (struct BBoxInterp *interp, int ninputs, int noutputs, double *inputs, double *outputs, double *jacobian) |
| ASC_DLLSPEC int | DefaultExtBBoxFuncDeriv2FD (struct BBoxInterp *interp, int ninputs, int noutputs, double *inputs, double *outputs, double *jacobian) |
| ASC_DLLSPEC void | DefaultExtBBoxFinalFunc (struct BBoxInterp *interp) |
| ASC_DLLSPEC int | CreateUserFunctionGlassBox (CONST char *name, ExtEvalFunc *init, ExtEvalFunc **value, ExtEvalFunc **deriv, ExtEvalFunc **deriv2, ExtEvalFunc *final, CONST unsigned long n_inputs, CONST unsigned long n_outputs, CONST char *help) |
| ExtEvalFunc * | GetGlassBoxInit (struct ExternalFunc *efunc) |
| ExtEvalFunc ** | GetValueJumpTable (struct ExternalFunc *efunc) |
| ExtEvalFunc ** | GetDerivJumpTable (struct ExternalFunc *efunc) |
| ExtEvalFunc ** | GetDeriv2JumpTable (struct ExternalFunc *efunc) |
| ExtEvalFunc * | GetGlassBoxFinal (struct ExternalFunc *efunc) |
1.5.1