BRL-CAD
gqa.c File Reference
#include "common.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <math.h>
#include <limits.h>
#include "bu/parallel.h"
#include "bu/getopt.h"
#include "vmath.h"
#include "raytrace.h"
#include "plot3.h"
#include "sysv.h"
#include "analyze.h"
#include "./ged_private.h"
Include dependency graph for gqa.c:

Go to the source code of this file.

Data Structures

struct  cstate
 
struct  ged_gqa_plot
 
struct  per_obj_data
 
struct  per_region_data
 
struct  cvt_tab
 

Macros

#define ANALYSIS_VOLUME   1
 
#define ANALYSIS_WEIGHT   2
 
#define ANALYSIS_OVERLAPS   4
 
#define ANALYSIS_ADJ_AIR   8
 
#define ANALYSIS_GAP   16
 
#define ANALYSIS_EXP_AIR   32 /* exposed air */
 
#define ANALYSIS_BOX   64
 
#define ANALYSIS_INTERFACES   128
 
#define ANALYSIS_CENTROIDS   256
 
#define ANALYSIS_MOMENTS   512
 
#define ANALYSIS_PLOT_OVERLAPS   1024
 
#define COMMA   ','
 
#define STRCOMMA   ","
 
#define DLOG   if (debug) bu_vls_printf
 
#define A_LENDEN   a_color[0]
 
#define A_LEN   a_color[1]
 
#define A_STATE   a_uptr
 
#define LINE   0
 
#define VOL   1
 
#define WGT   2
 

Functions

int read_units_double (double *val, char *buf, const struct cvt_tab *cvt)
 
int get_densities_from_file (char *name)
 
int get_densities_from_database (struct rt_i *rtip)
 
int overlap (struct application *ap, struct partition *pp, struct region *reg1, struct region *reg2, struct partition *hp)
 
void logoverlap (struct application *ap, const struct partition *pp, const struct bu_ptbl *regiontable, const struct partition *InputHdp)
 
void exposed_air (struct partition *pp, point_t last_out_point, point_t pt, point_t opt)
 
int hit (struct application *ap, struct partition *PartHeadp, struct seg *segs)
 
int miss (struct application *ap)
 
int get_next_row (struct cstate *state)
 
void plane_worker (int cpu, void *ptr)
 
int find_cmd_line_obj (struct per_obj_data *obj_rpt, const char *name)
 
void allocate_per_region_data (struct cstate *state, int start, int ac, const char *av[])
 
void list_report (struct region_pair *list)
 
int options_prep (struct rt_i *rtip, vect_t span)
 
void view_reports (struct cstate *state)
 
int terminate_check (struct cstate *state)
 
void summary_reports (struct cstate *state)
 
int ged_gqa (struct ged *gedp, int argc, const char *argv[])
 

Variables

char * options = "A:a:de:f:g:Gn:N:pP:qrS:s:t:U:u:vV:W:h?"
 
char * options_str = "[-A A|a|b|c|e|g|m|o|p|v|w] [-a az] [-d] [-e el] [-f densityFile] [-g spacing|upper,lower|upper-lower] [-G] [-n nhits] [-N nviews] [-p] [-P ncpus] [-q] [-r] [-S nsamples] [-t overlap_tol] [-U useair] [-u len_units vol_units wt_units] [-v] [-V volume_tol] [-W weight_tol]"
 
struct ged_gqa_plot ged_gqa_plot
 
struct density_entrydensities = NULL
 

Detailed Description

performs a set of quantitative analyses on geometry.

XXX need to look at gap computation

plot the points where overlaps start/stop

Designed to be a framework for 3d sampling of the geometry volume. TODO: Need to move the sample pattern logic into LIBRT.

Definition in file gqa.c.

Macro Definition Documentation

#define ANALYSIS_VOLUME   1

Definition at line 59 of file gqa.c.

Referenced by hit(), options_prep(), and view_reports().

#define ANALYSIS_WEIGHT   2

Definition at line 60 of file gqa.c.

Referenced by hit(), options_prep(), and view_reports().

#define ANALYSIS_OVERLAPS   4

Definition at line 61 of file gqa.c.

Referenced by ged_gqa(), options_prep(), overlap(), summary_reports(), and terminate_check().

#define ANALYSIS_ADJ_AIR   8

Definition at line 62 of file gqa.c.

Referenced by ged_gqa(), hit(), options_prep(), summary_reports(), and terminate_check().

#define ANALYSIS_GAP   16

Definition at line 63 of file gqa.c.

Referenced by ged_gqa(), hit(), options_prep(), summary_reports(), and terminate_check().

#define ANALYSIS_EXP_AIR   32 /* exposed air */

Definition at line 64 of file gqa.c.

Referenced by ged_gqa(), hit(), options_prep(), summary_reports(), and terminate_check().

#define ANALYSIS_BOX   64

Definition at line 65 of file gqa.c.

Referenced by ged_gqa().

#define ANALYSIS_INTERFACES   128

Definition at line 66 of file gqa.c.

#define ANALYSIS_CENTROIDS   256

Definition at line 67 of file gqa.c.

