Database IO
[librt geometry, raytracing]

Collaboration diagram for Database IO:


Files

file  comb.c
file  db_anim.c
file  db_inmem.c
file  db_lookup.c
file  db_match.c
file  db_open.c
file  db_path.c
file  db_tree.c
file  db_walk.c
file  dir.c

Modules

 Database5
 Database4
 WriteDatabase

Data Structures

struct  db_walk_parallel_state

Defines

#define DEFAULT_DB_TITLE   "Untitled BRL-CAD Database"
#define SEEK_SET   0
#define DEFAULT_DB_TITLE   "Untitled BRL-CAD Database"
#define DB_WALK_PARALLEL_STATE_MAGIC   0x64777073
#define DB_CK_WPS(_p)   BU_CKMAG(_p, DB_WALK_PARALLEL_STATE_MAGIC, "db_walk_parallel_state")

Functions

int db_add_anim (struct db_i *dbip, register struct animate *anp, int root)
int db_do_anim (register struct animate *anp, mat_t stack, mat_t arc, struct mater_info *materp)
void db_free_1anim (struct animate *anp)
void db_free_anim (register struct db_i *dbip)
animatedb_parse_1anim (struct db_i *dbip, int argc, const char *argv[])
int db_parse_anim (struct db_i *dbip, int argc, const char **argv)
void db_write_anim (FILE *fop, struct animate *anp)
db_idb_open_inmem (void)
db_idb_create_inmem (void)
void db_inmem (struct directory *dp, struct bu_external *ext, int flags, struct db_i *dbip)
int db_is_directory_non_empty (const struct db_i *dbip)
int db_get_directory_size (const struct db_i *dbip)
void db_ck_directory (const struct db_i *dbip)
int db_dirhash (const char *str)
int db_dircheck (struct db_i *dbip, struct bu_vls *ret_name, int noisy, struct directory ***headp)
directorydb_lookup (const struct db_i *dbip, register const char *name, int noisy)
directorydb_diradd (register struct db_i *dbip, register const char *name, long int laddr, int len, int flags, genptr_t ptr)
int db_dirdelete (register struct db_i *dbip, register struct directory *dp)
int db_rename (register struct db_i *dbip, register struct directory *dp, const char *newname)
void db_pr_dir (register const struct db_i *dbip)
void db_get_directory (register struct resource *resp)
bu_ptbldb_lookup_by_attr (struct db_i *dbip, int dir_flags, struct bu_attribute_value_set *avs, int op)
int db_regexp_match (register const char *pattern, register const char *string)
int db_regexp_match_all (struct bu_vls *dest, struct db_i *dbip, const char *pattern)
HIDDEN void db_count_refs (struct db_i *dbip, struct rt_comb_internal *comb, union tree *comb_leaf, genptr_t dummy1, genptr_t dummy2, genptr_t dummy3)
void db_update_nref (struct db_i *dbip, struct resource *resp)
db_idb_open (const char *name, const char *mode)
db_idb_create (const char *name, int version)
void db_close_client (struct db_i *dbip, long int *client)
void db_close (register struct db_i *dbip)
int db_dump (struct rt_wdb *wdbp, struct db_i *dbip)
db_idb_clone_dbi (struct db_i *dbip, long int *client)
void db_sync (struct db_i *dbip)
void db_full_path_init (struct db_full_path *pathp)
void db_add_node_to_full_path (struct db_full_path *pp, struct directory *dp)
void db_dup_full_path (register struct db_full_path *newp, register const struct db_full_path *oldp)
void db_extend_full_path (struct db_full_path *pathp, int incr)
void db_append_full_path (struct db_full_path *dest, const struct db_full_path *src)
void db_dup_path_tail (register struct db_full_path *newp, register const struct db_full_path *oldp, int start)
char * db_path_to_string (const struct db_full_path *pp)
void db_path_to_vls (struct bu_vls *str, const struct db_full_path *pp)
void db_pr_full_path (const char *msg, const struct db_full_path *pathp)
int db_string_to_path (struct db_full_path *pp, const struct db_i *dbip, const char *str)
int db_argv_to_path (register struct db_full_path *pp, struct db_i *dbip, int argc, const char *const *argv)
void db_free_full_path (register struct db_full_path *pp)
int db_identical_full_paths (const struct db_full_path *a, const struct db_full_path *b)
int db_full_path_subset (const struct db_full_path *a, const struct db_full_path *b)
int db_full_path_search (const struct db_full_path *a, const struct directory *dp)
void db_ck_tree (const union tree *tp)
void db_dup_db_tree_state (struct db_tree_state *otsp, const struct db_tree_state *itsp)
void db_free_db_tree_state (struct db_tree_state *tsp)
void db_init_db_tree_state (struct db_tree_state *tsp, struct db_i *dbip, struct resource *resp)
combined_tree_statedb_new_combined_tree_state (register const struct db_tree_state *tsp, register const struct db_full_path *pathp)
combined_tree_statedb_dup_combined_tree_state (const struct combined_tree_state *old)
void db_free_combined_tree_state (register struct combined_tree_state *ctsp)
void db_pr_tree_state (register const struct db_tree_state *tsp)
void db_pr_combined_tree_state (register const struct combined_tree_state *ctsp)
int db_apply_state_from_comb (struct db_tree_state *tsp, const struct db_full_path *pathp, register const struct rt_comb_internal *comb)
int db_apply_state_from_memb (struct db_tree_state *tsp, struct db_full_path *pathp, const union tree *tp)
int db_apply_state_from_one_member (struct db_tree_state *tsp, struct db_full_path *pathp, const char *cp, int sofar, const union tree *tp)
treedb_find_named_leaf (union tree *tp, const char *cp)
treedb_find_named_leafs_parent (int *side, union tree *tp, const char *cp)
void db_tree_del_lhs (union tree *tp, struct resource *resp)
void db_tree_del_rhs (union tree *tp, struct resource *resp)
int db_tree_del_dbleaf (union tree **tp, const char *cp, struct resource *resp)
void db_tree_mul_dbleaf (union tree *tp, const mat_t mat)
void db_tree_funcleaf (struct db_i *dbip, struct rt_comb_internal *comb, union tree *comb_tree, void(*leaf_func)(), genptr_t user_ptr1, genptr_t user_ptr2, genptr_t user_ptr3)
int db_follow_path (struct db_tree_state *tsp, struct db_full_path *total_path, const struct db_full_path *new_path, int noisy, int depth)
int db_follow_path_for_state (struct db_tree_state *tsp, struct db_full_path *total_path, const char *orig_str, int noisy)
HIDDEN int db_detect_cycle (struct db_full_path *pathp, union tree *tp)
HIDDEN void db_recurse_subtree (union tree *tp, struct db_tree_state *msp, struct db_full_path *pathp, struct combined_tree_state **region_start_statepp, genptr_t client_data)
treedb_recurse (struct db_tree_state *tsp, struct db_full_path *pathp, struct combined_tree_state **region_start_statepp, genptr_t client_data)
treedb_dup_subtree (const union tree *tp, struct resource *resp)
void db_free_tree (register union tree *tp, struct resource *resp)
void db_left_hvy_node (union tree *tp)
void db_non_union_push (register union tree *tp, struct resource *resp)
int db_count_tree_nodes (const union tree *tp, int count)
int db_is_tree_all_unions (const union tree *tp)
int db_count_subtree_regions (const union tree *tp)
int db_tally_subtree_regions (union tree *tp, union tree **reg_trees, int cur, int lim, struct resource *resp)
HIDDEN union treedb_gettree_region_end (register struct db_tree_state *tsp, struct db_full_path *pathp, union tree *curtree, genptr_t client_data)
HIDDEN union treedb_gettree_leaf (struct db_tree_state *tsp, struct db_full_path *pathp, struct rt_db_internal *ip, genptr_t client_data)
HIDDEN void db_walk_subtree (register union tree *tp, struct combined_tree_state **region_start_statepp, union tree *(*leaf_func) BU_ARGS((struct db_tree_state *, struct db_full_path *, struct rt_db_internal *, void *)), genptr_t client_data, struct resource *resp)
HIDDEN void db_walk_dispatcher (int cpu, genptr_t arg)
int db_walk_tree (struct db_i *dbip, int argc, const char **argv, int ncpu, const struct db_tree_state *init_state, int(*reg_start_func)(struct db_tree_state *, struct db_full_path *, const struct rt_comb_internal *, genptr_t), union tree *(*reg_end_func)(struct db_tree_state *, struct db_full_path *, union tree *, genptr_t), union tree *(*leaf_func)(struct db_tree_state *, struct db_full_path *, struct rt_db_internal *, genptr_t), genptr_t client_data)
int db_path_to_mat (struct db_i *dbip, struct db_full_path *pathp, mat_t mat, int depth, struct resource *resp)
void db_apply_anims (struct db_full_path *pathp, struct directory *dp, mat_t stack, mat_t arc, struct mater_info *materp)
int db_region_mat (mat_t m, struct db_i *dbip, const char *name, struct resource *resp)
int db_shader_mat (mat_t model_to_shader, const struct rt_i *rtip, const struct region *rp, point_t p_min, point_t p_max, struct resource *resp)
void db_traverse_subtree (union tree *tp, void(*traverse_func)(struct directory *, struct db_traverse *), struct db_traverse *dtp)
void db_preorder_traverse (struct directory *dp, struct db_traverse *dtp)
void db_functree_subtree (struct db_i *dbip, union tree *tp, void(*comb_func)(struct db_i *, struct directory *, genptr_t), void(*leaf_func)(struct db_i *, struct directory *, genptr_t), struct resource *resp, genptr_t client_data)
void db_functree (struct db_i *dbip, struct directory *dp, void(*comb_func)(struct db_i *, struct directory *, genptr_t), void(*leaf_func)(struct db_i *, struct directory *, genptr_t), struct resource *resp, genptr_t client_data)
rt_irt_dirbuild (const char *filename, char *buf, int len)
int rt_db_get_internal (struct rt_db_internal *ip, const struct directory *dp, const struct db_i *dbip, const mat_t mat, struct resource *resp)
int rt_db_put_internal (struct directory *dp, struct db_i *dbip, struct rt_db_internal *ip, struct resource *resp)
int rt_fwrite_internal (FILE *fp, const char *name, const struct rt_db_internal *ip, double conv2mm)
void rt_db_free_internal (struct rt_db_internal *ip, struct resource *resp)
int rt_db_lookup_internal (struct db_i *dbip, const char *obj_name, struct directory **dpp, struct rt_db_internal *ip, int noisy, struct resource *resp)

