Blender
V3.3
|
Go to the source code of this file.
Classes | |
struct | _EdgeHash_Edge |
struct | _EdgeHash_Entry |
struct | EdgeHashIterator |
struct | EdgeSetIterator |
Macros | |
#define | BLI_EDGEHASH_SIZE_GUESS_FROM_LOOPS(totloop) ((totloop) / 2) |
#define | BLI_EDGEHASH_SIZE_GUESS_FROM_POLYS(totpoly) ((totpoly)*2) |
Typedefs | |
typedef struct EdgeHash | EdgeHash |
typedef struct EdgeHashIterator | EdgeHashIterator |
typedef void(* | EdgeHashFreeFP) (void *key) |
typedef struct EdgeSet | EdgeSet |
typedef struct EdgeSetIterator | EdgeSetIterator |
Enumerations | |
enum | { EDGEHASH_FLAG_ALLOW_DUPES = (1 << 0) } |
#define BLI_EDGEHASH_SIZE_GUESS_FROM_LOOPS | ( | totloop | ) | ((totloop) / 2) |
Definition at line 182 of file BLI_edgehash.h.
#define BLI_EDGEHASH_SIZE_GUESS_FROM_POLYS | ( | totpoly | ) | ((totpoly)*2) |
Definition at line 183 of file BLI_edgehash.h.
Definition at line 1 of file BLI_edgehash.h.
Definition at line 34 of file BLI_edgehash.h.
typedef struct EdgeHashIterator EdgeHashIterator |
Definition at line 177 of file BLI_edgehash.h.
typedef struct EdgeSetIterator EdgeSetIterator |
anonymous enum |
Enumerator | |
---|---|
EDGEHASH_FLAG_ALLOW_DUPES | Only checked for in debug mode. |
Definition at line 36 of file BLI_edgehash.h.
void BLI_edgehash_clear | ( | EdgeHash * | eh, |
EdgeHashFreeFP | free_value | ||
) |
Wraps BLI_edgehash_clear_ex with zero entries reserved.
Definition at line 383 of file edgehash.c.
References BLI_edgehash_clear_ex().
Referenced by TEST().
void BLI_edgehash_clear_ex | ( | EdgeHash * | eh, |
EdgeHashFreeFP | free_value, | ||
uint | reserve | ||
) |
Remove all edges from hash.
Ensure (v0, v1) is exists in eh.
This handles the common situation where the caller needs ensure a key is added to eh, constructing a new value in the case the key isn't found. Otherwise use the existing value.
Such situations typically incur multiple lookups, however this function avoids them by ensuring the key is added, returning a pointer to the value so it can be used or initialized by the caller.
Definition at line 307 of file edgehash.c.
References edgehash_ensure_can_insert(), edgehash_insert(), edgehash_insert_at_slot(), EH_INDEX_HAS_EDGE, EdgeHash::entries, init_edge(), ITER_SLOTS, NULL, SLOT_EMPTY, v1, and _EdgeHash_Entry::value.
Referenced by BKE_mesh_merge_verts(), laplacian_increase_edge_count(), blender::draw::lines_adjacency_triangle(), set_edge_adjacency_lines_indices(), split_faces_prepare_new_edges(), blender::draw::statvis_calc_sharp(), and TEST().
void BLI_edgehash_free | ( | EdgeHash * | eh, |
EdgeHashFreeFP | free_value | ||
) |
Definition at line 230 of file edgehash.c.
References edgehash_free_values(), EdgeHash::entries, EdgeHash::map, and MEM_freeN.
Referenced by BKE_mesh_validate_arrays(), ccgDM_release(), convert_mfaces_to_mpolys(), customdata_compare(), cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), blender::draw::extract_lines_adjacency_finish(), laplacian_system_construct_end(), make_edges_mdata_extend(), mesh_calc_edges_mdata(), psys_sph_finalize(), blender::io::alembic::read_edge_creases(), split_faces_prepare_new_edges(), blender::draw::statvis_calc_sharp(), TEST(), and test_polyfill_topology().
Return boolean true/false if edge (v0,v1) in hash.
Definition at line 363 of file edgehash.c.
References edgehash_lookup_entry(), NULL, and v1.
Referenced by BKE_mesh_validate_arrays(), make_edges_mdata_extend(), and TEST().
Insert edge (v0, v1) into hash with given value, does not check for duplicates.
Definition at line 261 of file edgehash.c.
References edgehash_ensure_can_insert(), edgehash_insert(), init_edge(), and v1.
Referenced by BKE_mesh_validate_arrays(), ccgDM_copyFinalLoopArray(), convert_mfaces_to_mpolys(), customdata_compare(), mesh_calc_edges_mdata(), blender::io::alembic::read_edge_creases(), sph_springhash_build(), TEST(), and test_polyfill_topology().
int BLI_edgehash_len | ( | const EdgeHash * | eh | ) |
Return number of keys in hash.
Definition at line 368 of file edgehash.c.
References EdgeHash::length.
Referenced by make_edges_mdata_extend(), TEST(), and test_polyfill_topology().
Return value for given edge (v0, v1), or NULL if if key does not exist in hash. (If need exists to differentiate between key-value being NULL and lack of key then see BLI_edgehash_lookup_p().
Definition at line 295 of file edgehash.c.
References edgehash_lookup_entry(), NULL, v1, and _EdgeHash_Entry::value.
Referenced by BKE_mesh_validate_arrays(), copyFinalLoopArray_task_cb(), customdata_compare(), edgecut_get(), laplacian_edge_count(), make_edges_mdata_extend(), mesh_calc_edges_mdata(), blender::io::alembic::read_edge_creases(), sph_force_cb(), and TEST().
void* BLI_edgehash_lookup_default | ( | const EdgeHash * | eh, |
unsigned int | v0, | ||
unsigned int | v1, | ||
void * | default_value | ||
) |
A version of BLI_edgehash_lookup which accepts a fallback argument.
Definition at line 289 of file edgehash.c.
References edgehash_lookup_entry(), v1, and _EdgeHash_Entry::value.
Referenced by TEST().
Return pointer to value for given edge (v0, v1), or NULL if key does not exist in hash.
Definition at line 301 of file edgehash.c.
References edgehash_lookup_entry(), NULL, v1, and _EdgeHash_Entry::value.
Referenced by TEST(), and test_polyfill_topology().
EdgeHash* BLI_edgehash_new | ( | const char * | info | ) |
Definition at line 225 of file edgehash.c.
References BLI_edgehash_new_ex(), and CAPACITY_EXP_DEFAULT.
Referenced by cutEdges(), explodeMesh(), TEST(), and test_polyfill_topology().
EdgeHash* BLI_edgehash_new_ex | ( | const char * | info, |
unsigned int | nentries_reserve | ||
) |
Definition at line 212 of file edgehash.c.
References calc_capacity_exp_for_reserve(), EdgeHash::capacity_exp, CLEAR_MAP, EdgeHash::dummy_count, EdgeHash::entries, ENTRIES_CAPACITY, EdgeHash::length, EdgeHash::map, MAP_CAPACITY, MEM_calloc_arrayN, MEM_malloc_arrayN, MEM_mallocN, and UPDATE_SLOT_MASK.
Referenced by BKE_mesh_merge_verts(), BKE_mesh_validate_arrays(), BLI_edgehash_new(), ccgDM_copyFinalLoopArray(), convert_mfaces_to_mpolys(), customdata_compare(), DRW_displist_indexbuf_create_edges_adjacency_lines(), laplacian_system_construct_end(), blender::draw::line_adjacency_data_init(), make_edges_mdata_extend(), mesh_calc_edges_mdata(), blender::io::alembic::read_edge_creases(), sph_springhash_build(), split_faces_prepare_new_edges(), and blender::draw::statvis_calc_sharp().
Remove key (v0, v1) from eh, returning the value or NULL if the key wasn't found.
v0,v1 | The key to remove. |
Definition at line 338 of file edgehash.c.
References EdgeHash::dummy_count, _EdgeHash_Entry::edge, edgehash_change_index(), EH_INDEX_HAS_EDGE, EdgeHash::entries, init_edge(), ITER_SLOTS, blender::math::length(), EdgeHash::length, EdgeHash::map, NULL, SLOT_DUMMY, SLOT_EMPTY, v1, and _EdgeHash_Entry::value.
Referenced by BLI_edgehash_remove(), and TEST().
Definition at line 238 of file edgehash.c.
References _EdgeHash_Entry::edge, EdgeHash::entries, ENTRIES_CAPACITY, EdgeHash::length, EdgeHash::map, MAP_CAPACITY, _EdgeHash_Edge::v_high, _EdgeHash_Edge::v_low, and _EdgeHash_Entry::value.
Assign a new value to a key that may already be in edgehash.
Definition at line 268 of file edgehash.c.
References edgehash_ensure_can_insert(), edgehash_insert(), edgehash_insert_at_slot(), EH_INDEX_HAS_EDGE, EdgeHash::entries, init_edge(), ITER_SLOTS, SLOT_EMPTY, v1, and _EdgeHash_Entry::value.
Referenced by BKE_mesh_poly_edgehash_insert(), cutEdges(), explodeMesh(), and TEST().
bool BLI_edgehash_remove | ( | EdgeHash * | eh, |
unsigned int | v0, | ||
unsigned int | v1, | ||
EdgeHashFreeFP | free_value | ||
) |
Remove key (v0, v1) from eh, or return false if the key wasn't found.
v0,v1 | The key to remove. |
free_value | Optional callback to free the value. |
Definition at line 328 of file edgehash.c.
References BLI_edgehash_popkey(), EdgeHash::length, and v1.
Referenced by BKE_mesh_merge_verts(), and TEST().
void BLI_edgehashIterator_free | ( | EdgeHashIterator * | ehi | ) |
Free an EdgeHashIterator.
Definition at line 408 of file edgehash.c.
References MEM_freeN.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), blender::draw::extract_lines_adjacency_finish(), make_edges_mdata_extend(), blender::draw::statvis_calc_sharp(), TEST(), and test_polyfill_topology().
BLI_INLINE void BLI_edgehashIterator_getKey | ( | EdgeHashIterator * | ehi, |
unsigned int * | r_v0, | ||
unsigned int * | r_v1 | ||
) |
Definition at line 161 of file BLI_edgehash.h.
References _EdgeHash_Entry::edge, EdgeHashIterator::entries, and EdgeHashIterator::index.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), blender::draw::extract_lines_adjacency_finish(), make_edges_mdata_extend(), and blender::draw::statvis_calc_sharp().
BLI_INLINE void* BLI_edgehashIterator_getValue | ( | EdgeHashIterator * | ehi | ) |
Definition at line 169 of file BLI_edgehash.h.
References EdgeHashIterator::entries, EdgeHashIterator::index, and _EdgeHash_Entry::value.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), blender::draw::extract_lines_adjacency_finish(), blender::draw::statvis_calc_sharp(), and TEST().
BLI_INLINE void** BLI_edgehashIterator_getValue_p | ( | EdgeHashIterator * | ehi | ) |
Definition at line 173 of file BLI_edgehash.h.
References EdgeHashIterator::entries, EdgeHashIterator::index, and _EdgeHash_Entry::value.
Referenced by test_polyfill_topology().
void BLI_edgehashIterator_init | ( | EdgeHashIterator * | ehi, |
EdgeHash * | eh | ||
) |
Initialize an already allocated EdgeHashIterator. The hash table must not be mutated while the iterator is in use, and the iterator will step exactly BLI_edgehash_len(eh) times before becoming done.
ehi | The EdgeHashIterator to initialize. |
eh | The EdgeHash to iterate over. |
Definition at line 401 of file edgehash.c.
References EdgeHashIterator::entries, EdgeHash::entries, EdgeHashIterator::index, EdgeHashIterator::length, and EdgeHash::length.
Referenced by BLI_edgehashIterator_new().
BLI_INLINE bool BLI_edgehashIterator_isDone | ( | const EdgeHashIterator * | ehi | ) |
Definition at line 157 of file BLI_edgehash.h.
References EdgeHashIterator::index, and EdgeHashIterator::length.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), blender::draw::extract_lines_adjacency_finish(), make_edges_mdata_extend(), blender::draw::statvis_calc_sharp(), TEST(), and test_polyfill_topology().
EdgeHashIterator* BLI_edgehashIterator_new | ( | EdgeHash * | eh | ) |
Create a new EdgeHashIterator. The hash table must not be mutated while the iterator is in use, and the iterator will step exactly #BLI_edgehash_len(eh) times before becoming done.
Definition at line 394 of file edgehash.c.
References BLI_edgehashIterator_init(), and MEM_mallocN.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), blender::draw::extract_lines_adjacency_finish(), make_edges_mdata_extend(), blender::draw::statvis_calc_sharp(), TEST(), and test_polyfill_topology().
BLI_INLINE void BLI_edgehashIterator_setValue | ( | EdgeHashIterator * | ehi, |
void * | val | ||
) |
Definition at line 177 of file BLI_edgehash.h.
References EdgeHashIterator::entries, EdgeHashIterator::index, and _EdgeHash_Entry::value.
Referenced by cutEdges(), explodeMesh(), and make_edges_mdata_extend().
BLI_INLINE void BLI_edgehashIterator_step | ( | EdgeHashIterator * | ehi | ) |
Definition at line 153 of file BLI_edgehash.h.
References EdgeHashIterator::index.
Referenced by cutEdges(), DRW_displist_indexbuf_create_edges_adjacency_lines(), explodeMesh(), blender::draw::extract_lines_adjacency_finish(), make_edges_mdata_extend(), blender::draw::statvis_calc_sharp(), TEST(), and test_polyfill_topology().
A version of BLI_edgeset_insert which checks first if the key is in the set.
Definition at line 484 of file edgehash.c.
References edgeset_ensure_can_insert(), edgeset_insert_at_slot(), ES_INDEX_HAS_EDGE, init_edge(), ITER_SLOTS, SLOT_EMPTY, and v1.
Referenced by BKE_mesh_calc_edges_tessface(), cloth_brush_add_length_constraint(), cloth_build_springs(), ss_sync_from_uv(), and TEST().
Definition at line 441 of file edgehash.c.
References EdgeSet::entries, EdgeSet::map, and MEM_freeN.
Referenced by BKE_mesh_calc_edges_tessface(), cloth_build_springs(), cloth_free_errorsprings(), cloth_free_modifier(), cloth_free_modifier_extern(), SCULPT_cloth_brush_ensure_nodes_constraints(), ss_sync_from_uv(), and TEST().
Definition at line 513 of file edgehash.c.
References ES_INDEX_HAS_EDGE, init_edge(), ITER_SLOTS, SLOT_EMPTY, and v1.
Referenced by cloth_brush_sim_has_length_constraint(), cloth_build_springs(), cloth_bvh_selfcollision_is_active(), and TEST().
Adds the key to the set (no checks for unique keys!). Matching BLI_edgehash_insert
Definition at line 500 of file edgehash.c.
References edgeset_ensure_can_insert(), edgeset_insert_at_slot(), init_edge(), ITER_SLOTS, SLOT_EMPTY, and v1.
Referenced by cloth_build_springs(), and TEST().
int BLI_edgeset_len | ( | const EdgeSet * | es | ) |
Definition at line 448 of file edgehash.c.
References EdgeSet::length.
Referenced by BKE_mesh_calc_edges_tessface(), and TEST().
EdgeSet* BLI_edgeset_new | ( | const char * | info | ) |
Definition at line 436 of file edgehash.c.
References BLI_edgeset_new_ex(), and CAPACITY_EXP_DEFAULT.
Referenced by cloth_build_springs(), SCULPT_cloth_brush_ensure_nodes_constraints(), and TEST().
EdgeSet* BLI_edgeset_new_ex | ( | const char * | info, |
unsigned int | nentries_reserve | ||
) |
Definition at line 424 of file edgehash.c.
References calc_capacity_exp_for_reserve(), EdgeSet::capacity_exp, CLEAR_MAP, EdgeSet::entries, ENTRIES_CAPACITY, EdgeSet::length, EdgeSet::map, MAP_CAPACITY, MEM_malloc_arrayN, MEM_mallocN, and UPDATE_SLOT_MASK.
Referenced by BKE_mesh_calc_edges_tessface(), BLI_edgeset_new(), cloth_build_springs(), and ss_sync_from_uv().
void BLI_edgesetIterator_free | ( | EdgeSetIterator * | esi | ) |
Definition at line 536 of file edgehash.c.
References MEM_freeN.
Referenced by BKE_mesh_calc_edges_tessface().
BLI_INLINE void BLI_edgesetIterator_getKey | ( | EdgeSetIterator * | esi, |
unsigned int * | r_v0, | ||
unsigned int * | r_v1 | ||
) |
Definition at line 222 of file BLI_edgehash.h.
References EdgeSetIterator::edges, and EdgeSetIterator::index.
Referenced by BKE_mesh_calc_edges_tessface().
BLI_INLINE bool BLI_edgesetIterator_isDone | ( | const EdgeSetIterator * | esi | ) |
Definition at line 234 of file BLI_edgehash.h.
References EdgeSetIterator::index, and EdgeSetIterator::length.
Referenced by BKE_mesh_calc_edges_tessface().
EdgeSetIterator* BLI_edgesetIterator_new | ( | EdgeSet * | es | ) |
Definition at line 527 of file edgehash.c.
References EdgeSetIterator::edges, EdgeSet::entries, EdgeSetIterator::index, EdgeSetIterator::length, EdgeSet::length, and MEM_mallocN.
Referenced by BKE_mesh_calc_edges_tessface().
BLI_INLINE void BLI_edgesetIterator_step | ( | EdgeSetIterator * | esi | ) |
Definition at line 230 of file BLI_edgehash.h.
References EdgeSetIterator::index.
Referenced by BKE_mesh_calc_edges_tessface().