General purpose histogram handling routines.
More...
|
#define | BU_HIST_NULL ((struct bu_hist *)0) |
|
#define | BU_CK_HIST(_p) BU_CKMAG(_p, BU_HIST_MAGIC, "struct bu_hist") |
|
#define | BU_HIST_INIT(_hp) |
|
#define | BU_HIST_INIT_ZERO {BU_HIST_MAGIC, 0.0, 0.0, 0.0, 0, 0, NULL} |
|
#define | BU_HIST_IS_INITIALIZED(_hp) (((struct bu_hist *)(_hp) != BU_HIST_NULL) && LIKELY((_hp)->magic == BU_HIST_MAGIC)) |
|
#define | BU_HIST_TALLY(_hp, _val) |
|
#define | BU_HIST_TALLY_MULTIPLE(_hp, _val, _count) |
|
General purpose histogram handling routines.
The subroutine bu_hist_range() is used to record items that may extend across multiple "bin"s.
◆ BU_HIST_NULL
#define BU_HIST_NULL ((struct bu_hist *)0) |
◆ BU_CK_HIST
assert the integrity of a bu_hist struct.
Definition at line 64 of file hist.h.
◆ BU_HIST_INIT
#define BU_HIST_INIT |
( |
|
_hp | ) |
|
Value: { \
(_hp)->hg_min = (_hp)->hg_max = (_hp)->hg_clumpsize = 0.0; \
(_hp)->hg_nsamples = (_hp)->hg_nbins = 0; \
(_hp)->hg_bins = NULL; \
}
initialize a bu_hist struct without allocating any memory.
Definition at line 69 of file hist.h.
◆ BU_HIST_INIT_ZERO
#define BU_HIST_INIT_ZERO {BU_HIST_MAGIC, 0.0, 0.0, 0.0, 0, 0, NULL} |
macro suitable for declaration statement initialization of a bu_hist struct. does not allocate memory.
Definition at line 80 of file hist.h.
◆ BU_HIST_IS_INITIALIZED
◆ BU_HIST_TALLY
#define BU_HIST_TALLY |
( |
|
_hp, |
|
|
|
_val |
|
) |
| |
Value: { \
if ((_val) <= (_hp)->hg_min) { \
(_hp)->hg_bins[0]++; \
} else if ((_val) >= (_hp)->hg_max) { \
(_hp)->hg_bins[(_hp)->hg_nbins]++; \
} else { \
(_hp)->hg_bins[(int)(((_val)-(_hp)->hg_min)/(_hp)->hg_clumpsize)]++; \
} \
(_hp)->hg_nsamples++; }
Definition at line 88 of file hist.h.
◆ BU_HIST_TALLY_MULTIPLE
#define BU_HIST_TALLY_MULTIPLE |
( |
|
_hp, |
|
|
|
_val, |
|
|
|
_count |
|
) |
| |
Value: { \
int __count = (_count); \
if ((_val) <= (_hp)->hg_min) { \
(_hp)->hg_bins[0] += __count; \
} else if ((_val) >= (_hp)->hg_max) { \
(_hp)->hg_bins[(_hp)->hg_nbins] += __count; \
} else { \
(_hp)->hg_bins[(int)(((_val)-(_hp)->hg_min)/(_hp)->hg_clumpsize)] += __count; \
} \
(_hp)->hg_nsamples += __count; }
Definition at line 98 of file hist.h.
◆ bu_hist_t
◆ bu_hist_free()
void bu_hist_free |
( |
struct bu_hist * |
histp | ) |
|
◆ bu_hist_init()
Initialize a bu_hist structure.
It is expected that the structure is junk upon entry.
◆ bu_hist_range()
◆ bu_hist_pr()
void bu_hist_pr |
( |
const struct bu_hist * |
histp, |
|
|
const char * |
title |
|
) |
| |