Define Documentation

#define DEFAULT_DB_TITLE   "Untitled BRL-CAD Database"
 

Definition at line 61 of file db_inmem.c.

Referenced by db_create().

#define SEEK_SET   0
 

Definition at line 74 of file db_open.c.

#define DEFAULT_DB_TITLE   "Untitled BRL-CAD Database"
 

Definition at line 77 of file db_open.c.

#define DB_WALK_PARALLEL_STATE_MAGIC   0x64777073
 

Definition at line 2025 of file db_tree.c.

#define DB_CK_WPS _p   )     BU_CKMAG(_p, DB_WALK_PARALLEL_STATE_MAGIC, "db_walk_parallel_state")
 

Definition at line 2026 of file db_tree.c.

Referenced by db_walk_dispatcher().


Function Documentation

int db_add_anim struct db_i dbip,
register struct animate anp,
int  root
 

D B _ A D D _ A N I M

Add a user-supplied animate structure to the end of the chain of such structures hanging from the directory structure of the last node of the path specifier. When 'root' is non-zero, this matrix is located at the root of the tree itself, rather than an arc, and is stored differently.

In the future, might want to check to make sure that callers directory references are in the right database (dbip).

Definition at line 73 of file db_anim.c.

References ANIM_NULL, bu_log(), directory::d_animate, directory::d_namep, DB_FULL_PATH_CUR_DIR, db_i::dbi_anroot, DEBUG_ANIM, RT_CK_ANIMATE, and RT_G_DEBUG.

Here is the call graph for this function:

int db_do_anim register struct animate anp,
mat_t  stack,
mat_t  arc,
struct mater_info materp
 

D B _ D O _ A N I M

Perform the one animation operation. Leave results in form that additional operations can be cascaded.

Note that 'materp' may be a null pointer, signifying that the region has already been finalized above this point in the tree.

Definition at line 123 of file db_anim.c.

References ANM_LMUL, ANM_RARC, ANM_RBOTH, ANM_RMUL, ANM_RSTACK, bn_inv255, bn_mat_mul(), bn_mat_print(), bu_free(), bu_log(), bu_vls_init(), bu_vls_putc(), bu_vls_strcpy(), bu_vls_strdup(), bu_vls_strgrab(), bu_vls_vlscat(), db_path_to_string(), DEBUG_ANIM, DEBUG_ANIM_FULL, mater_info::ma_color, mater_info::ma_color_valid, mater_info::ma_shader, mater_info::ma_temperature, MAT_COPY, MAT_IDN, RT_AN_COLOR, RT_AN_MATERIAL, RT_AN_MATRIX, RT_AN_TEMPERATURE, RT_ANP_APPEND, RT_ANP_REPLACE, RT_CK_ANIMATE, and RT_G_DEBUG.

Here is the call graph for this function:

void db_free_1anim struct animate anp  ) 
 

D B _ F R E E _ 1 A N I M

Free one animation structure

Definition at line 248 of file db_anim.c.

References animate::an_path, animate::an_type, animate::an_u, rt_anim_property::anp_shader, animate::animate_specific::anu_p, bu_free(), bu_vls_free(), db_free_full_path(), RT_AN_MATERIAL, and RT_CK_ANIMATE.

Referenced by db_free_anim().

Here is the call graph for this function:

void db_free_anim register struct db_i dbip  ) 
 

D B _ F R E E _ A N I M

Release chain of animation structures

An unfortunate choice of name.

Definition at line 270 of file db_anim.c.

References animate::an_forw, ANIM_NULL, directory::d_animate, directory::d_forw, db_free_1anim(), DIR_NULL, RT_CK_ANIMATE, and RT_DBNHASH.

Here is the call graph for this function:

struct animate* db_parse_1anim struct db_i dbip,
int  argc,
const char *  argv[]
 

D B _ P A R S E _ 1 A N I M

Parse one "anim" type command into an "animate" structure. argv[1] must be the "a/b" path spec, argv[2] indicates what is to be animated on that arc.

Definition at line 312 of file db_anim.c.

References animate::an_path, animate::an_type, animate::an_u, ANIMATE_MAGIC, ANM_LMUL, anim_mat::anm_mat, anim_mat::anm_op, ANM_RARC, ANM_RBOTH, ANM_RMUL, ANM_RSTACK, rt_anim_property::anp_op, rt_anim_property::anp_shader, animate::animate_specific::anu_m, animate::animate_specific::anu_p, atof(), bn_mat_angles(), bn_mat_scale_about_pt(), BU_GETSTRUCT, bu_log(), bu_vls_from_argv(), bu_vls_init(), db_follow_path_for_state(), db_full_path_init(), db_init_db_tree_state(), LOOKUP_NOISY, animate::magic, MAT_DELTAS, MAT_IDN, NEAR_ZERO, RT_AN_MATERIAL, RT_AN_MATRIX, RT_ANP_REPLACE, rt_uniresource, SMALL, V3ARGS, and VSET.

Here is the call graph for this function:

int db_parse_anim struct db_i dbip,
int  argc,
const char **  argv
 

D B _ P A R S E _ A N I M

A common parser for mged and rt. Experimental. Not the best name for this.

Definition at line 451 of file db_anim.c.

References animate::an_path, db_add_anim(), db_parse_1anim(), and db_full_path::fp_len.

Here is the call graph for this function:

void db_write_anim FILE *  fop,
struct animate anp
 

Definition at line 473 of file db_anim.c.

References animate::an_path, animate::an_type, animate::an_u, ANM_LMUL, anim_mat::anm_mat, anim_mat::anm_op, ANM_RARC, ANM_RBOTH, ANM_RMUL, ANM_RSTACK, animate::animate_specific::anu_m, bu_free(), bu_log(), db_path_to_string(), DEBUG_ANIM, RT_AN_MATRIX, RT_CK_ANIMATE, and RT_G_DEBUG.

Here is the call graph for this function:

struct db_i* db_open_inmem void   ) 
 

d b _ o p e n _ i n m e m

"open" an in-memory-only database instance. this initializes a dbip for use, creating an inmem dbi_wdbp as the means to add geometry to the directory (use wdb_export_external()).

Definition at line 71 of file db_inmem.c.

References BU_GETSTRUCT, db_i::dbi_eof, db_i::dbi_fd, db_i::dbi_fp, db_i::dbi_Head, db_i::dbi_mf, DBI_NULL, db_i::dbi_read_only, DIR_NULL, NULL, and RT_DBNHASH.

Referenced by db_create_inmem().

struct db_i* db_create_inmem void   ) 
 

d b _ c r e a t e _ i n m e m

creates an in-memory-only database. this is very similar to db_open_inmem() with the exception that the this routine adds a default _GLOBAL object.

Definition at line 118 of file db_inmem.c.

References bu_avs_add(), bu_avs_free(), bu_avs_init(), bu_free_external(), bu_vls_addr(), bu_vls_free(), bu_vls_init(), bu_vls_printf(), db5_export_attributes(), db5_export_object3(), DB5_GLOBAL_OBJECT_NAME, DB5_MAJORTYPE_ATTRIBUTE_ONLY, DB5_MAJORTYPE_RESERVED, DB5_ZZZ_UNCOMPRESSED, DB5HDR_HFLAGS_DLI_APPLICATION_DATA_OBJECT, DB5HDR_HFLAGS_DLI_HEADER_OBJECT, DB5HDR_HFLAGS_HIDDEN_OBJECT, db_open_inmem(), db_i::dbi_local2base, db_i::dbi_title, db_i::dbi_wdbp, DIR_HIDDEN, DIR_NON_GEOM, flags, NULL, RT_CK_DBI, RT_CK_WDB, RT_DIR_INMEM, units, and wdb_export_external().

Here is the call graph for this function:

void db_inmem struct directory dp,
struct bu_external ext,
int  flags,
struct db_i dbip
 

D B _ I N M E M

Transmogrify an existing directory entry to be an in-memory-only one, stealing the external representation from 'ext'.

Definition at line 171 of file db_inmem.c.

References BU_CK_EXTERNAL, bu_free(), directory::d_flags, directory::d_len, directory::d_un, db_i::dbi_version, bu_external::ext_buf, bu_external::ext_nbytes, NULL, directory::ptr, RT_CK_DIR, and RT_DIR_INMEM.

Referenced by wdb_export_external().

Here is the call graph for this function:

int db_is_directory_non_empty const struct db_i dbip  ) 
 

D B _ I S _ D I R E C T O R Y _ N O N _ E M P T Y

Returns - 0 if the in-memory directory is empty 1 if the in-memory directory has entries, which implies that a db_scan() has already been performed.

Definition at line 76 of file db_lookup.c.

References db_i::dbi_Head, DIR_NULL, record::i, RT_CK_DBI, and RT_DBNHASH.

Referenced by rt_submodel_plot(), and rt_submodel_prep().

int db_get_directory_size const struct db_i dbip  ) 
 

D B _ G E T _ D I R E C T O R Y _ S I Z E

Return the number of "struct directory" nodes in the given database.

Definition at line 95 of file db_lookup.c.

References directory::d_forw, db_i::dbi_Head, DIR_NULL, RT_CK_DBI, and RT_DBNHASH.

Referenced by wdb_getspace().

void db_ck_directory const struct db_i dbip  ) 
 

D B _ C K _ D I R E C T O R Y

For debugging, ensure that all the linked-lists for the directory structure are intact.

Definition at line 117 of file db_lookup.c.

References directory::d_forw, db_i::dbi_Head, DIR_NULL, RT_CK_DBI, RT_CK_DIR, and RT_DBNHASH.

Referenced by rt_ck().

int db_dirhash const char *  str  ) 
 

D B _ D I R H A S H

Internal function to return pointer to head of hash chain corresponding to the given string.

Definition at line 137 of file db_lookup.c.

References RT_DBHASH.

Referenced by db_dircheck(), db_dirdelete(), db_lookup(), db_rename(), rt_find_identical_solid(), rt_free_soltab(), and rt_gettree_leaf().

int db_dircheck struct db_i dbip,
struct bu_vls ret_name,
int  noisy,
struct directory ***  headp
 

Name - D B _ D I R C H E C K

