Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions | Variables

edgehash.c File Reference

#include <stdlib.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
#include "BLI_edgehash.h"
#include "BLI_mempool.h"

Go to the source code of this file.

Classes

struct  EdgeEntry
struct  EdgeHash
struct  EdgeHashIterator

Defines

#define EDGE_HASH(v0, v1)   ((v0 * 39)^(v1 * 31))
#define EDGE_ORD(v0, v1)

Typedefs

typedef struct EdgeEntry EdgeEntry

Functions

EdgeHashBLI_edgehash_new (void)
void BLI_edgehash_insert (EdgeHash *eh, unsigned int v0, unsigned int v1, void *val)
void ** BLI_edgehash_lookup_p (EdgeHash *eh, unsigned int v0, unsigned int v1)
void * BLI_edgehash_lookup (EdgeHash *eh, unsigned int v0, unsigned int v1)
int BLI_edgehash_haskey (EdgeHash *eh, unsigned int v0, unsigned int v1)
int BLI_edgehash_size (EdgeHash *eh)
void BLI_edgehash_clear (EdgeHash *eh, EdgeHashFreeFP valfreefp)
void BLI_edgehash_free (EdgeHash *eh, EdgeHashFreeFP valfreefp)
EdgeHashIteratorBLI_edgehashIterator_new (EdgeHash *eh)
void BLI_edgehashIterator_free (EdgeHashIterator *ehi)
void BLI_edgehashIterator_getKey (EdgeHashIterator *ehi, unsigned int *v0_r, unsigned int *v1_r)
void * BLI_edgehashIterator_getValue (EdgeHashIterator *ehi)
void BLI_edgehashIterator_setValue (EdgeHashIterator *ehi, void *val)
void BLI_edgehashIterator_step (EdgeHashIterator *ehi)
int BLI_edgehashIterator_isDone (EdgeHashIterator *ehi)

Variables

static unsigned int _ehash_hashsizes []

Detailed Description

Definition in file edgehash.c.


Define Documentation

#define EDGE_HASH (   v0,
  v1 
)    ((v0 * 39)^(v1 * 31))

Definition at line 51 of file edgehash.c.

Referenced by BLI_edgehash_insert(), and BLI_edgehash_lookup_p().

#define EDGE_ORD (   v0,
  v1 
)
Value:
if (v0 > v1) {       \
        v0 ^= v1;        \
        v1 ^= v0;        \
        v0 ^= v1;        \
    }

Definition at line 54 of file edgehash.c.

Referenced by BLI_edgehash_insert(), and BLI_edgehash_lookup_p().


Typedef Documentation

typedef struct EdgeEntry EdgeEntry

Definition at line 63 of file edgehash.c.


Function Documentation

void BLI_edgehash_clear ( EdgeHash eh,
EdgeHashFreeFP  valfreefp 
)
void BLI_edgehash_free ( EdgeHash eh,
EdgeHashFreeFP  valfreefp 
)
int BLI_edgehash_haskey ( EdgeHash eh,
unsigned int  v0,
unsigned int  v1 
)
void BLI_edgehash_insert ( EdgeHash eh,
unsigned int  v0,
unsigned int  v1,
void *  val 
)
void* BLI_edgehash_lookup ( EdgeHash eh,
unsigned int  v0,
unsigned int  v1 
)
void** BLI_edgehash_lookup_p ( EdgeHash eh,
unsigned int  v0,
unsigned int  v1 
)
EdgeHash* BLI_edgehash_new ( void  )
int BLI_edgehash_size ( EdgeHash eh)

Definition at line 158 of file edgehash.c.

References EdgeHash::nentries.

Referenced by BKE_mesh_calc_edges(), and CDDM_calc_edges().

void BLI_edgehashIterator_free ( EdgeHashIterator ehi)
void BLI_edgehashIterator_getKey ( EdgeHashIterator ehi,
unsigned int *  v0_r,
unsigned int *  v1_r 
)
void* BLI_edgehashIterator_getValue ( EdgeHashIterator ehi)
int BLI_edgehashIterator_isDone ( EdgeHashIterator ehi)
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_size(gh) times before becoming done.

Definition at line 203 of file edgehash.c.

References EdgeHash::buckets, EdgeHashIterator::curBucket, EdgeHashIterator::curEntry, EdgeHashIterator::eh, MEM_mallocN(), EdgeHash::nbuckets, and NULL.

Referenced by applyModifier(), BKE_mesh_calc_edges(), CDDM_calc_edges(), cutEdges(), dm_calc_normal(), EM_make_hq_normals(), and explodeMesh().

void BLI_edgehashIterator_setValue ( EdgeHashIterator ehi,
void *  val 
)

Definition at line 234 of file edgehash.c.

References EdgeHashIterator::curEntry, EdgeEntry::val, and simple_enum_gen::val.

Referenced by cutEdges(), and explodeMesh().

void BLI_edgehashIterator_step ( EdgeHashIterator ehi)

Variable Documentation

unsigned int _ehash_hashsizes[] [static]
Initial value:
 {
    1, 3, 5, 11, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209,
    16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169,
    4194319, 8388617, 16777259, 33554467, 67108879, 134217757,
    268435459
}

Definition at line 44 of file edgehash.c.

Referenced by BLI_edgehash_insert(), and BLI_edgehash_new().