src/ include/ test/ fig/ objs/
[sddekit.git] / include / sk_hist.h
blob869a468a9e0e2db9ac9f6018e209f58feb9755ce
1 /* Apache 2.0 INS-AMU 2015 */
3 #ifndef SK_HIST_H
4 #define SK_HIST_H
6 /**
7 * t - time of positions in buffer
8 */
9 typedef struct
11 /* nu+1 nu nu nu nd, maxvi */
12 int nd, nu, *lim, *len, *pos, *uvi, *vi, *vi2i, maxvi;
13 /* sum(len) nu nd */
14 double *buf, *maxd, *del, dt, t;
15 } sk_hist;
17 /**
18 * Aids in defining a new function to fill a history buffer.
19 * See ::sk_hist_filler for details of the type signature.
20 * \param name name of function being defined.
22 #define SK_DEFHFILL(name) void name\
23 (void *data, int n, double *t, int *indices, double *buf)
25 /**
26 * Signature of callback to fill a history buffer expected.
27 * \param[in] data user data for history filler function
28 * \param[in] n number of elements in the history buffer
29 * \param[in] t vector of time for each element in history buffer
30 * \param[in] indices variable index for each element in history buffer
31 * \param[out] buf history buffer to fill
33 typedef SK_DEFHFILL((*sk_hist_filler));
35 void sk_hist_init(sk_hist *h, int nd, int *vi, double *vd, double t0, double dt);
37 void sk_hist_free(sk_hist *h);
39 void sk_hist_fill(sk_hist *h, sk_hist_filler filler, void *fill_data);
41 void sk_hist_get(sk_hist *h, double t, double *c);
43 void sk_hist_set(sk_hist *h, double t, double *x);
45 int sk_hist_nbytes(sk_hist *h);
47 /**
48 * Fills the history with zeros.
50 void sk_hist_zero_filler(void *data, int n, double *t, int *indices, double *buf);
52 #endif