Description - This routine ensures that ret_name is not already in the directory. If it is, it tries a fixed number of times to modify ret_name before giving up. Note - most of the time, the hash for ret_name is computed once.

Inputs - dbip database instance pointer ret_name the original name noisy to blather or not

Outputs - ret_name the name to use headp pointer to the first (struct directory *) in the bucket

Returns - 0 success <0 fail

Definition at line 175 of file db_lookup.c.

References bu_vls_addr(), bu_vls_strcat(), bu_vls_strcpy(), directory::d_forw, directory::d_namep, db_dirhash(), db_lookup(), db_i::dbi_Head, and DIR_NULL.

Referenced by db5_diradd(), db_diradd(), and db_diradd5().

Here is the call graph for this function:

struct directory* db_lookup const struct db_i dbip,
register const char *  name,
int  noisy
 

D B _ L O O K U P

This routine takes a name and looks it up in the directory table. If the name is present, a pointer to the directory struct element is returned, otherwise NULL is returned.

If noisy is non-zero, a print occurs, else only the return code indicates failure.

Returns - struct directory if name is found DIR_NULL on failure

Definition at line 238 of file db_lookup.c.

References bu_log(), directory::d_forw, directory::d_namep, db_dirhash(), db_i::dbi_Head, DEBUG_DB, DIR_NULL, RT_CK_DBI, and RT_G_DEBUG.

Here is the call graph for this function:

struct directory* db_diradd register struct db_i dbip,
register const char *  name,
long int  laddr,
int  len,
int  flags,
genptr_t  ptr
 

D B _ D I R A D D

Add an entry to the directory. Try to make the regular path through the code as fast as possible, to speed up building the table of contents.

dbip is a pointer to a valid/opened database instance name is the string name of the object being added laddr is the long offset into the file to the object len is the length of the object, number of db granules used flags are defined in raytrace.h (DIR_SOLID, DIR_COMB, DIR_REGION, RT_DIR_INMEM, etc) for db version 5, ptr is the minor_type (non-null pointer to valid unsigned char code)

an laddr of RT_DIR_PHONY_ADDR (-1L) means that database storage has not been allocated yet.

Definition at line 289 of file db_lookup.c.

References BU_LIST_INIT, bu_log(), bu_vls_addr(), bu_vls_free(), bu_vls_init(), bu_vls_strcpy(), bu_vls_strncpy(), directory::d_animate, directory::d_flags, directory::d_forw, directory::d_len, directory::d_major_type, directory::d_minor_type, directory::d_nref, directory::d_un, directory::d_use_hd, directory::d_uses, DB5_MAJORTYPE_BRLCAD, db_dircheck(), DIR_NULL, directory::file_offset, NAMESIZE, NULL, RT_CK_DBI, RT_CK_DIR, RT_DIR_INMEM, RT_DIR_SET_NAMEP, RT_G_DEBUG, RT_GET_DIRECTORY, and rt_uniresource.

Here is the call graph for this function:

int db_dirdelete register struct db_i dbip,
register struct directory dp
 

D B _ D I R D E L E T E

Given a pointer to a directory entry, remove it from the linked list, and free the associated memory.

It is the responsibility of the caller to have released whatever structures have been hung on the d_use_hd bu_list, first.

Returns - 0 on success -1 on failure

Definition at line 366 of file db_lookup.c.

References bu_free(), directory::d_forw, db_dirhash(), DIR_NULL, NULL, resource::re_directory_hd, RT_CK_DBI, RT_CK_DIR, RT_DIR_FREE_NAMEP, RT_DIR_INMEM, and rt_uniresource.

Here is the call graph for this function:

int db_rename register struct db_i dbip,
register struct directory dp,
const char *  newname
 

D B _ R E N A M E

Change the name string of a directory entry. Because of the hashing function, this takes some extra work.

Returns - 0 on success -1 on failure

Definition at line 416 of file db_lookup.c.

References directory::d_forw, db_dirhash(), DIR_NULL, RT_CK_DBI, and RT_CK_DIR.

Here is the call graph for this function:

void db_pr_dir register const struct db_i dbip  ) 
 

D B _ P R _ D I R

For debugging, print the entire contents of the database directory.

Definition at line 458 of file db_lookup.c.

References bu_log(), directory::d_animate, directory::d_flags, directory::d_forw, directory::d_len, directory::d_namep, directory::d_nref, directory::d_uses, DIR_COMB, DIR_NULL, DIR_REGION, DIR_SOLID, flags, RT_CK_DBI, RT_DBNHASH, and RT_DIR_INMEM.

Here is the call graph for this function:

void db_get_directory register struct resource resp  ) 
 

D B _ G E T _ D I R E C T O R Y

This routine is called by the RT_GET_DIRECTORY macro when the freelist is exhausted. Rather than simply getting one additional structure, we get a whole batch, saving overhead.

Definition at line 511 of file db_lookup.c.

References BU_ASSERT_PTR, BU_CK_PTBL, BU_FLSTR, bu_malloc(), bu_malloc_len_roundup(), bu_ptbl_ins(), NULL, RT_CK_RESOURCE, and RT_DIR_MAGIC.

Here is the call graph for this function:

struct bu_ptbl* db_lookup_by_attr struct db_i dbip,
int  dir_flags,
struct bu_attribute_value_set avs,
int  op
 

D B _ L O O K U P _ B Y _ A T T R

lookup directory entries based on directory flags (dp->d_flags) and attributes the "dir_flags" arg is a mask for the directory flags the *"avs" is an attribute value set used to select from the objects that *pass the flags mask. if "op" is 1, then the object must have all the *attributes and values that appear in "avs" in order to be *selected. If "op" is 2, then the object must have at least one of *the attribute/value pairs from "avs".

dir_flags are in the form used in struct directory (d_flags)

for op: 1 -> all attribute name/value pairs must be present and match 2 -> at least one of the name/value pairs must be present and match

returns a ptbl list of selected directory pointers an empty list means nothing met the requirements a NULL return means something went wrong.

Definition at line 559 of file db_lookup.c.

References bu_attribute_value_set::avp, BU_CK_AVS, bu_log(), bu_malloc(), bu_ptbl_init(), bu_attribute_value_set::count, directory::d_flags, directory::d_namep, db5_get_attributes(), FOR_ALL_DIRECTORY_START, bu_attribute_value_pair::name, NULL, RT_CK_DBI, and bu_attribute_value_pair::value.

Here is the call graph for this function:

int db_regexp_match register const char *  pattern,
register const char *  string
 

D B _ R E G E X P _ M A T C H

If string matches pattern, return 1, else return 0

special characters: * Matches any string including the null string. ? Matches any single character. [...] Matches any one of the characters enclosed.

  • May be used inside brackets to specify range (i.e. str[1-58] matches str1, str2, ... str5, str8) \ Escapes special characters.

Definition at line 75 of file db_match.c.

References db_regexp_match().

Here is the call graph for this function:

int db_regexp_match_all struct bu_vls dest,
struct db_i dbip,
const char *  pattern
 

D B _ R E G E X P _ M A T C H _ A L L

Appends a list of all database matches to the given vls, or the pattern itself if no matches are found. Returns the number of matches.

Definition at line 140 of file db_match.c.

References bu_vls_strcat(), directory::d_forw, directory::d_namep, db_regexp_match(), db_i::dbi_Head, DIR_NULL, num, and RT_DBNHASH.

Referenced by wdb_match_cmd().

Here is the call graph for this function:

HIDDEN void db_count_refs struct db_i dbip,
struct rt_comb_internal comb,
union tree comb_leaf,
genptr_t  dummy1,
genptr_t  dummy2,
genptr_t  dummy3
 

Definition at line 164 of file db_match.c.

References directory::d_nref, db_lookup(), DIR_NULL, LOOKUP_QUIET, RT_CK_TREE, tree::tree_db_leaf::tl_name, and tree::tr_l.

Here is the call graph for this function:

void db_update_nref struct db_i dbip,
struct resource resp
 

D B _ U P D A T E _ N R E F

Updates the d_nref fields (which count the number of times a given entry is referenced by a COMBination in the database).

Definition at line 184 of file db_match.c.

References directory::d_forw, directory::d_major_type, directory::d_minor_type, directory::d_nref, DB5_MAJORTYPE_BRLCAD, DB5_MINORTYPE_BRLCAD_EXTRUDE, db_lookup(), db_i::dbi_Head, DIR_NULL, LOOKUP_QUIET, NULL, RT_CK_DBI, RT_CK_RESOURCE, rt_db_get_internal(), RT_DBNHASH, and RT_EXTRUDE_CK_MAGIC.

Referenced by wdb_tops_cmd().

Here is the call graph for this function:

struct db_i* db_open const char *  name,
const char *  mode
 

D B _ O P E N

Open the named database. The 'mode' parameter specifies read-only or read-write mode.

As a convenience, dbi_filepath is a C-style argv array of dirs to search when attempting to open related files (such as data files for EBM solids or texture-maps). The default values are "." and the directory containing the ".g" file. They may be overriden by setting the environment variable BRLCAD_FILE_PATH.

Returns: DBI_NULL error db_i * success

Definition at line 97 of file db_open.c.

References bu_mapped_file::apbuf, bu_dirname(), bu_free(), BU_GETSTRUCT, bu_log(), bu_malloc(), bu_open_mapped_file(), bu_ptbl_init(), bu_strdup, bu_mapped_file::buf, bu_mapped_file::buflen, db_get_version(), db_i::dbi_base2local, db_i::dbi_clients, db_i::dbi_eof, db_i::dbi_fd, db_i::dbi_filename, db_i::dbi_filepath, db_i::dbi_fp, db_i::dbi_Head, db_i::dbi_inmem, db_i::dbi_local2base, DBI_MAGIC, db_i::dbi_magic, db_i::dbi_mf, DBI_NULL, db_i::dbi_read_only, db_i::dbi_title, db_i::dbi_uses, db_i::dbi_version, DEBUG_DB, DIR_NULL, NULL, RT_CK_DBI, RT_DBNHASH, and RT_G_DEBUG.

Referenced by db_create(), main(), rt_dirbuild(), rt_submodel_plot(), rt_submodel_prep(), wdb_concat_cmd(), wdb_dup_cmd(), and wdb_prep_dbip().

Here is the call graph for this function:

struct db_i* db_create const char *  name,
int  version
 

D B _ C R E A T E

Create a new database containing just a header record, regardless of whether the database previously existed or not, and open it for reading and writing.

