BRL-CAD
Collaboration diagram for Histogram Handling:

Files

file  hist.c
 

Data Structures

struct  bu_hist
 

Macros

#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)
 

Typedefs

typedef struct bu_hist bu_hist_t
 

Functions

void bu_hist_free (struct bu_hist *histp)
 
void bu_hist_init (struct bu_hist *histp, fastf_t min, fastf_t max, size_t nbins)
 
void bu_hist_range (struct bu_hist *hp, fastf_t low, fastf_t high)
 
void bu_hist_pr (const struct bu_hist *histp, const char *title)
 

Detailed Description

Macro Definition Documentation

#define BU_HIST_NULL   ((struct bu_hist *)0)

Definition at line 63 of file hist.h.

#define BU_CK_HIST (   _p)    BU_CKMAG(_p, BU_HIST_MAGIC, "struct bu_hist")

assert the integrity of a bu_hist struct.

Definition at line 68 of file hist.h.

Referenced by bu_hist_free(), bu_hist_range(), and hist_pr_suppress().

#define BU_HIST_INIT (   _hp)
Value:
{ \
(_hp)->magic = BU_HIST_MAGIC; \
(_hp)->hg_min = (_hp)->hg_max = (_hp)->hg_clumpsize = 0.0; \
(_hp)->hg_nsamples = (_hp)->hg_nbins = 0; \
(_hp)->hg_bins = NULL; \
}
oldeumate l2 magic
Definition: nmg_mod.c:3843
#define BU_HIST_MAGIC
Definition: magic.h:53

initialize a bu_hist struct without allocating any memory.

Definition at line 73 of file hist.h.

#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 84 of file hist.h.

#define BU_HIST_IS_INITIALIZED (   _hp)    (((struct bu_hist *)(_hp) != BU_HIST_NULL) && LIKELY((_hp)->magic == BU_HIST_MAGIC))

returns truthfully whether a bu_hist has been initialized via BU_HIST_INIT() or BU_HIST_INIT_ZERO.

Definition at line 90 of file hist.h.

#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++; }
if(share_geom)
Definition: nmg_mod.c:3829

Definition at line 92 of file hist.h.

Referenced by rt_ct_measure(), and rt_nugrid_cut().

#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; }
if(share_geom)
Definition: nmg_mod.c:3829

Definition at line 102 of file hist.h.

Typedef Documentation

typedef struct bu_hist bu_hist_t

Definition at line 62 of file hist.h.

Function Documentation

void bu_hist_free ( struct bu_hist histp)

Definition at line 32 of file hist.c.

References BU_CK_HIST, bu_free(), bu_hist::hg_bins, bu_hist::hg_nbins, bu_hist::magic, and UNLIKELY.

Referenced by rt_clean(), and rt_nugrid_cut().

Here is the call graph for this function:

void bu_hist_init ( struct bu_hist histp,
fastf_t  min,
fastf_t  max,
size_t  nbins 
)

Initialize a bu_hist structure.

It is expected that the structure is junk upon entry.

Definition at line 51 of file hist.c.

References bu_calloc(), BU_HIST_MAGIC, bu_hist::hg_bins, bu_hist::hg_clumpsize, bu_hist::hg_max, bu_hist::hg_min, bu_hist::hg_nbins, bu_hist::hg_nsamples, and bu_hist::magic.

Referenced by rt_cut_it(), and rt_nugrid_cut().

Here is the call graph for this function:

void bu_hist_range ( struct bu_hist hp,
fastf_t  low,
fastf_t  high 
)
void bu_hist_pr ( const struct bu_hist histp,
const char *  title 
)

Print a histogram.

Referenced by rt_pr_cut_info().