In this file a description is given of the interface of user stochastic observer functions. When creating your own user stochastic observer class use the following as template. More...
Go to the source code of this file.
Functions | |
void | usr_sobs_create_size (int *memsize, int *retval) |
Implementation that forms part of the create process. | |
void | usr_sobs_create_init (Usr_SObs *sobsdata, void *userdata, int *retval) |
Implementation that forms part of the create process. | |
void | usr_sobs_free (Usr_SObs *sobsdata, void *userdata, int *retval) |
Implementation for freeing the object data and associated resources. | |
void | usr_sobs_create_selection (Usr_SObs *sobsdatain, void *userdata, Usr_SObs *sobsdataout, int *retval) |
Implementation for creating a new stochastic observer that is subset of existing stochastic observer. | |
void | usr_sobs_count (Usr_SObs *sobsdata, int *nmeasr, int *retval) |
Implementation for counting the number of measures in user stochastic observer object. | |
void | usr_sobs_get_description (Usr_SObs *sobsdata) |
Implementation for creating the observation description corresponding to the stochastic observer. | |
void | usr_sobs_get_values (Usr_SObs *sobsdata, CTA_Vector *hvec, int *retval) |
Implementation for getting all values of user stochastic observer object. | |
void | usr_sobs_get_realisation (Usr_SObs *sobsdata, CTA_Vector *hvec, int *retval) |
Implementation for calculating stochastic realizations for all the measurements in a user stochastic observer. | |
void | usr_sobs_get_expectation (Usr_SObs *sobsdata, CTA_Vector *hvec, int *retval) |
Implementation for getting the expectation of the probability density function of the mesurements. | |
void | usr_sobs_evaluate_pdf (Usr_SObs *sobsdata, CTA_Vector *location, CTA_Vector *pdfvalue, int *retval) |
Implementation for getting the value of the probability density function of the mesurements at given location. | |
void | usr_sobs_get_cov_matrix (Usr_SObs *sobsdata, CTA_Matrix *hmatrix, int *retval) |
Implementation for getting all the variances of the measurements in a user stochastic observer. | |
void | usr_sobs_get_variance (Usr_SObs *sobsdata, CTA_Vector *variance, int *varflag, int *retval) |
Implementation for calculating all variances or standard deviations. | |
void | usr_sobs_export (Usr_SObs *sobsdata, void *userdata, int *retval) |
Implementation for exporting user stochastic observer object. | |
void | usr_sobs_get_times (Usr_SObs *sobsdata, CTA_Vector *times, int *retval) |
Implementation for getting all times associated with the measurements. |
In this file a description is given of the interface of user stochastic observer functions. When creating your own user stochastic observer class use the following as template.
The Usr_SObs to which is being referred in this template can be substituted by your own user stochastic observer object.
Step 1: for creating your own user stochastic observer class call the function CTA_SObs_DefineClass().
Example:
typedef CTA_Handle CTA_SObsClass; CTA_Func h_func[CTA_SOBS_NUMFUNC]; CTA_SObsClass my_own_sobs_class; CTA_ObsDescrClass obsdescrclass; //observation descriptor class that is being used by stochastic observer ierr=CTA_Func_Create(" ",&usr_sobs_create_size, hintf, &h_func[CTA_SOBS_CREATE_SIZE]); //...for all implementation functions... CTA_SObs_DefineClass("classname", h_func, obsdescrclass, &my_own_sobs_class);
Making a user stochastic observer class involves the implementation of the following functions:
CTA_SOBS_CREATE_SIZE
CTA_SOBS_CREATE_INIT
CTA_SOBS_FREE
CTA_SOBS_CREATE_SELECTION
CTA_SOBS_COUNT
CTA_SOBS_GET_OBS_DESCRIPTION
CTA_SOBS_GET_VALUES
CTA_SOBS_GET_REALISATION
CTA_SOBS_GET_EXPECTATION
CTA_SOBS_EVALUATE_PDF
CTA_SOBS_GET_COV_MATRIX
CTA_SOBS_GET_VARIANCE
CTA_SOBS_EXPORT
CTA_SOBS_GET_TIMES
For creating an implementation function see documentation of CTA_Func_Create().
Step 2: to create an object of the newly defined stochastic observer class call CTA_SObs_Create() in the same way as creating a CTA_SObs object but with a different class handle, i.e. the user class handle from step 1 above.
Example:
Usr_SObs usrsobs; //user stochastic observer object CTA_Handle userdata = CTA_NULL; CTA_SObs_Create(my_own_sobs_class, &userdata, &usrsobs);
Note 1: with object data is meant only the object itself including pointer(s) to its contents, but not the contents of the stochastic observer.
Definition in file cta_usr_stoch_observer.h.
void usr_sobs_count | ( | Usr_SObs * | sobsdata, | |
int * | nmeasr, | |||
int * | retval | |||
) |
Implementation for counting the number of measures in user stochastic observer object.
sobsdata | IO pointer to user object data | |
nmeasr | O must receive number of measures in object | |
retval | O must receive return value of user implementation function |
void usr_sobs_create_init | ( | Usr_SObs * | sobsdata, | |
void * | userdata, | |||
int * | retval | |||
) |
Implementation that forms part of the create process.
The user stochastic observer object needs to be made ready for use.
sobsdata | I pointer to user object data | |
userdata | IO user data | |
retval | O must receive return value of user implementation function |
void usr_sobs_create_selection | ( | Usr_SObs * | sobsdatain, | |
void * | userdata, | |||
Usr_SObs * | sobsdataout, | |||
int * | retval | |||
) |
Implementation for creating a new stochastic observer that is subset of existing stochastic observer.
sobsdatain | I pointer to object data of in-object | |
userdata | IO user data | |
sobsdataout | IO pointer to object data of out-object | |
retval | O must receive return value of user implementation function |
void usr_sobs_create_size | ( | int * | memsize, | |
int * | retval | |||
) |
Implementation that forms part of the create process.
Must give the memory size of a new user stochastic observer object.
Example:
//in header file: typedef struct { //your own user object data goes here... }USR_SOBS; //user implementation: void usr_sobs_create_size(...){ *memsize = sizeof(USR_SOBS); *retval = CTA_OK; }
memsize | O must receive the number of bytes which are necessary to store one user stochastic observer class, with a pointer to the contents (data), but without the contents themselves | |
retval | O must receive return value of user implementation function |
void usr_sobs_evaluate_pdf | ( | Usr_SObs * | sobsdata, | |
CTA_Vector * | location, | |||
CTA_Vector * | pdfvalue, | |||
int * | retval | |||
) |
Implementation for getting the value of the probability density function of the mesurements at given location.
sobsdata | I pointer to user object data | |
location | I handle of vector with location for evaluating pdf | |
pdfvalue | O handle of vector that must receive result of evaluation; must exist before calling | |
retval | O must receive return value of implementation function |
void usr_sobs_export | ( | Usr_SObs * | sobsdata, | |
void * | userdata, | |||
int * | retval | |||
) |
Implementation for exporting user stochastic observer object.
sobsdata | I pointer to user object data | |
userdata | IO pointer to user data | |
retval | O must receive return value of implementation function |
void usr_sobs_free | ( | Usr_SObs * | sobsdata, | |
void * | userdata, | |||
int * | retval | |||
) |
Implementation for freeing the object data and associated resources.
sobsdata | IO pointer to user object data | |
userdata | IO user data | |
retval | O must receive return value of user implementation function |
void usr_sobs_get_cov_matrix | ( | Usr_SObs * | sobsdata, | |
CTA_Matrix * | hmatrix, | |||
int * | retval | |||
) |
Implementation for getting all the variances of the measurements in a user stochastic observer.
sobsdata | I pointer to user object data | |
hmatrix | O handle of matrix object that must receive the covariance matrix; must exist before calling | |
retval | O must receive return value of implementation function |
void usr_sobs_get_description | ( | Usr_SObs * | sobsdata | ) |
Implementation for creating the observation description corresponding to the stochastic observer.
sobsdata | IO pointer to user object data |
void usr_sobs_get_expectation | ( | Usr_SObs * | sobsdata, | |
CTA_Vector * | hvec, | |||
int * | retval | |||
) |
Implementation for getting the expectation of the probability density function of the mesurements.
sobsdata | I pointer to user object data | |
hvec | O handle of vector that must receive expectation; must exist before calling | |
retval | O must receive return value of implementation function |
void usr_sobs_get_realisation | ( | Usr_SObs * | sobsdata, | |
CTA_Vector * | hvec, | |||
int * | retval | |||
) |
Implementation for calculating stochastic realizations for all the measurements in a user stochastic observer.
sobsdata | I pointer to user object data | |
hvec | O handle of vector that must receive realisation; must exist before calling | |
retval | O must receive return value of implementation function |
void usr_sobs_get_times | ( | Usr_SObs * | sobsdata, | |
CTA_Vector * | times, | |||
int * | retval | |||
) |
Implementation for getting all times associated with the measurements.
sobsdata | I pointer to user object data | |
times | O handle of vector that must receive times; must exist before calling | |
retval | O must receive return value of user implementation function |
void usr_sobs_get_values | ( | Usr_SObs * | sobsdata, | |
CTA_Vector * | hvec, | |||
int * | retval | |||
) |
Implementation for getting all values of user stochastic observer object.
sobsdata | IO pointer to user object data | |
hvec | O handle of vector that must receive the values; must exist before calling; must be of appropriate data type | |
retval | O must receive return value of user implementation function |
void usr_sobs_get_variance | ( | Usr_SObs * | sobsdata, | |
CTA_Vector * | variance, | |||
int * | varflag, | |||
int * | retval | |||
) |
Implementation for calculating all variances or standard deviations.
sobsdata | I pointer to user object data | |
variance | O handle of vector that must receive variances / standard deviations; must exist before calling | |
varflag | I variance flag: CTA_TRUE for calculating variances, CTA_FALSE for standard deviations | |
retval | O must receive return value of implementation function |