New in BRL-CAD Release 6.0 is that this routine also calls db_dirbuild(), so the caller shouldn't.

Returns: DBI_NULL error db_i * success

Definition at line 219 of file db_open.c.

References bu_log(), db5_fwrite_ident(), db_dirbuild(), db_fwrite_ident(), db_open(), DBI_NULL, DEBUG_DB, DEFAULT_DB_TITLE, fp, NULL, perror(), RT_G_DEBUG, and void().

Referenced by wdb_fopen_v(), and wdb_prep_dbip().

Here is the call graph for this function:

void db_close_client struct db_i dbip,
long int *  client
 

D B _ C L O S E _ C L I E N T

De-register a client of this database instance, if provided, and close out the instance.

Definition at line 270 of file db_open.c.

References bu_ptbl_rm(), db_close(), db_i::dbi_clients, RT_CK_DBI, and void().

Here is the call graph for this function:

void db_close register struct db_i dbip  ) 
 

D B _ C L O S E

Close a database, releasing dynamic memory Wait until last user is done, though.

Definition at line 286 of file db_open.c.

References bu_close_mapped_file(), bu_free(), bu_free_mapped_files(), bu_log(), bu_ptbl_free(), BU_SEM_LISTS, bu_semaphore_acquire(), bu_semaphore_release(), directory::d_forw, db_free_anim(), db_sync(), DEBUG_DB, DIR_NULL, NULL, resource::re_directory_hd, RT_CK_DBI, RT_CK_DIR, rt_color_free(), RT_DBNHASH, RT_DIR_FREE_NAMEP, RT_G_DEBUG, rt_memclose(), rt_mempurge(), rt_uniresource, and void().

Here is the call graph for this function:

int db_dump struct rt_wdb wdbp,
struct db_i dbip
 

D B _ D U M P

Dump a full copy of one database into another. This is a good way of committing a ".inmem" database to a ".g" file. The input is a database instance, the output is a LIBWDB object, which could be a disk file or another database instance.

Returns - -1 error 0 success

Definition at line 394 of file db_open.c.

References bu_log(), directory::d_forw, directory::d_namep, db_get_external(), db_i::dbi_Head, DIR_NULL, RT_CK_DBI, RT_CK_DIR, RT_CK_WDB, and RT_DBNHASH.

Referenced by wdb_dump_cmd().

Here is the call graph for this function:

struct db_i* db_clone_dbi struct db_i dbip,
long int *  client
 

D B _ C L O N E _ D B I

Obtain an additional instance of this same database. A new client is registered at the same time if one is specified.

Definition at line 432 of file db_open.c.

References bu_ptbl_ins_unique(), db_i::dbi_clients, db_i::dbi_uses, and RT_CK_DBI.

Here is the call graph for this function:

void db_sync struct db_i dbip  ) 
 

D B _ S Y N C

Ensure that the on-disk database has been completely written out of the operating system's cache.

Definition at line 450 of file db_open.c.

References BU_SEM_SYSCALL, bu_semaphore_acquire(), bu_semaphore_release(), db_i::dbi_fd, db_i::dbi_fp, RT_CK_DBI, and void().

Referenced by db_close(), and wdb_concat_cmd().

Here is the call graph for this function:

void db_full_path_init struct db_full_path pathp  ) 
 

D B _ F U L L _ P A T H _ I N I T

Definition at line 67 of file db_path.c.

References DB_FULL_PATH_MAGIC, db_full_path::fp_len, db_full_path::fp_maxlen, db_full_path::fp_names, db_full_path::magic, and NULL.

Referenced by db_dup_combined_tree_state(), db_new_combined_tree_state(), db_parse_1anim(), db_path_to_mat(), db_string_to_path(), db_walk_tree(), rt_find_paths(), rt_tcl_import_from_path(), and wdb_get_obj_bounds().

void db_add_node_to_full_path struct db_full_path pp,
struct directory dp
 

D B _ A D D _ N O D E _ T O _ F U L L _ P A T H

Definition at line 79 of file db_path.c.

References bu_malloc(), db_full_path::fp_len, db_full_path::fp_maxlen, db_full_path::fp_names, RT_CK_FULL_PATH, and rt_realloc.

Referenced by db_apply_state_from_memb(), db_follow_path(), dgo_invent_solid(), and rt_find_paths().

Here is the call graph for this function:

void db_dup_full_path register struct db_full_path newp,
register const struct db_full_path oldp
 

D B _ D U P _ F U L L _ P A T H

Definition at line 102 of file db_path.c.

References bcopy, bu_malloc(), and RT_CK_FULL_PATH.

Here is the call graph for this function:

void db_extend_full_path struct db_full_path pathp,
int  incr
 

D B _ E X T E N D _ F U L L _ P A T H

Extend "pathp" so that it can grow from current fp_len by incr more names.

This is intended primarily as an internal method.

Definition at line 128 of file db_path.c.

References bu_malloc(), db_full_path::fp_len, db_full_path::fp_maxlen, db_full_path::fp_names, RT_CK_FULL_PATH, and rt_realloc.

Referenced by db_append_full_path().

Here is the call graph for this function:

void db_append_full_path struct db_full_path dest,
const struct db_full_path src
 

D B _ A P P E N D _ F U L L _ P A T H

Definition at line 157 of file db_path.c.

References bcopy, db_extend_full_path(), db_full_path::fp_len, db_full_path::fp_names, and RT_CK_FULL_PATH.

Here is the call graph for this function:

void db_dup_path_tail register struct db_full_path newp,
register const struct db_full_path oldp,
int  start
 

D B _ D U P _ P A T H _ T A I L

Dup old path from starting index to end.

Definition at line 175 of file db_path.c.

References bcopy, bu_malloc(), rt_bomb(), and RT_CK_FULL_PATH.

Here is the call graph for this function:

char* db_path_to_string const struct db_full_path pp  ) 
 

D B _ P A T H _ T O _ S T R I N G

Unlike rt_path_str(), this version can be used in parallel. Caller is responsible for freeing the returned buffer.

Definition at line 201 of file db_path.c.

References bu_malloc(), directory::d_namep, db_full_path::fp_len, db_full_path::fp_names, and RT_CK_FULL_PATH.

Referenced by db_apply_anims(), db_apply_state_from_comb(), db_apply_state_from_memb(), db_do_anim(), db_follow_path(), db_pr_combined_tree_state(), db_pr_full_path(), db_recurse(), db_walk_subtree(), db_write_anim(), rt_pr_tree_str(), rt_pr_tree_vls(), rt_reprep(), rt_submodel_wireframe_leaf(), and rt_tcl_pr_hit().

Here is the call graph for this function:

void db_path_to_vls struct bu_vls str,
const struct db_full_path pp
 

D B _ P A T H _ T O _ V L S

Append a string representation of the path onto the vls. Must have exactly the same formattting conventions as db_path_to_string().

Definition at line 241 of file db_path.c.

References BU_CK_VLS, bu_vls_putc(), bu_vls_strcat(), directory::d_namep, db_full_path::fp_len, db_full_path::fp_names, and RT_CK_FULL_PATH.

Here is the call graph for this function:

void db_pr_full_path const char *  msg,
const struct db_full_path pathp
 

D B _ P R _ F U L L _ P A T H

Definition at line 261 of file db_path.c.

References bu_free(), bu_log(), and db_path_to_string().

Here is the call graph for this function:

int db_string_to_path struct db_full_path pp,
const struct db_i dbip,
const char *  str
 

D B _ S T R I N G _ T O _ P A T H

Reverse the effects of db_path_to_string().

The db_full_path structure will be initialized. If it was already in use, user should call db_free_full_path() first.

Returns - -1 One or more components of path did not exist in the directory. 0 OK

Definition at line 282 of file db_path.c.

References BU_ASSERT_LONG, bu_free(), bu_log(), bu_malloc(), bu_strdup, db_full_path_init(), DB_FULL_PATH_MAGIC, db_lookup(), DIR_NULL, db_full_path::fp_len, db_full_path::fp_maxlen, db_full_path::fp_names, LOOKUP_NOISY, db_full_path::magic, NULL, and RT_CK_DBI.

Referenced by db_follow_path_for_state(), db_region_mat(), dgo_E_cmd(), rt_tcl_import_from_path(), and wdb_get_obj_bounds().

Here is the call graph for this function:

int db_argv_to_path register struct db_full_path pp,
struct db_i dbip,
int  argc,
const char *const *  argv
 

D B _ A R G V _ T O _ P A T H

Treat elements from argv[0] to argv[argc-1] as a path specification.

The path structure will be fully initialized. If it was already in use, user should call db_free_full_path() first.

Returns - -1 One or more components of path did not exist in the directory. 0 OK

Definition at line 361 of file db_path.c.

References bu_log(), bu_malloc(), DB_FULL_PATH_MAGIC, db_lookup(), DIR_NULL, LOOKUP_NOISY, and RT_CK_DBI.

Here is the call graph for this function:

void db_free_full_path register struct db_full_path pp  ) 
 

D B _ F R E E _ F U L L _ P A T H

Free the contents of the db_full_path structure, but not the structure itself, which might be automatic.

Definition at line 395 of file db_path.c.

References bu_free(), and RT_CK_FULL_PATH.

Here is the call graph for this function:

int db_identical_full_paths const struct db_full_path a,
const struct db_full_path b
 

D B _ I D E N T I C A L _ F U L L _ P A T H S

Returns - 1 match 0 different

Definition at line 414 of file db_path.c.

References db_full_path::fp_len, db_full_path::fp_names, and RT_CK_FULL_PATH.

int db_full_path_subset const struct db_full_path a,
const struct db_full_path b
 

D B _ F U L L _ P A T H _ S U B S E T

Returns - 1 if 'b' is a proper subset of 'a' 0 if not.

Definition at line 439 of file db_path.c.

References db_full_path::fp_len, db_full_path::fp_names, and RT_CK_FULL_PATH.

int db_full_path_search const struct db_full_path a,
const struct directory dp
 

D B _ F U L L _ P A T H _ S E A R C H

Returns - 1 'dp' is found on this path 0 not found

Definition at line 478 of file db_path.c.

References db_full_path::fp_len, db_full_path::fp_names, RT_CK_DIR, and RT_CK_FULL_PATH.

void db_ck_tree const union tree tp  ) 
 

D B _ C K _ T R E E