Referenced by ged_gqa(), hit(), and summary_reports().

#define ANALYSIS_MOMENTS   512

Definition at line 68 of file gqa.c.

Referenced by ged_gqa(), hit(), and summary_reports().

#define ANALYSIS_PLOT_OVERLAPS   1024

Definition at line 69 of file gqa.c.

Referenced by ged_gqa(), and overlap().

#define COMMA   ','

Definition at line 75 of file gqa.c.

#define STRCOMMA   ","

Definition at line 76 of file gqa.c.

#define DLOG   if (debug) bu_vls_printf

Definition at line 119 of file gqa.c.

Referenced by options_prep(), and terminate_check().

#define A_LENDEN   a_color[0]

Definition at line 124 of file gqa.c.

#define A_LEN   a_color[1]

Definition at line 125 of file gqa.c.

#define A_STATE   a_uptr

Definition at line 126 of file gqa.c.

#define LINE   0

Definition at line 390 of file gqa.c.

Referenced by ged_gqa(), list_report(), and options_prep().

#define VOL   1

Definition at line 391 of file gqa.c.

Referenced by options_prep(), summary_reports(), and view_reports().

#define WGT   2

Definition at line 392 of file gqa.c.

Referenced by options_prep(), summary_reports(), and view_reports().

Function Documentation

int read_units_double ( double *  val,
char *  buf,
const struct cvt_tab cvt 
)

read_units_double

Read a non-negative floating point value with optional units

Return 1 Failure 0 Success

Definition at line 410 of file gqa.c.

References _ged_current_gedp, BU_FLSTR, bu_strncmp(), bu_vls_printf(), ged::ged_result_str, cvt_tab::name, and cvt_tab::val.

Here is the call graph for this function:

int get_densities_from_file ( char *  name)

Returns 0 on success !0 on failure

Definition at line 745 of file gqa.c.

References _ged_current_gedp, bu_calloc(), bu_free(), bu_malloc(), bu_vls_printf(), GED_ERROR, ged::ged_result_str, and parse_densities_buffer().

Referenced by options_prep().

Here is the call graph for this function:

int get_densities_from_database ( struct rt_i rtip)

Returns 0 on success !0 on failure

Definition at line 788 of file gqa.c.

References _ged_current_gedp, bu_calloc(), bu_free(), bu_malloc(), bu_vls_printf(), rt_binunif_internal::count, directory::d_namep, db_lookup(), GED_ERROR, ged::ged_result_str, rt_db_internal::idb_major_type, rt_db_internal::idb_ptr, rt_binunif_internal::int8, LOOKUP_QUIET, parse_densities_buffer(), RT_CHECK_BINUNIF, rt_db_get_internal(), rt_uniresource, rt_i::rti_dbip, and rt_binunif_internal::u.

Referenced by options_prep().

Here is the call graph for this function:

int overlap ( struct application ap,
struct partition pp,
struct region reg1,
struct region reg2,
struct partition hp 
)

Write end points of partition to the standard output. If this routine return !0, this partition will be dropped from the boolean evaluation.

Returns: 0 to eliminate partition with overlap entirely 1 to retain partition in output list, claimed by reg1 2 to retain partition in output list, claimed by reg2

This routine must be prepared to run in parallel

Definition at line 843 of file gqa.c.

References _ged_current_gedp, application::a_ray, add_unique_pair(), ANALYSIS_OVERLAPS, ANALYSIS_PLOT_OVERLAPS, BN_ADD_VLIST, BN_VLIST_LINE_DRAW, BN_VLIST_LINE_MOVE, BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), bu_vls_printf(), bn_vlblock::free_vlist_hd, ged::ged_result_str, GED_SEM_WORKER, hit::hit_dist, pdv_3line(), pl_color(), partition::pt_inhit, partition::pt_outhit, xray::r_dir, xray::r_pt, region::reg_aircode, region::reg_name, V3ARGS, ged_gqa_plot::vbp, and ged_gqa_plot::vhead.

Referenced by nmg_purge_unwanted_intersection_points(), ON_Intersect(), plane_worker(), and rt_pipe_surf_area().

Here is the call graph for this function:

void logoverlap ( struct application ap,
const struct partition pp,
const struct bu_ptbl regiontable,
const struct partition InputHdp 
)

Does nothing.

Definition at line 915 of file gqa.c.

References BU_CK_PTBL, RT_CK_AP, and RT_CK_PT.

Referenced by plane_worker(), and rt_shootray_simple().

void exposed_air ( struct partition pp,
point_t  last_out_point,
point_t  pt,
point_t  opt 
)

Definition at line 932 of file gqa.c.

References add_unique_pair(), BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), hit::hit_dist, pdv_3line(), pl_color(), partition::pt_inhit, partition::pt_outhit, partition::pt_regionp, and V3ARGS.

Referenced by hit().

Here is the call graph for this function:

int hit ( struct application ap,
struct partition PartHeadp,
struct seg segs 
)
int miss ( struct application ap)

rt_shootray() was told to call this on a miss.

This routine must be prepared to run in parallel

Definition at line 1278 of file gqa.c.

References RT_CK_APPLICATION.

