|
CSM R5-3
|
implement function table More...
#include <ctype.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <math.h>#include "csmbase.h"Go to the source code of this file.
Macros | |
| #define | CSM_TRUE 1 |
| for type csm_bool | |
| #define | CSM_FALSE 0 |
| for type csm_bool | |
Functions | |
| double | csm_x (csm_function *func, double y) |
| compute x from a given y | |
| double | csm_y (csm_function *func, double x) |
| compute y from a given x | |
| double | csm_dx (csm_function *func, double y) |
| compute delta-x from a given delta-y | |
| double | csm_dy (csm_function *func, double x) |
| compute delta-y from a given delta-x | |
| double | csm_z (csm_function *func, double x, double y) |
| compute z from a given x and y | |
| void | csm_clear (csm_function *func) |
| clear a function | |
| void | csm_free (csm_function *func) |
| free a function-structure | |
| void | csm_def_linear (csm_function *func, double a, double b) |
| define a linear function | |
| csm_bool | csm_def_linear_offset (csm_function *func, double a) |
| re-define the offset of a linear function | |
| csm_bool | csm_fill_1d_table (double *x, double *y, int len, csm_function *func) |
| fill one-dimensional function table from double arrays. | |
| csm_bool | csm_read_1d_table (char *filename, csm_function *func) |
| read parameters of one-dimensional function table | |
| csm_bool | csm_read_2d_table (char *filename, csm_function *func) |
| read parameters of two-dimensional function table | |
| void | csm_init (void) |
| initialize the module | |
| csm_function * | csm_new_function (void) |
| create a new function object | |
| void | csm_pr_func (csm_function *func) |
| dump a new function object | |
This module implements one and two dimensional function tables. The tables can be specified by simple ascii files. The points defined in the file don't have to be in the same distance.
Definition in file csmbase.c.
| double csm_x | ( | csm_function * | func, |
| double | y ) |
| double csm_y | ( | csm_function * | func, |
| double | x ) |
| double csm_dx | ( | csm_function * | func, |
| double | y ) |
| double csm_dy | ( | csm_function * | func, |
| double | x ) |
| double csm_z | ( | csm_function * | func, |
| double | x, | ||
| double | y ) |
| void csm_clear | ( | csm_function * | func | ) |
This function clears the csm_function structure. All allocated memory is released, the internal type is set to CSM_NOTHING.
| func | pointer to the function object |
| void csm_free | ( | csm_function * | func | ) |
This function frees the csm_function structure. All allocated memory is released, even the memory of the basic internal structure. This means that the cmd_function structure becomes invalid and cannot be used again later. Use this function with caution.
| func | pointer to the function object |
| void csm_def_linear | ( | csm_function * | func, |
| double | a, | ||
| double | b ) |
This function initializes a csm_function structure as a linear function (y= a+b*x).
| func | pointer to the function object |
| a | offset of y= a+b*x |
| b | multiplier of y= a+b*x |
| csm_bool csm_def_linear_offset | ( | csm_function * | func, |
| double | a ) |
| csm_bool csm_fill_1d_table | ( | double * | x, |
| double * | y, | ||
| int | len, | ||
| csm_function * | func ) |
This function uses two arrays of double to fill a one-dimensional function table.
| x | an array of double with x coordinate values |
| y | an array of double with y coordinate values |
| len | the length of the table, it's number of rows |
| func | pointer to the function object |
| csm_bool csm_read_1d_table | ( | char * | filename, |
| csm_function * | func ) |
| csm_bool csm_read_2d_table | ( | char * | filename, |
| csm_function * | func ) |
| void csm_init | ( | void | ) |
| csm_function * csm_new_function | ( | void | ) |
This function returns a pointer to a new function object. The object is initialized as an empty function
| void csm_pr_func | ( | csm_function * | func | ) |