void db_dup_db_tree_state struct db_tree_state otsp,
const struct db_tree_state itsp
 

D B _ D U P _ D B _ T R E E _ S T A T E

Duplicate the contents of a db_tree_state structure, including a private copy of the ts_mater field(s) and the attribute/value set.

Definition at line 75 of file db_tree.c.

References bu_attribute_value_set::avp, bu_avs_add(), bu_avs_init(), bu_avs_init_empty(), bu_malloc(), bu_attribute_value_set::count, record::i, mater_info::ma_shader, bu_attribute_value_pair::name, NULL, RT_CK_DBI, RT_CK_DBTS, db_tree_state::ts_attrs, db_tree_state::ts_dbip, db_tree_state::ts_mater, and bu_attribute_value_pair::value.

Referenced by db_dup_combined_tree_state(), db_new_combined_tree_state(), db_recurse(), and db_recurse_subtree().

Here is the call graph for this function:

void db_free_db_tree_state struct db_tree_state tsp  ) 
 

D B _ F R E E _ D B _ T R E E _ S T A T E

Release dynamic fields inside the structure, but not the structure itself.

Definition at line 111 of file db_tree.c.

References bu_attribute_value_set::avp, bu_avs_free(), bu_free(), mater_info::ma_shader, bu_attribute_value_set::max, NULL, RT_CK_DBI, RT_CK_DBTS, db_tree_state::ts_attrs, db_tree_state::ts_dbip, and db_tree_state::ts_mater.

Referenced by db_free_combined_tree_state(), db_path_to_mat(), db_recurse(), and db_recurse_subtree().

Here is the call graph for this function:

void db_init_db_tree_state struct db_tree_state tsp,
struct db_i dbip,
struct resource resp
 

D B _ I N I T _ D B _ T R E E _ S T A T E

In most cases, you don't want to use this routine, you want to struct copy mged_initial_tree_state or rt_initial_tree_state, and then set ts_dbip in your copy.

Definition at line 134 of file db_tree.c.

References bu_avs_init_empty(), bzero, MAT_IDN, RT_CK_DBI, RT_CK_RESOURCE, and RT_DBTS_MAGIC.

Referenced by db_parse_1anim(), db_path_to_mat(), rt_tcl_import_from_path(), and wdb_facetize_cmd().

Here is the call graph for this function:

struct combined_tree_state* db_new_combined_tree_state register const struct db_tree_state tsp,
register const struct db_full_path pathp
 

D B _ N E W _ C O M B I N E D _ T R E E _ S T A T E

Definition at line 151 of file db_tree.c.

References BU_GETSTRUCT, db_dup_db_tree_state(), db_dup_full_path(), db_full_path_init(), RT_CK_DBI, RT_CK_DBTS, RT_CK_FULL_PATH, and RT_CTS_MAGIC.

Here is the call graph for this function:

struct combined_tree_state* db_dup_combined_tree_state const struct combined_tree_state old  ) 
 

D B _ D U P _ C O M B I N E D _ T R E E _ S T A T E

Definition at line 171 of file db_tree.c.

References BU_GETSTRUCT, combined_tree_state::cts_p, combined_tree_state::cts_s, db_dup_db_tree_state(), db_dup_full_path(), db_full_path_init(), RT_CK_CTS, and RT_CTS_MAGIC.

Referenced by db_dup_subtree().

Here is the call graph for this function:

void db_free_combined_tree_state register struct combined_tree_state ctsp  ) 
 

D B _ F R E E _ C O M B I N E D _ T R E E _ S T A T E

Definition at line 188 of file db_tree.c.

References bu_free(), bzero, db_free_db_tree_state(), db_free_full_path(), and RT_CK_CTS.

Here is the call graph for this function:

void db_pr_tree_state register const struct db_tree_state tsp  ) 
 

D B _ P R _ T R E E _ S T A T E

Definition at line 201 of file db_tree.c.

References bu_log(), bu_printb(), and RT_CK_DBTS.

Here is the call graph for this function:

void db_pr_combined_tree_state register const struct combined_tree_state ctsp  ) 
 

D B _ P R _ C O M B I N E D _ T R E E _ S T A T E

Definition at line 232 of file db_tree.c.

References bu_free(), bu_log(), db_path_to_string(), db_pr_tree_state(), and RT_CK_CTS.

Here is the call graph for this function:

int db_apply_state_from_comb struct db_tree_state tsp,
const struct db_full_path pathp,
register const struct rt_comb_internal comb
 

D B _ A P P L Y _ S T A T E _ F R O M _ C O M B

Handle inheritance of material property found in combination record. Color and the material property have separate inheritance interlocks.

Returns - -1 failure 0 success 1 success, this is the top of a new region.

Definition at line 256 of file db_tree.c.

References bn_inv255, bu_free(), bu_log(), bu_shader_to_key_eq(), bu_vls_addr(), bu_vls_free(), bu_vls_init(), bu_vls_strdup(), bu_vls_strlen(), db_path_to_string(), mater_info::ma_cinherit, mater_info::ma_color, mater_info::ma_color_valid, mater_info::ma_minherit, mater_info::ma_shader, mater_info::ma_temperature, NULL, RT_CK_COMB, RT_CK_DBTS, db_tree_state::ts_aircode, db_tree_state::ts_gmater, db_tree_state::ts_is_fastgen, db_tree_state::ts_los, db_tree_state::ts_mater, db_tree_state::ts_regionid, db_tree_state::ts_sofar, TS_SOFAR_INTER, TS_SOFAR_MINUS, and TS_SOFAR_REGION.

Here is the call graph for this function:

int db_apply_state_from_memb struct db_tree_state tsp,
struct db_full_path pathp,
const union tree tp
 

D B _ A P P L Y _ S T A T E _ F R O M _ M E M B

Updates state via *tsp, pushes member's directory entry on *pathp. (Caller is responsible for popping it).

Returns - -1 failure 0 success, member pushed on path

Definition at line 373 of file db_tree.c.

References bn_mat_mul(), bu_free(), bu_log(), db_add_node_to_full_path(), db_apply_anims(), db_lookup(), db_path_to_string(), DIR_NULL, LOOKUP_QUIET, MAT_COPY, MAT_IDN, NULL, RT_CK_DBTS, RT_CK_FULL_PATH, RT_CK_TREE, tree::tree_db_leaf::tl_mat, tree::tree_db_leaf::tl_name, tree::tr_l, db_tree_state::ts_dbip, db_tree_state::ts_mat, db_tree_state::ts_mater, db_tree_state::ts_sofar, and TS_SOFAR_REGION.

Referenced by db_apply_state_from_one_member(), and db_recurse_subtree().

Here is the call graph for this function:

int db_apply_state_from_one_member struct db_tree_state tsp,
struct db_full_path pathp,
const char *  cp,
int  sofar,
const union tree tp
 

D B _ A P P L Y _ S T A T E _ F R O M _ O N E _ M E M B E R

Returns - -1 found member, failed to apply state 0 unable to find member 'cp' 1 state applied OK

Definition at line 423 of file db_tree.c.

References bu_bomb(), bu_log(), db_apply_state_from_memb(), db_apply_state_from_one_member(), OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CHECK_DBI, RT_CK_DBTS, RT_CK_FULL_PATH, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_name, tree::tr_b, tree::tr_l, db_tree_state::ts_dbip, db_tree_state::ts_sofar, TS_SOFAR_INTER, and TS_SOFAR_MINUS.

Referenced by db_apply_state_from_one_member(), and db_follow_path().

Here is the call graph for this function:

union tree* db_find_named_leaf union tree tp,
const char *  cp
 

D B _ F I N D _ N A M E D _ L E A F

The search stops on the first match.

Returns - tp if found TREE_NULL if not found in this tree

Definition at line 478 of file db_tree.c.

References bu_bomb(), bu_log(), db_find_named_leaf(), OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_name, tree::tr_b, tree::tr_l, and TREE_NULL.

Referenced by db_find_named_leaf().

Here is the call graph for this function:

union tree* db_find_named_leafs_parent int *  side,
union tree tp,
const char *  cp
 

D B _ F I N D _ N A M E D _ L E A F S _ P A R E N T

The search stops on the first match.

Returns - TREE_NULL if not found in this tree tp if found *side == 1 if leaf is on lhs. *side == 2 if leaf is on rhs.

Definition at line 519 of file db_tree.c.

References bu_bomb(), bu_log(), db_find_named_leafs_parent(), OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_name, tree::tr_b, tree::tr_l, and TREE_NULL.

Referenced by db_find_named_leafs_parent(), and db_tree_del_dbleaf().

Here is the call graph for this function:

void db_tree_del_lhs union tree tp,
struct resource resp
 

D B _ T R E E _ D E L _ L H S

Definition at line 564 of file db_tree.c.

References bu_bomb(), db_free_tree(), OP_DB_LEAF, OP_INTERSECT, OP_NMG_TESS, OP_NOP, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_TREE, RT_FREE_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tr_b, and TREE_NULL.

Referenced by db_non_union_push(), and db_tree_del_dbleaf().

Here is the call graph for this function:

void db_tree_del_rhs union tree tp,
struct resource resp
 

D B _ T R E E _ D E L _ R H S

Definition at line 608 of file db_tree.c.

References bu_bomb(), db_free_tree(), OP_DB_LEAF, OP_INTERSECT, OP_NMG_TESS, OP_NOP, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_TREE, RT_FREE_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tr_b, and TREE_NULL.

Referenced by db_non_union_push(), and db_tree_del_dbleaf().

Here is the call graph for this function:

int db_tree_del_dbleaf union tree **  tp,
const char *  cp,
struct resource resp
 

D B _ T R E E _ D E L _ D B L E A F

Given a name presumably referenced in a OP_DB_LEAF node, delete that node, and the operation node that references it. Not that this may not produce an equivalant tree, for example when rewriting (A - subtree) as (subtree), but that will be up to the caller/user to adjust. This routine gets rid of exactly two nodes in the tree: leaf, and op. Use some other routine if you wish to kill the entire rhs below "-" and "intersect" nodes.

The two nodes deleted will have their memory freed.

If the tree is a single OP_DB_LEAF node, the leaf is freed and *tp is set to NULL.

Returns - -3 Internal error -2 Tree is empty -1 Unable to find OP_DB_LEAF node specified by 'cp'. 0 OK

Definition at line 672 of file db_tree.c.