Referenced by plane_worker(), and rt_shootray_simple().

int get_next_row ( struct cstate state)

This routine must be prepared to run in parallel

Definition at line 1290 of file gqa.c.

References bu_semaphore_acquire(), bu_semaphore_release(), GED_SEM_WORKER, cstate::steps, cstate::v, OSL::Strings::v, and cstate::v_axis.

Referenced by plane_worker().

Here is the call graph for this function:

int find_cmd_line_obj ( struct per_obj_data *  obj_rpt,
const char *  name 
)

Definition at line 1432 of file gqa.c.

References _ged_current_gedp, BU_FLSTR, bu_free(), BU_STR_EQUAL, bu_strdup, bu_vls_printf(), GED_ERROR, ged::ged_result_str, and strchr().

Referenced by allocate_per_region_data().

Here is the call graph for this function:

void allocate_per_region_data ( struct cstate state,
int  start,
int  ac,
const char *  av[] 
)

Allocate data structures for tracking statistics on a per-view basis for each of the view, object and region levels.

Definition at line 1461 of file gqa.c.

References bu_calloc(), BU_LIST_FOR, bu_log(), find_cmd_line_obj(), rt_i::HeadRegion, cstate::m_len, cstate::m_lenDensity, cstate::m_lenTorque, cstate::m_moi, cstate::m_poi, cstate::m_volume, cstate::m_weight, rt_i::nregions, region::reg_name, region::reg_udata, cstate::rtip, and cstate::shots.

Referenced by ged_gqa().

Here is the call graph for this function:

void list_report ( struct region_pair list)

list_report

Definition at line 1540 of file gqa.c.

References _ged_current_gedp, BU_LIST_FOR, BU_LIST_IS_EMPTY, bu_vls_printf(), region_pair::coord, region_pair::count, ged::ged_result_str, region_pair::l, LINE, region_pair::max_dist, cvt_tab::name, region_pair::name, region_pair::r, region_pair::r1, region_pair::r2, region::reg_name, V3ARGS, and cvt_tab::val.

Referenced by summary_reports().

Here is the call graph for this function:

int options_prep ( struct rt_i rtip,
vect_t  span 
)

Do some computations prior to raytracing based upon options the user has specified

Returns: 0 continue, ready to go !0 error encountered, terminate processing

Definition at line 1575 of file gqa.c.

References _ged_current_gedp, ANALYSIS_ADJ_AIR, ANALYSIS_EXP_AIR, ANALYSIS_GAP, ANALYSIS_OVERLAPS, ANALYSIS_VOLUME, ANALYSIS_WEIGHT, bu_log(), bu_vls_printf(), DLOG, GED_ERROR, GED_OK, ged::ged_result_str, get_densities_from_database(), get_densities_from_file(), density_entry::grams_per_cu_mm, LINE, cvt_tab::name, cvt_tab::val, VOL, WGT, X, Y, Z, and ZERO.

Referenced by ged_gqa().

Here is the call graph for this function:

void view_reports ( struct cstate state)

Definition at line 1703 of file gqa.c.

References _ged_current_gedp, ANALYSIS_VOLUME, ANALYSIS_WEIGHT, cstate::area, bu_vls_printf(), cstate::curr_view, ged::ged_result_str, cvt_tab::name, cstate::shots, cvt_tab::val, verbose(), VOL, and WGT.

Referenced by ged_gqa().

Here is the call graph for this function:

int terminate_check ( struct cstate state)

Check to see if we are done processing due to some user specified limit being achieved.

Returns: 0 Terminate 1 Continue processing

Definition at line 1880 of file gqa.c.

References _ged_current_gedp, ANALYSIS_ADJ_AIR, ANALYSIS_EXP_AIR, ANALYSIS_GAP, ANALYSIS_OVERLAPS, BU_FLSTR, BU_LIST_FOR, BU_LIST_NON_EMPTY, bu_vls_printf(), DLOG, ged::ged_result_str, rt_i::HeadRegion, region_pair::l, cstate::m_moi, cstate::m_poi, region::reg_name, region::reg_udata, RT_CK_REGION, RT_CK_RTI, cstate::rtip, and verbose().

Referenced by ged_gqa().

Here is the call graph for this function:

int ged_gqa ( struct ged gedp,
int  argc,
const char *  argv[] 
)

Variable Documentation

char* options = "A:a:de:f:g:Gn:N:pP:qrS:s:t:U:u:vV:W:h?"

Definition at line 56 of file gqa.c.

Referenced by read_args(), and ReadArgs().

char* options_str = "[-A A|a|b|c|e|g|m|o|p|v|w] [-a az] [-d] [-e el] [-f densityFile] [-g spacing|upper,lower|upper-lower] [-G] [-n nhits] [-N nviews] [-p] [-P ncpus] [-q] [-r] [-S nsamples] [-t overlap_tol] [-U useair] [-u len_units vol_units wt_units] [-v] [-V volume_tol] [-W weight_tol]"

Definition at line 57 of file gqa.c.

Referenced by ged_gqa().

struct density_entry* densities = NULL

Definition at line 167 of file gqa.c.

Referenced by main().