Back to index

wims  3.65+svn20090927
Functions | Variables
edgelist.c File Reference
#include "vdefs.h"

Go to the source code of this file.

Functions

void ELinitialize (void)
HalfedgeHEcreate (Edge *e, int pm)
void ELinsert (Halfedge *lb, Halfedge *new)
HalfedgeELgethash (int b)
HalfedgeELleftbnd (Point *p)
void ELdelete (Halfedge *he)
HalfedgeELright (Halfedge *he)
HalfedgeELleft (Halfedge *he)
Siteleftreg (Halfedge *he)
Siterightreg (Halfedge *he)

Variables

int ELhashsize
Sitebottomsite
Freelist hfl
HalfedgeELleftend
HalfedgeELrightend
Halfedge ** ELhash
int ntry
int totalsearch

Function Documentation

void ELdelete ( Halfedge he)

Definition at line 148 of file edgelist.c.

    {
    (he->ELleft)->ELright = he->ELright ;
    (he->ELright)->ELleft = he->ELleft ;
    he->ELedge = (Edge *)DELETED ;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Halfedge* ELgethash ( int  b)

Definition at line 61 of file edgelist.c.

    {
    Halfedge * he ;

    if ((b < 0) || (b >= ELhashsize))
        {
        return ((Halfedge *)NULL) ;
        }
    he = ELhash[b] ;
    if ((he == (Halfedge *)NULL) || (he->ELedge != (Edge *)DELETED))
        {
        return (he) ;
        }
    /* Hash table points to deleted half edge.  Patch as necessary. */
    ELhash[b] = (Halfedge *)NULL ;
    if ((--(he->ELrefcnt)) == 0)
        {
        makefree((Freenode *)he, (Freelist *)&hfl) ;
        }
    return ((Halfedge *)NULL) ;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void ELinitialize ( void  )

Definition at line 14 of file edgelist.c.

    {
    int i ;

    freeinit(&hfl, sizeof(Halfedge)) ;
    ELhashsize = 2 * sqrt_nsites ;
    ELhash = (Halfedge **)myalloc( sizeof(*ELhash) * ELhashsize) ;
    for (i = 0  ; i < ELhashsize  ; i++)
        {
        ELhash[i] = (Halfedge *)NULL ;
        }
    ELleftend = HEcreate((Edge *)NULL, 0) ;
    ELrightend = HEcreate((Edge *)NULL, 0) ;
    ELleftend->ELleft = (Halfedge *)NULL ;
    ELleftend->ELright = ELrightend ;
    ELrightend->ELleft = ELleftend ;
    ELrightend->ELright = (Halfedge *)NULL ;
    ELhash[0] = ELleftend ;
    ELhash[ELhashsize-1] = ELrightend ;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void ELinsert ( Halfedge lb,
Halfedge new 
)

Definition at line 50 of file edgelist.c.

    {
    new->ELleft = lb ;
    new->ELright = lb->ELright ;
    (lb->ELright)->ELleft = new ;
    lb->ELright = new ;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Halfedge* ELleft ( Halfedge he)

Definition at line 162 of file edgelist.c.

    {
    return (he->ELleft) ;
    }

Here is the caller graph for this function:

Definition at line 84 of file edgelist.c.

    {
    int i, bucket ;
    Halfedge * he ;

    /* Use hash table to get close to desired halfedge */
    bucket = (p->x - xmin) / deltax * ELhashsize ;
    if (bucket < 0)
        {
        bucket = 0 ;
        }
    if (bucket >= ELhashsize)
        {
        bucket = ELhashsize - 1 ;
        }
    he = ELgethash(bucket) ;
    if  (he == (Halfedge *)NULL)
        {
        for (i = 1 ; 1 ; i++)
            {
            if ((he = ELgethash(bucket-i)) != (Halfedge *)NULL)
                {
                break ;
                }
            if ((he = ELgethash(bucket+i)) != (Halfedge *)NULL)
                {
                break ;
                }
            }
        totalsearch += i ;
        }
    ntry++ ;
    /* Now search linear list of halfedges for the corect one */
    if (he == ELleftend || (he != ELrightend && right_of(he,p)))
        {
        do  {
            he = he->ELright ;
            } while (he != ELrightend && right_of(he,p)) ;
        he = he->ELleft ;
        }
    else
        {
        do  {
            he = he->ELleft ;
            } while (he != ELleftend && !right_of(he,p)) ;
        }
    /*** Update hash table and reference counts ***/
    if ((bucket > 0) && (bucket < ELhashsize-1))
        {
        if (ELhash[bucket] != (Halfedge *)NULL)
            {
            (ELhash[bucket]->ELrefcnt)-- ;
            }
        ELhash[bucket] = he ;
        (ELhash[bucket]->ELrefcnt)++ ;
        }
    return (he) ;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 156 of file edgelist.c.

    {
    return (he->ELright) ;
    }

Here is the caller graph for this function:

Halfedge* HEcreate ( Edge e,
int  pm 
)

Definition at line 36 of file edgelist.c.

    {
    Halfedge * answer ;

    answer = (Halfedge *)getfree(&hfl) ;
    answer->ELedge = e ;
    answer->ELpm = pm ;
    answer->PQnext = (Halfedge *)NULL ;
    answer->vertex = (Site *)NULL ;
    answer->ELrefcnt = 0 ;
    return (answer) ;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Site* leftreg ( Halfedge he)

Definition at line 168 of file edgelist.c.

    {
    if (he->ELedge == (Edge *)NULL)
        {
        return(bottomsite) ;
        }
    return (he->ELpm == le ? he->ELedge->reg[le] :
        he->ELedge->reg[re]) ;
    }

Here is the caller graph for this function:

Site* rightreg ( Halfedge he)

Definition at line 179 of file edgelist.c.

    {
    if (he->ELedge == (Edge *)NULL)
        {
        return(bottomsite) ;
        }
    return (he->ELpm == le ? he->ELedge->reg[re] :
        he->ELedge->reg[le]) ;
    }

Here is the caller graph for this function:


Variable Documentation

Definition at line 7 of file edgelist.c.

Definition at line 9 of file edgelist.c.

Definition at line 6 of file edgelist.c.

Definition at line 9 of file edgelist.c.

Definition at line 9 of file edgelist.c.

Definition at line 8 of file edgelist.c.

int ntry

Definition at line 11 of file edgelist.c.

Definition at line 11 of file edgelist.c.