/* Describes data structure passed by Content to Starters and Generators. */ #ifndef STA_GEN #define STA_GEN /* pointer to rhs */ typedef EntryPtr(int,IntFuncEntry,()); /* pointer to a function computing partial derivatives */ typedef EntryPtr(FloatHiPtr,DerFuncEntry,()); /* pointer to Starter-generator */ typedef EntryPtr(Int2,StagenPtr,(VoidPtr stagendata)); /* Pointer to functional parameter (hidden from the user) */ typedef EntryPtr(Int2,FuncParamPtr,()); /* pointer to translation routine (decoder: G-point -> {M_points}) */ typedef EntryPtr(Int2,DecoderPtr,(VoidPtr point, FloatHiPtr PNTR indirect, Int2 oper)); /* pointer to Aux functions (part of systems's specification) */ typedef EntryPtr(void,AuxFuncPtr,()); /* Special operation code for decoder */ #define DECODER_INIT -1 /* point is a pointer to StagenData structure */ #define DECODER_TERM -2 #define DECODER_DIM -3 /* returns number of M-points in given G-point */ /* pointer to callback function for point processing */ typedef Uint2 Pointtype, PNTR PointtypePtr; /* type of points */ #define USERPOINT (((Pointtype)1)<<(sizeof(Pointtype)*BITSPERBYTE-1)) /* How to process user defined functions */ #define UDF_IGNORE 0 #define UDF_DETECT 1 /* zeroes */ #define UDF_MONITOR 2 /* values only */ #define UDF_APPEND 3 /* to defining function */ typedef Int2 (PNTR CallbackPtr)(Pointtype type, VoidPtr point, CharPtr msg); /* pointer to callback function for obtaining index of parameter */ /***typedef Int2 (PNTR CallbackGetIndexPtr)(Uint2 Offset);***/ typedef Int2 (PNTR CallbackGetIndexPtr)(VoidPtr DataArea, Uint2 Offset); /* pointer to callback function for obtaining index of parameter */ typedef void (PNTR CallbackUpdateIndexPtr)(Int2 Index); /* interface generator - user defined functions */ typedef int (PNTR CallbackUserFuncPtr)(VoidPtr vector, Int2 num, FloatHiPtr value); /* get the name of a user function */ typedef CharPtr (PNTR CallbackUserFuncNamePtr)(Int2 num); #define NKFP 6 /* Number of Kinds of Functional Paramaters */ /* There are two more: stdlinalg & utilities */ /* Reason flags */ #define RF_DO 1 /* Normal call, compute */ #define RF_CLEAN 2 /* Normal termination, clean up */ #define RF_CRASH 4 /* Exception, clean up */ typedef struct _StagenData { /* pointer to starter and generator Data Areas */ VoidPtr StaPtr; VoidPtr GenPtr; /* pointer to functions that describes dynamical system */ IntFuncEntry Rhs; /* pointer to function that computes 1st-5th order derivatives of Rhs */ DerFuncEntry Der1; DerFuncEntry Der2; DerFuncEntry Der3; DerFuncEntry Der4; DerFuncEntry Der5; /* pointer to Aux functions */ AuxFuncPtr PNTR AuxFunc; /* pointer to callback function */ CallbackPtr ProcessPoint; /* pointer to callback function for obtaining index of parameter */ CallbackGetIndexPtr AskParIndex; /* pointer to callback function for updating value of parameter */ CallbackUpdateIndexPtr UpdatePar; /* pointer to array of real types of detectable points; it maps virtual type codes (1,2,...) to real type codes */ Int2Ptr DetectedTypes; /* pointer to array of dimensions of relevant classes */ Int2Ptr PNTR ClassDim; /* pointer to array of real codes of relevant classes */ Uint2Ptr ClassReal; /* Forward/Backward indicator */ Boolean Forward; /* arrays of pointers to Functional Parameters */ FuncParamPtr PNTR FuncParams[NKFP+2]; /* and thier numbers */ Int2 FuncParamsNum[NKFP+2]; /* pointer to a table which maps sets of test functions values to singularities */ Int1Ptr TestSingMap; /* Bifurcation data produced by a special point processor to be passed to appropriate starter */ FloatHiPtr BifDataOutPtr; size_t BifDataOutLen; FloatHiPtr BifDataInPtr; size_t BifDataInLen; Boolean BifDataInOk; /* TRUE when Bifurcation Data are valid */ /* Continue data - generator */ FloatHiPtr ContDataGenPtr; size_t ContDataGenLen; /* Continue data - starter */ FloatHiPtr ContDataStaPtr; size_t ContDataStaLen; /* Suspend mode flag (1/2 - suspend mode/abort is pending) */ Int1 SuspendIsPending; /* User functions */ Int2 udFuncNum; CallbackUserFuncPtr udFunc; /* Get the name of a user function */ CallbackUserFuncNamePtr udFuncName; /* Reason of call */ Int2 Reason; /*-------------------------------------------------*/ /* The following fields are used for slave sta/gen */ struct _StagenData PNTR Slave; /* for access to slave's pStarter/pGenerator/pDecoder etc */ StagenPtr pStarter; /* filled for slave sta/gen only */ StagenPtr pGenerator; DecoderPtr pDecoder; /*-----------------------------------------------------------*/ /* Starters and Generators should not touch the fields below */ /* arrays of pointers to LibHandles of Functional Parameters */ LibHandle PNTR FuncParamsHandle[NKFP+2]; /* pointer to array of pointers to vectors of values of visible variables for each relevant class */ FloatHiPtr PNTR IndirectValues; /* Pointers to parameter management data */ VoidPtr StaParDesc; VoidPtr GenParDesc; } StagenData, PNTR StagenDataPtr; /***#define ParIndex(dataptr,field) AskParIndex((CharPtr)&(dataptr->field)-(CharPtr)dataptr)***/ /* Get index of particular field */ #define ParIndex(dataptr,field) AskParIndex(dataptr,(CharPtr)&(dataptr->field)-(CharPtr)dataptr) /* UpdatePar(AllParIndices(dataptr)) updates all values */ #define AllParIndices(dataptr) AskParIndex(dataptr,(Uint2)0xFFFF) #define _DEF_INDEX 0 #define _TEST_INDEX 1 #define _STA_INDEX 2 #define _GEN_INDEX 3 #define _ADAPT_INDEX 4 #define _PROC_INDEX 5 #define _STDLINALG_INDEX NKFP #define _UTILITIES_INDEX NKFP+1 #define DefFunc FuncParams[_DEF_INDEX] #define TestFunc FuncParams[_TEST_INDEX] #define StaFunc FuncParams[_STA_INDEX] #define GenFunc FuncParams[_GEN_INDEX] #define AdapterFunc FuncParams[_ADAPT_INDEX] #define ProcFunc FuncParams[_PROC_INDEX] #define DefFuncNum FuncParamsNum[_DEF_INDEX] #define TestFuncNum FuncParamsNum[_TEST_INDEX] #define StaFuncNum FuncParamsNum[_STA_INDEX] #define GenFuncNum FuncParamsNum[_GEN_INDEX] #define AdapterNum FuncParamsNum[_ADAPT_INDEX] #define ProcFuncNum FuncParamsNum[_PROC_INDEX] #define StdLinAlg FuncParams[_STDLINALG_INDEX] #define Utilities FuncParams[_UTILITIES_INDEX] #define StdLinAlgNum FuncParamsNum[_STDLINALG_INDEX] #define UtilitiesNum FuncParamsNum[_UTILITIES_INDEX] #include "stagen1.h" #define ind2_(i,j) ((i)+(((j)*((j)+1))>>1)) #define ind3_(i,j,k) ((i)+(((j)*((j)+1))>>1)+(k)*((k)+1)*((k)+2)/6) #define ind4_(i,j,k,l) (ind3_(i,j,k)+(l)*((l)+1)*((l)+2)*((l)+3)/24) #define ind5_(i,j,k,l,m) (ind4_(i,j,k,l)+(m)*((m)+1)*((m)+2)*((m)+3)*((m)+4)/120) #endif