References bu_log(), db_find_named_leafs_parent(), db_free_tree(), db_tree_del_dbleaf(), db_tree_del_lhs(), db_tree_del_rhs(), OP_DB_LEAF, RT_CK_RESOURCE, RT_CK_TREE, TREE_NULL, and void().

Referenced by db_tree_del_dbleaf(), and wdb_remove_cmd().

Here is the call graph for this function:

void db_tree_mul_dbleaf union tree tp,
const mat_t  mat
 

D B _ T R E E _ M U L _ D B L E A F

Multiply on the left every matrix found in a DB_LEAF node in a tree.

Definition at line 713 of file db_tree.c.

References bn_mat_dup(), bn_mat_mul(), bu_bomb(), bu_log(), db_tree_mul_dbleaf(), MAT_COPY, NULL, OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_mat, tree::tr_b, and tree::tr_l.

Referenced by db_tree_mul_dbleaf().

Here is the call graph for this function:

void db_tree_funcleaf struct db_i dbip,
struct rt_comb_internal comb,
union tree comb_tree,
void(*)()  leaf_func,
genptr_t  user_ptr1,
genptr_t  user_ptr2,
genptr_t  user_ptr3
 

D B _ T R E E _ F U N C L E A F

This routine traverses a combination (union tree) in LNR order and calls the provided function for each OP_DB_LEAF node. Note that this routine does not go outside this one combination!!!! was comb_functree().

Definition at line 754 of file db_tree.c.

References bu_bomb(), bu_log(), db_tree_funcleaf(), OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CK_DBI, and RT_CK_TREE.

Referenced by db_tree_funcleaf(), wdb_identitize(), and wdb_showmats_cmd().

Here is the call graph for this function:

int db_follow_path struct db_tree_state tsp,
struct db_full_path total_path,
const struct db_full_path new_path,
int  noisy,
int  depth
 

D B _ F O L L O W _ P A T H

Starting with possible prior partial path and corresponding accumulated state, follow the path given by "new_path", updating *tsp and *total_path with full state information along the way. In a better world, there would have been a "combined_tree_state" arg.

Parameter 'depth' controls how much of 'new_path' is used: 0 use all of new_path >0 use only this many of the first elements of the path <0 use all but this many path elements.

A much more complete version of rt_plookup() and pathHmat(). There is also a TCL interface.

Returns - 0 success (plus *tsp is updated) -1 error (*tsp values are not useful)

Definition at line 810 of file db_tree.c.

References animate::an_forw, animate::an_path, ANIM_NULL, bn_mat_mul(), bu_free(), bu_log(), directory::d_flags, directory::d_namep, db_add_node_to_full_path(), db_apply_state_from_comb(), db_apply_state_from_one_member(), db_do_anim(), DB_FULL_PATH_CUR_DIR, db_path_to_string(), db_i::dbi_anroot, DEBUG_TREEWALK, DIR_COMB, DIR_NULL, db_full_path::fp_len, db_full_path::fp_names, rt_db_internal::idb_ptr, MAT_COPY, MAT_IDN, NULL, rt_bomb(), RT_CHECK_DBI, RT_CK_ANIMATE, RT_CK_COMB, RT_CK_DBTS, RT_CK_DIR, RT_CK_FULL_PATH, RT_CK_RESOURCE, rt_db_free_internal(), rt_db_get_internal(), RT_G_DEBUG, rt_comb_internal::tree, db_tree_state::ts_dbip, db_tree_state::ts_mat, db_tree_state::ts_mater, and db_tree_state::ts_resp.

Referenced by db_follow_path_for_state(), db_path_to_mat(), and rt_tcl_import_from_path().

Here is the call graph for this function:

int db_follow_path_for_state struct db_tree_state tsp,
struct db_full_path total_path,
const char *  orig_str,
int  noisy
 

D B _ F O L L O W _ P A T H _ F O R _ S T A T E

Follow the slash-separated path given by "cp", and update *tsp and *total_path with full state information along the way.

A much more complete version of rt_plookup().

Returns - 0 success (plus *tsp is updated) -1 error (*tsp values are not useful)

Definition at line 972 of file db_tree.c.

References db_follow_path(), db_free_full_path(), db_string_to_path(), db_full_path::fp_len, RT_CK_DBTS, and db_tree_state::ts_dbip.

Referenced by db_parse_1anim(), and db_walk_tree().

Here is the call graph for this function:

HIDDEN int db_detect_cycle struct db_full_path pathp,
union tree tp
 

D B _ D E T E C T _ C Y C L E

Helper routine to detect cyclic references

Definition at line 998 of file db_tree.c.

References directory::d_namep, db_full_path::fp_len, db_full_path::fp_names, tree::tree_db_leaf::tl_name, and tree::tr_l.

Referenced by db_recurse_subtree().

HIDDEN void db_recurse_subtree union tree tp,
struct db_tree_state msp,
struct db_full_path pathp,
struct combined_tree_state **  region_start_statepp,
genptr_t  client_data
 

D B _ R E C U R S E _ S U B T R E E

Helper routine for db_recurse()

Definition at line 1020 of file db_tree.c.

References bu_free(), bu_log(), directory::d_namep, db_apply_state_from_memb(), db_detect_cycle(), db_dup_db_tree_state(), db_free_db_tree_state(), db_free_tree(), DB_FULL_PATH_POP, db_recurse(), db_full_path::fp_len, db_full_path::fp_names, NULL, OP_DB_LEAF, OP_INTERSECT, OP_NOP, OP_SUBTRACT, OP_UNION, OP_XOR, rt_bomb(), RT_CK_DBTS, RT_CK_RESOURCE, RT_CK_TREE, RT_FREE_TREE, RT_GET_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_mat, tree::tree_db_leaf::tl_name, tree::tr_b, tree::tr_l, TREE_NULL, db_tree_state::ts_resp, db_tree_state::ts_sofar, TS_SOFAR_INTER, and TS_SOFAR_MINUS.

Referenced by db_recurse().

Here is the call graph for this function:

union tree* db_recurse struct db_tree_state tsp,
struct db_full_path pathp,
struct combined_tree_state **  region_start_statepp,
genptr_t  client_data
 

D B _ R E C U R S E

Recurse down the tree, finding all the leaves (or finding just all the regions).

ts_region_start_func() is called to permit regions to be skipped. It is not intended to be used for collecting state.

Definition at line 1125 of file db_tree.c.

References bn_mat_ck(), bu_avs_merge(), bu_free(), bu_log(), directory::d_flags, directory::d_namep, db_apply_state_from_comb(), db_dup_db_tree_state(), db_free_db_tree_state(), DB_FULL_PATH_CUR_DIR, db_new_combined_tree_state(), db_path_to_string(), db_pr_combined_tree_state(), db_recurse_subtree(), DEBUG_TREEWALK, DIR_COMB, db_full_path::fp_len, rt_db_internal::idb_avs, rt_db_internal::idb_ptr, tree::magic, NULL, OP_NOP, RT_CHECK_DBI, RT_CK_COMB, RT_CK_DBTS, RT_CK_FULL_PATH, RT_CK_RESOURCE, RT_CK_TREE, rt_db_free_internal(), rt_db_get_internal(), RT_DIR_PHONY_ADDR, RT_G_DEBUG, RT_GET_TREE, RT_INIT_DB_INTERNAL, RT_TREE_MAGIC, rt_comb_internal::tree, TREE_NULL, db_tree_state::ts_attrs, db_tree_state::ts_dbip, db_tree_state::ts_mat, db_tree_state::ts_resp, db_tree_state::ts_sofar, and db_tree_state::ts_stop_at_regions.

Referenced by db_recurse_subtree(), db_walk_subtree(), and db_walk_tree().

Here is the call graph for this function:

union tree* db_dup_subtree const union tree tp,
struct resource resp
 

D B _ D U P _ S U B T R E E

Definition at line 1344 of file db_tree.c.

References bn_mat_dup(), bu_log(), bu_strdup, db_dup_combined_tree_state(), db_dup_subtree(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, rt_bomb(), RT_CK_RESOURCE, RT_CK_TREE, RT_GET_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_cts::tc_ctsp, tree::tree_db_leaf::tl_mat, tree::tree_db_leaf::tl_name, tree::tr_b, tree::tr_c, tree::tr_l, and TREE_NULL.

Referenced by db_dup_subtree(), db_non_union_push(), and db_tree_flatten_describe().

Here is the call graph for this function:

void db_free_tree register union tree tp,
struct resource resp
 

D B _ F R E E _ T R E E

Release all storage associated with node 'tp', including children nodes.

Definition at line 1445 of file db_tree.c.

References bu_free(), bu_log(), db_free_combined_tree_state(), db_free_tree(), fp, nmgregion::l, bu_list::magic, NMG_CK_REGION, nmg_kr(), NMG_REGION_MAGIC, NULL, OP_DB_LEAF, OP_FREE, OP_GUARD, OP_INTERSECT, OP_NMG_TESS, OP_NOP, OP_NOT, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, rt_bomb(), RT_CK_RESOURCE, RT_CK_SOLTAB, RT_CK_TREE, rt_free_soltab(), RT_FREE_TREE, RT_SOLTAB_NULL, RT_TREE_MAGIC, and TREE_NULL.

Here is the call graph for this function:

void db_left_hvy_node union tree tp  ) 
 

D B _ L E F T _ H V Y _ N O D E

Re-balance this node to make it left heavy. Unions operators will be moved to left side. when finished "tp" MUST still point to top node od this subtree.

Definition at line 1562 of file db_tree.c.

References OP_UNION, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Referenced by db_non_union_push().

void db_non_union_push register union tree tp,
struct resource resp
 

D B _ N O N _ U N I O N _ P U S H

If there are non-union operations in the tree, above the region nodes, then rewrite the tree so that the entire tree top is nothing but union operations, and any non-union operations are clustered down near the region nodes.

Definition at line 1592 of file db_tree.c.

References A, db_dup_subtree(), db_free_tree(), db_left_hvy_node(), db_non_union_push(), db_tree_del_lhs(), db_tree_del_rhs(), tree::magic, NULL, OP_DB_LEAF, OP_INTERSECT, OP_NOP, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, RT_CK_RESOURCE, RT_CK_TREE, RT_GET_TREE, RT_TREE_MAGIC, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Here is the call graph for this function:

int db_count_tree_nodes const union tree tp,
int  count
 

D B _ C O U N T _ T R E E _ N O D E S

