~ubuntu-branches/debian/squeeze/gmsh/squeeze

« back to all changes in this revision

Viewing changes to contrib/Chaco/klvspiff/clear_dvals.c

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2009-01-07 16:02:08 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090107160208-vklhtj69br5yw5bh
Tags: 2.2.6.dfsg-2
* debian/control: fixed lintian warning "debhelper-but-no-misc-depends"
* debian/watch: fixed lintian warning
  "debian-watch-file-should-mangle-version"

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This software was developed by Bruce Hendrickson and Robert Leland   *
 
2
 * at Sandia National Laboratories under US Department of Energy        *
 
3
 * contract DE-AC04-76DP00789 and is copyrighted by Sandia Corporation. */
 
4
 
 
5
#include        <stdio.h>
 
6
#include        <math.h>
 
7
#include        "structs.h"
 
8
#include        "defs.h"
 
9
 
 
10
 
 
11
void      clear_dvals(graph, nvtxs, ldvals, rdvals, bspace, list_length)
 
12
struct vtx_data **graph;        /* data structure for graph */
 
13
int       nvtxs;                /* number of vtxs in graph */
 
14
int      *ldvals;               /* d-values for each transition */
 
15
int      *rdvals;               /* d-values for each transition */
 
16
int      *bspace;               /* list of activated vertices */
 
17
int       list_length;          /* number of activated vertices */
 
18
{
 
19
    int      *edges;            /* loops through edge list */
 
20
    int       vtx;              /* vertex in bspace */
 
21
    int       neighbor;         /* neighbor of vtx */
 
22
    int       i, j;             /* loop counters */
 
23
 
 
24
    if (list_length > .05 * nvtxs) {    /* Do it directly. */
 
25
        for (i = 1; i <= nvtxs; i++) {
 
26
            ldvals[i] = rdvals[i] = 0;
 
27
        }
 
28
    }
 
29
    else {                      /* Do it more carefully */
 
30
        for (i = 0; i < list_length; i++) {
 
31
            vtx = bspace[i];
 
32
            if (vtx < 0)
 
33
                vtx = -vtx;
 
34
            ldvals[vtx] = rdvals[vtx] = 0;
 
35
            edges = graph[vtx]->edges;
 
36
            for (j = graph[vtx]->nedges - 1; j; j--) {
 
37
                neighbor = *(++edges);
 
38
                ldvals[neighbor] = rdvals[neighbor] = 0;
 
39
            }
 
40
        }
 
41
    }
 
42
}