~chaffra/+junk/trilinos

« back to all changes in this revision

Viewing changes to packages/zoltan/src/util/converters_for_JPDC_adaptive_mesh_experiments/exo2chaco/chaco/klspiff/make_bndy_list.c

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme, Christophe Prud'homme, Johannes Ring
  • Date: 2009-12-13 12:53:22 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091213125322-in0nrdjc55deqsw9
Tags: 10.0.3.dfsg-1
[Christophe Prud'homme]
* New upstream release

[Johannes Ring]
* debian/patches/libname.patch: Add prefix 'libtrilinos_' to all
  libraries. 
* debian/patches/soname.patch: Add soversion to libraries.
* debian/watch: Update download URL.
* debian/control:
  - Remove python-numeric from Build-Depends (virtual package).
  - Remove automake and autotools from Build-Depends and add cmake to
    reflect switch to CMake.
  - Add python-support to Build-Depends.
* debian/rules: 
  - Cleanup and updates for switch to CMake.

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        "structs.h"
 
7
#include        "defs.h"
 
8
#include "smalloc.h"
 
9
 
 
10
 
 
11
void      make_bndy_list(graph, movelist, buckets, listspace, sets, nsets, bspace,
 
12
                         tops, bndy_list)
 
13
struct vtx_data **graph;        /* data structure for graph */
 
14
struct bilist *movelist;        /* list of vtxs to be moved */
 
15
struct bilist ****buckets;      /* array of lists for bucket sort */
 
16
struct bilist **listspace;      /* list data structure for each vertex */
 
17
short    *sets;                 /* processor each vertex is assigned to */
 
18
int       nsets;                /* number of sets divided into */
 
19
int      *bspace;               /* list of active vertices for bucketsort */
 
20
int     **tops;                 /* top of each set of buckets */
 
21
int     **bndy_list;            /* list of boundary vertices returned */
 
22
{
 
23
    struct bilist *bptr;        /* loops through bspace */
 
24
    int       vtx;              /* vertex that was moved */
 
25
    int       set;              /* set a vertex is in */
 
26
    int       list_length;      /* number of active vertices */
 
27
    int       bndy_length;      /* number of vertices actually on boundary */
 
28
    int       size;             /* array spacing */
 
29
    int       i, j, k;          /* loop counters */
 
30
 
 
31
    /* First push all the moved vertices onto list, so they can be flagged. */
 
32
    /* They've already been removed from buckets, so want to avoid them. */
 
33
    size = (int) (&(listspace[0][1]) - &(listspace[0][0]));
 
34
    bptr = movelist;
 
35
    list_length = 0;
 
36
    while (bptr != NULL) {
 
37
        vtx = ((int) (bptr - listspace[0])) / size;
 
38
        bspace[list_length++] = vtx;
 
39
        bptr = bptr->next;
 
40
    }
 
41
 
 
42
    /* Now get all the vertices still in the bucket lists. */
 
43
    for (k=tops[0][1]; k >= 0; k--) {
 
44
        bptr = buckets[0][1][k];
 
45
        while (bptr != NULL) {
 
46
            vtx = ((int) (bptr - listspace[0])) / size;
 
47
            bspace[list_length++] = vtx;
 
48
            bptr = bptr->next;
 
49
        }
 
50
    }
 
51
 
 
52
    for (i=1; i<nsets; i++) {
 
53
        for (k=tops[i][0]; k >= 0; k--) {
 
54
            bptr = buckets[i][0][k];
 
55
            while (bptr != NULL) {
 
56
                vtx = ((int) (bptr - listspace[0])) / size;
 
57
                bspace[list_length++] = vtx;
 
58
                bptr = bptr->next;
 
59
            }
 
60
        }
 
61
    }
 
62
 
 
63
 
 
64
    /* Now that list is constructed, go reconstruct all the set numbers. */
 
65
    bndy_length = 0;
 
66
    for (i = 0; i< list_length; i++) {
 
67
        vtx = bspace[i];
 
68
        set = sets[vtx];
 
69
        for (j=1; j<graph[vtx]->nedges; j++) {
 
70
            if (sets[graph[vtx]->edges[j]] != set) {
 
71
                bspace[bndy_length++] = vtx;
 
72
                break;
 
73
                
 
74
            }
 
75
        }
 
76
    }
 
77
 
 
78
    /* Finally, copy boundary vertices into boundary list. */
 
79
    *bndy_list = smalloc((bndy_length + 1) * sizeof(int));
 
80
    for (i=0; i<bndy_length; i++) {
 
81
        (*bndy_list)[i] = bspace[i];
 
82
    }
 
83
    (*bndy_list)[bndy_length] = 0;
 
84
}