Return a count of the number of "union tree" nodes below "tp", including tp.

Definition at line 1810 of file db_tree.c.

References bu_log(), db_count_tree_nodes(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, rt_bomb(), RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Referenced by db_count_tree_nodes().

Here is the call graph for this function:

int db_is_tree_all_unions const union tree tp  ) 
 

D B _ I S _ T R E E _ A L L _ U N I O N S

Returns - 1 if this tree contains nothing but union operations. 0 if at least one subtraction or intersection op exists.

Definition at line 1852 of file db_tree.c.

References bu_log(), db_is_tree_all_unions(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, rt_bomb(), RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Referenced by db_is_tree_all_unions().

Here is the call graph for this function:

int db_count_subtree_regions const union tree tp  ) 
 

D B _ C O U N T _ S U B T R E E _ R E G I O N S

Definition at line 1889 of file db_tree.c.

References bu_log(), db_count_subtree_regions(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, rt_bomb(), RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Referenced by db_count_subtree_regions().

Here is the call graph for this function:

int db_tally_subtree_regions union tree tp,
union tree **  reg_trees,
int  cur,
int  lim,
struct resource resp
 

D B _ T A L L Y _ S U B T R E E _ R E G I O N S

Definition at line 1927 of file db_tree.c.

References bu_log(), db_tally_subtree_regions(), OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_REGION, OP_SOLID, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, rt_bomb(), RT_CK_RESOURCE, RT_CK_TREE, RT_GET_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, and tree::tr_b.

Referenced by db_tally_subtree_regions().

Here is the call graph for this function:

HIDDEN union tree* db_gettree_region_end register struct db_tree_state tsp,
struct db_full_path pathp,
union tree curtree,
genptr_t  client_data
 

Definition at line 1981 of file db_tree.c.

References db_new_combined_tree_state(), tree::magic, OP_REGION, RT_CK_DBI, RT_CK_DBTS, RT_CK_FULL_PATH, RT_CK_RESOURCE, RT_GET_TREE, RT_TREE_MAGIC, tree::tree_cts::tc_ctsp, and tree::tr_c.

Referenced by db_walk_tree().

Here is the call graph for this function:

HIDDEN union tree* db_gettree_leaf struct db_tree_state tsp,
struct db_full_path pathp,
struct rt_db_internal ip,
genptr_t  client_data
 

Definition at line 1997 of file db_tree.c.

References db_new_combined_tree_state(), tree::magic, OP_REGION, RT_CK_DB_INTERNAL, RT_CK_DBI, RT_CK_DBTS, RT_CK_FULL_PATH, RT_CK_RESOURCE, RT_GET_TREE, RT_TREE_MAGIC, tree::tree_cts::tc_ctsp, tree::tr_c, db_tree_state::ts_dbip, and db_tree_state::ts_resp.

Referenced by db_walk_tree().

Here is the call graph for this function:

HIDDEN void db_walk_subtree register union tree tp,
struct combined_tree_state **  region_start_statepp,
union tree **leaf_func   BU_ARGS((struct db_tree_state *, struct db_full_path *, struct rt_db_internal *, void *)),
genptr_t  client_data,
struct resource resp
 

D B _ W A L K _ S U B T R E E

Definition at line 2032 of file db_tree.c.

References bu_bomb(), bu_free(), bu_log(), combined_tree_state::cts_p, combined_tree_state::cts_s, db_free_combined_tree_state(), db_path_to_string(), db_recurse(), db_full_path::fp_len, OP_DB_LEAF, OP_GUARD, OP_INTERSECT, OP_NOP, OP_NOT, OP_REGION, OP_SUBTRACT, OP_UNION, OP_XNOP, OP_XOR, RT_CK_CTS, RT_CK_DBI, RT_CK_RESOURCE, RT_CK_TREE, RT_FREE_TREE, rt_pr_tree(), TREE_NULL, db_tree_state::ts_dbip, db_tree_state::ts_resp, db_tree_state::ts_sofar, TS_SOFAR_REGION, and db_tree_state::ts_stop_at_regions.

Referenced by db_walk_dispatcher().

Here is the call graph for this function:

HIDDEN void db_walk_dispatcher int  cpu,
genptr_t  arg
 

D B _ W A L K _ D I S P A T C H E R

This routine handles the PARALLEL portion of db_walk_tree(). There will be at least one, and possibly more, instances of this routine running simultaneously.

Uses the self-dispatcher pattern: Pick off the next region's tree, and walk it.

Definition at line 2136 of file db_tree.c.

References bu_log(), BU_PTBL_GET, bu_semaphore_acquire(), bu_semaphore_release(), db_walk_parallel_state::client_data, DB_CK_WPS, db_free_combined_tree_state(), db_pr_combined_tree_state(), db_walk_subtree(), NULL, db_walk_parallel_state::reg_count, db_walk_parallel_state::reg_current, db_walk_parallel_state::reg_end_func, db_walk_parallel_state::reg_leaf_func, db_walk_parallel_state::reg_trees, RT_CK_CTS, RT_CK_RESOURCE, RT_CK_RTI, RT_CK_TREE, RT_G_DEBUG, rt_pr_tree(), RT_SEM_WORKER, rt_uniresource, rt_i::rti_resources, db_walk_parallel_state::rtip, and TREE_NULL.

Here is the call graph for this function:

int db_walk_tree struct db_i dbip,
int  argc,
const char **  argv,
int  ncpu,
const struct db_tree_state init_state,
int(*)(struct db_tree_state *, struct db_full_path *, const struct rt_comb_internal *, genptr_t reg_start_func,
union tree *(*)(struct db_tree_state *, struct db_full_path *, union tree *, genptr_t reg_end_func,
union tree *(*)(struct db_tree_state *, struct db_full_path *, struct rt_db_internal *, genptr_t leaf_func,
genptr_t  client_data
 

D B _ W A L K _ T R E E

This is the top interface to the "tree walker."

Parameters: rtip rt_i structure to database (open with rt_dirbuild()) argc # of tree-tops named argv names of tree-tops to process init_state Input parameter: initial state of the tree. For example: rt_initial_tree_state, and mged_initial_tree_state.

These parameters are pointers to callback routines. If NULL, they won't be called.

reg_start_func Called at beginning of each region, before visiting any nodes within the region. Return 0 if region should be skipped without recursing, otherwise non-zero. DO NOT USE FOR OTHER PURPOSES! For example, can be used to quickly skip air regions.

reg_end_func Called after all nodes within a region have been recursively processed by leaf_func. If it wants to retain 'curtree' then it may steal that pointer and return TREE_NULL. If it wants us to clean up some or all of that tree, then it returns a non-null (union tree *) pointer, and that tree is safely freed in a non-parallel section before we return.

leaf_func Function to process a leaf node. It is actually invoked from db_recurse() from db_walk_subtree(). Returns (union tree *) representing the leaf, or TREE_NULL if leaf does not exist or has an error.

This routine will employ multiple CPUs if asked, but is not multiply-parallel-recursive. Call this routine with ncpu > 1 from serial code only. When called from within an existing thread, ncpu must be 1.

If ncpu > 1, the caller is responsible for making sure that rt_g.rtg_parallel is non-zero, and that the bu_semaphore_init() functions has been performed, first.

Plucks per-cpu resources out of rtip->rti_resources[]. They need to have been initialized first.

Returns - -1 Failure to prepare even a single sub-tree 0 OK

Definition at line 2262 of file db_tree.c.

References bu_log(), BU_PTBL_GET, db_follow_path_for_state(), db_free_combined_tree_state(), db_free_full_path(), db_full_path_init(), db_gettree_leaf(), db_gettree_region_end(), db_recurse(), LOOKUP_NOISY, NULL, OP_UNION, path, RT_CHECK_DBI, RT_CK_DBTS, RT_CK_RESOURCE, RT_CK_RTI, RT_CK_TREE, RT_G_DEBUG, RT_GET_TREE, rt_pr_tree(), RT_TREE_MAGIC, rt_uniresource, rt_i::rti_resources, tree::tree_node::tb_right, tree::tr_b, TREE_NULL, db_tree_state::ts_dbip, db_tree_state::ts_resp, db_tree_state::ts_rtip, and db_tree_state::ts_stop_at_regions.

Here is the call graph for this function:

int db_path_to_mat struct db_i dbip,
struct db_full_path pathp,
mat_t  mat,
int  depth,
struct resource resp
 

D B _ P A T H _ T O _ M A T

Returns - 1 OK, path matrix written into 'mat'. 0 FAIL

Called in librt/db_tree.c, mged/dodraw.c, and mged/animedit.c

Definition at line 2477 of file db_tree.c.

References db_follow_path(), db_free_db_tree_state(), db_free_full_path(), db_full_path_init(), db_init_db_tree_state(), LOOKUP_NOISY, MAT_COPY, rt_bomb(), RT_CHECK_DBI, RT_CK_FULL_PATH, and db_tree_state::ts_mat.

Referenced by db_region_mat().

Here is the call graph for this function:

void db_apply_anims struct db_full_path pathp,
struct directory dp,
mat_t  stack,
mat_t  arc,
struct mater_info materp
 

D B _ A P P L Y _ A N I M S

'arc' may be a null pointer, signifying an identity matrix. 'materp' may be a null pointer, signifying that the region has already been finalized above this point in the tree.

Definition at line 2514 of file db_tree.c.

References animate::an_forw, animate::an_path, ANIM_NULL, bu_free(), bu_log(), directory::d_animate, directory::d_namep, db_path_to_string(), DEBUG_ANIM, db_full_path::fp_len, db_full_path::fp_names, RT_CK_ANIMATE, and RT_G_DEBUG.

Referenced by db_apply_state_from_memb().

Here is the call graph for this function:

int db_region_mat mat_t  m,
struct db_i dbip,
const char *  name,
struct resource resp
 

D B _ R E G I O N _ M A T

Given the name of a region, return the matrix which maps model coordinates into "region" coordinates.

Returns: 0 OK <0 Failure

Definition at line 2583 of file db_tree.c.

References bn_mat_inv(), bu_log(), db_free_full_path(), db_path_to_mat(), and db_string_to_path().

Referenced by db_shader_mat().

Here is the call graph for this function:

int db_shader_mat mat_t  model_to_shader,
const struct rt_i rtip,
const struct region rp,
point_t  p_min,
point_t  p_max,
struct resource resp
 

D B _ S H A D E R _ M A T XXX given that this routine depends on rtip, it should be called XXX rt_shader_mat().

Given a region, return a matrix which maps model coordinates into region "shader space". This is a space where points in the model within the bounding box of the region are mapped into "region" space (the coordinate system in which the region is defined). The area occupied by the region's bounding box (in region coordinates) are then mapped into the unit cube. This unit cube defines "shader space".

Returns: 0 OK <0 Failure

Definition at line 2631 of file db_tree.c.

References bn_mat_mul(), bn_mat_print(), bu_bomb(), bu_log(), bu_semaphore_acquire(), bu_semaphore_release(), db_region_mat(), MAT_DELTAS_VEC, MAT_IDN, MAT_SCALE_VEC, region::reg_name, rt_basename(), RT_CK_RESOURCE, RT_CK_RTI, rt_clean(), rt_gettree(), rt_new_rti(), rt_rpp_region(), RT_SEM_MODEL, rt_i::rti_dbip, rt_i::useair, V3ARGS, VEQUAL, VINVDIR, VSCALE, and VSUB2.

Here is the call graph for this function:

void db_traverse_subtree union tree tp,
void(*)(struct directory *, struct db_traverse *)  traverse_func,
struct db_traverse dtp
 

Definition at line 72 of file db_walk.c.

References bu_bomb(), bu_log(), db_lookup(), db_traverse::dbip, DIR_NULL, LOOKUP_NOISY, OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, db_traverse::resp, RT_CHECK_DBI, RT_CK_DBTR, RT_CK_RESOURCE, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_name, tree::tr_b, and tree::tr_l.

Referenced by db_preorder_traverse().

Here is the call graph for this function:

void db_preorder_traverse struct directory dp,
struct db_traverse dtp
 

Definition at line 118 of file db_walk.c.

References bu_free(), bu_log(), db_traverse::client_data, db_traverse::comb_enter_func, db_traverse::comb_exit_func, directory::d_flags, directory::d_len, directory::d_namep, db_getmrec(), db_lookup(), db_traverse_subtree(), db_i::dbi_version, db_traverse::dbip, DEBUG_DB, DIR_COMB, DIR_NULL, rt_db_internal::idb_ptr, db_traverse::leaf_func, LOOKUP_NOISY, record::M, record::member::m_instname, NULL, db_traverse::resp, RT_CK_DBI, RT_CK_DBTR, rt_db_free_internal(), rt_db_get_internal5(), RT_G_DEBUG, and rt_comb_internal::tree.

Here is the call graph for this function:

void db_functree_subtree struct db_i dbip,
union tree tp,
void(*)(struct db_i *, struct directory *, genptr_t comb_func,
void(*)(struct db_i *, struct directory *, genptr_t leaf_func,
struct resource resp,
genptr_t  client_data
 

Definition at line 186 of file db_walk.c.

References bu_bomb(), bu_log(), db_functree(), db_lookup(), DIR_NULL, LOOKUP_NOISY, OP_DB_LEAF, OP_INTERSECT, OP_SUBTRACT, OP_UNION, OP_XOR, RT_CHECK_DBI, RT_CK_RESOURCE, RT_CK_TREE, tree::tree_node::tb_left, tree::tree_node::tb_right, tree::tree_db_leaf::tl_name, tree::tr_b, and tree::tr_l.

Referenced by db_functree().

Here is the call graph for this function:

void db_functree struct db_i dbip,
struct directory dp,
void(*)(struct db_i *, struct directory *, genptr_t comb_func,
void(*)(struct db_i *, struct directory *, genptr_t leaf_func,
struct resource resp,
genptr_t  client_data
 

D B _ F U N C T R E E

This subroutine is called for a no-frills tree-walk, with the provided subroutines being called at every combination and leaf (solid) node, respectively.

This routine is recursive, so no variables may be declared static.

Definition at line 234 of file db_walk.c.

References bu_free(), bu_log(), directory::d_flags, directory::d_len, directory::d_namep, db_functree(), db_functree_subtree(), db_getmrec(), db_lookup(), db_i::dbi_version, DEBUG_DB, DIR_COMB, DIR_NULL, rt_db_internal::idb_ptr, LOOKUP_NOISY, M, NULL, RT_CK_DBI, rt_db_free_internal(), rt_db_get_internal5(), RT_G_DEBUG, and rt_comb_internal::tree.

Referenced by db_functree(), db_functree_subtree(), and wdb_killtree_cmd().

Here is the call graph for this function:

struct rt_i* rt_dirbuild const char *  filename,
char *  buf,
int  len
 

Definition at line 72 of file dir.c.

References db_close(), db_dirbuild(), db_open(), DBI_NULL, db_i::dbi_title, NULL, resource::re_magic, RT_CK_DBI, rt_init_resource(), rt_new_rti(), rt_uniresource, and RTI_NULL.

Here is the call graph for this function:

int rt_db_get_internal struct rt_db_internal ip,
const struct directory dp,
const struct db_i dbip,
const mat_t  mat,
struct resource resp
 

Definition at line 109 of file dir.c.

References bn_mat_identity, bu_avs_init_empty(), bu_free_external(), BU_INIT_EXTERNAL, bu_log(), directory::d_flags, directory::d_namep, db_get_external(), db_i::dbi_version, DIR_COMB, ID_COMBINATION, NULL, RT_CK_DB_INTERNAL, rt_db_free_internal(), rt_db_get_internal5(), rt_id_solid(), and RT_INIT_DB_INTERNAL.

Referenced by add_solid(), db_follow_path(), db_recurse(), db_update_nref(), main(), rt_arb_uv(), rt_db_lookup_internal(), rt_extrude_import(), rt_extrude_import5(), rt_find_paths(), rt_tcl_import_from_path(), rt_vlist_solid(), wdb_adjust_cmd(), wdb_binary_cmd(), wdb_bot_decimate_cmd(), wdb_comb_std_cmd(), wdb_combadd(), wdb_do_list(), wdb_find_cmd(), wdb_get_obj_bounds2(), wdb_identitize(), wdb_import(), wdb_killall_cmd(), wdb_move_all_cmd(), wdb_move_cmd(), wdb_nmg_collapse_cmd(), wdb_nmg_simplify_cmd(), wdb_node_write(), wdb_ocenter_cmd(), wdb_orotate_cmd(), wdb_oscale_cmd(), wdb_otranslate_cmd(), wdb_push_cmd(), wdb_remove_cmd(), wdb_rmap_cmd(), wdb_shells_cmd(), wdb_showmats_cmd(), wdb_smooth_bot_cmd(), and wdb_whatid_cmd().

Here is the call graph for this function:

int rt_db_put_internal struct directory dp,
struct db_i dbip,
struct rt_db_internal ip,
struct resource resp
 

Definition at line 166 of file dir.c.

References bu_free_external(), BU_INIT_EXTERNAL, bu_log(), directory::d_namep, DB5_MAJORTYPE_BRLCAD, db_put_external(), db_i::dbi_version, rt_db_internal::idb_meth, RT_CK_DB_INTERNAL, rt_db_free_internal(), and rt_db_put_internal5().

Referenced by wdb_comb_std_cmd(), wdb_combadd(), wdb_facetize_cmd(), wdb_identitize(), wdb_make_bb_cmd(), wdb_move_all_cmd(), wdb_move_cmd(), wdb_nmg_collapse_cmd(), wdb_nmg_simplify_cmd(), wdb_ocenter_cmd(), wdb_orotate_cmd(), wdb_oscale_cmd(), wdb_otranslate_cmd(), wdb_push_cmd(), wdb_shells_cmd(), and wdb_smooth_bot_cmd().

Here is the call graph for this function:

int rt_fwrite_internal FILE *  fp,
const char *  name,
const struct rt_db_internal ip,
double  conv2mm
 

Definition at line 215 of file dir.c.

References bu_free_external(), BU_INIT_EXTERNAL, bu_log(), rt_db_internal::idb_meth, NULL, RT_CK_DB_INTERNAL, RT_CK_FUNCTAB, and rt_uniresource.

Here is the call graph for this function:

void rt_db_free_internal struct rt_db_internal ip,
struct resource resp
 

Definition at line 250 of file dir.c.

References bu_avs_free(), BU_AVS_MAGIC, rt_db_internal::idb_avs, rt_db_internal::idb_meth, rt_db_internal::idb_ptr, bu_attribute_value_set::magic, NULL, RT_CK_DB_INTERNAL, RT_CK_FUNCTAB, and RT_INIT_DB_INTERNAL.

Referenced by add_solid(), db_follow_path(), db_functree(), db_preorder_traverse(), db_recurse(), main(), rt_arb_uv(), rt_db_external5_to_internal5(), rt_db_get_internal(), rt_db_put_internal(), rt_db_put_internal5(), rt_extrude_xform(), rt_find_paths(), rt_generic_xform(), rt_hf_to_dsp(), rt_hlf_xform(), rt_mk_binunif(), rt_vlist_solid(), wdb_adjust_cmd(), wdb_binary_cmd(), wdb_bot_decimate_cmd(), wdb_comb_std_cmd(), wdb_combadd(), wdb_do_list(), wdb_facetize_cmd(), wdb_get_cmd(), wdb_get_obj_bounds2(), wdb_get_type_cmd(), wdb_make_bb_cmd(), wdb_move_arb_edge_cmd(), wdb_move_arb_face_cmd(), wdb_move_cmd(), wdb_nmg_collapse_cmd(), wdb_nmg_simplify_cmd(), wdb_ocenter_cmd(), wdb_orotate_cmd(), wdb_oscale_cmd(), wdb_otranslate_cmd(), wdb_push_cmd(), wdb_put_internal(), wdb_rotate_arb_face_cmd(), wdb_showmats_cmd(), wdb_smooth_bot_cmd(), and wdb_whatid_cmd().

Here is the call graph for this function:

int rt_db_lookup_internal struct db_i dbip,
const char *  obj_name,
struct directory **  dpp,
struct rt_db_internal ip,
int  noisy,
struct resource resp
 

Definition at line 287 of file dir.c.

References bu_log(), directory::d_namep, db_lookup(), DIR_NULL, ID_NULL, idb_type, LOOKUP_NOISY, NULL, and rt_db_get_internal().

Here is the call graph for this function:


Generated on Mon Sep 18 01:25:41 2006 for BRL-CAD by  doxygen 1.4.6