~ubuntu-branches/ubuntu/trusty/scotch/trusty

« back to all changes in this revision

Viewing changes to src/libscotch/vmesh_separate_fm.h

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2008-01-25 09:13:53 UTC
  • Revision ID: james.westby@ubuntu.com-20080125091353-zghdao60dfsyc2bt
Tags: upstream-5.0.1.dfsg
ImportĀ upstreamĀ versionĀ 5.0.1.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2004,2007 ENSEIRB, INRIA & CNRS
 
2
**
 
3
** This file is part of the Scotch software package for static mapping,
 
4
** graph partitioning and sparse matrix ordering.
 
5
**
 
6
** This software is governed by the CeCILL-C license under French law
 
7
** and abiding by the rules of distribution of free software. You can
 
8
** use, modify and/or redistribute the software under the terms of the
 
9
** CeCILL-C license as circulated by CEA, CNRS and INRIA at the following
 
10
** URL: "http://www.cecill.info".
 
11
** 
 
12
** As a counterpart to the access to the source code and rights to copy,
 
13
** modify and redistribute granted by the license, users are provided
 
14
** only with a limited warranty and the software's author, the holder of
 
15
** the economic rights, and the successive licensors have only limited
 
16
** liability.
 
17
** 
 
18
** In this respect, the user's attention is drawn to the risks associated
 
19
** with loading, using, modifying and/or developing or reproducing the
 
20
** software by the user in light of its specific status of free software,
 
21
** that may mean that it is complicated to manipulate, and that also
 
22
** therefore means that it is reserved for developers and experienced
 
23
** professionals having in-depth computer knowledge. Users are therefore
 
24
** encouraged to load and test the software's suitability as regards
 
25
** their requirements in conditions enabling the security of their
 
26
** systems and/or data to be ensured and, more generally, to use and
 
27
** operate it in the same conditions as regards security.
 
28
** 
 
29
** The fact that you are presently reading this means that you have had
 
30
** knowledge of the CeCILL-C license and that you accept its terms.
 
31
*/
 
32
/************************************************************/
 
33
/**                                                        **/
 
34
/**   NAME       : vmesh_separate_fm.h                     **/
 
35
/**                                                        **/
 
36
/**   AUTHOR     : Francois PELLEGRINI                     **/
 
37
/**                                                        **/
 
38
/**   FUNCTION   : These lines are the data declarations   **/
 
39
/**                for the improved Fiduccia-Mattheyses    **/
 
40
/**                mesh element separation routine.        **/
 
41
/**                                                        **/
 
42
/**   DATES      : # Version 4.0  : from : 26 feb 2003     **/
 
43
/**                                 to     06 may 2004     **/
 
44
/**                                                        **/
 
45
/************************************************************/
 
46
 
 
47
/*
 
48
**  The defines.
 
49
*/
 
50
 
 
51
/*+ Gain table subbits. +*/
 
52
 
 
53
#define VMESHSEPAFMGAINBITS         4
 
54
 
 
55
/*+ Prime number for hashing vertex numbers. +*/
 
56
 
 
57
#define VMESHSEPAFMHASHPRIME        11            /*+ Prime number for hashing +*/
 
58
 
 
59
/*+ Gain table vertex status. +*/
 
60
 
 
61
#define VMESHSEPAFMSTATEFREE        ((GainLink *) 0) /*+ Element is free or separator-chained +*/
 
62
#define VMESHSEPAFMSTATEUSED        ((GainLink *) 1) /*+ Element already swapped              +*/
 
63
#define VMESHSEPAFMSTATELINK        ((GainLink *) 2) /*+ Currently in gain table if higher    +*/
 
64
 
 
65
/*
 
66
**  The type and structure definitions.
 
67
*/
 
68
 
 
69
/*+ This structure holds the method parameters. +*/
 
70
 
 
71
typedef struct VmeshSeparateFmParam_ {
 
72
  INT                       movenbr;              /*+ Maximum number of uneffective moves that can be done +*/
 
73
  INT                       passnbr;              /*+ Number of passes to be performed (-1 : infinite)     +*/
 
74
  double                    deltrat;              /*+ Maximum weight imbalance ratio                       +*/
 
75
} VmeshSeparateFmParam;
 
76
 
 
77
/*+ The hash element structure. The goal
 
78
    of both hash arrays is to record partition
 
79
    data that supercedes the one contained in
 
80
    the calling Vmesh structure, until the newly
 
81
    computed partition is written back to the
 
82
    Vmesh.                                       +*/
 
83
 
 
84
typedef struct VmeshSeparateFmElement_ {
 
85
  GainLink                  gainlink;             /*+ Gain link if moved to other part; FIRST +*/
 
86
  Gnum                      velmnum;              /*+ Number of vertex in hash table          +*/
 
87
  int                       vertpart;             /*+ Vertex part                             +*/
 
88
  Gnum                      ncmpcut2;             /*+ Number of neighbor nodes in separator   +*/
 
89
  Gnum                      ncmpgain2;            /*+ Separator gain if moved to given part   +*/
 
90
  Gnum                      ncmpgaindlt;          /*+ Node load imbalance if element swapped  +*/
 
91
  Gnum                      mswpnum;              /*+ Number of move sweep when data recorded +*/
 
92
} VmeshSeparateFmElement;
 
93
 
 
94
/*+ The hash node structure. +*/
 
95
 
 
96
typedef struct VmeshSeparateFmNode_ {
 
97
  Gnum                      vnodnum;              /*+ Number of vertex in hash table          +*/
 
98
  Gnum                      vnloval;              /*+ Vertex load                             +*/
 
99
  int                       vertpart;             /*+ Vertex part                             +*/
 
100
  Gnum                      ecmpsize0;            /*+ Number of element neighbors in part 0   +*/
 
101
  Gnum                      mswpnum;              /*+ Number of move sweep when data recorded +*/
 
102
} VmeshSeparateFmNode;
 
103
 
 
104
/*+ The move recording structure. +*/
 
105
 
 
106
typedef struct VmeshSeparateFmSave_ {
 
107
  Gnum                      hertnum;              /*+ Hash index of vertex, (helmnum) or (-1 - hnodnum) +*/
 
108
  union {                                         /*+ Stored data to recover                            +*/
 
109
    struct {                                      /*+ Recovery data for element                         +*/
 
110
      int                   vertpart;             /*+ Vertex part                                       +*/
 
111
      Gnum                  ncmpcut2;             /*+ Number of neighbor nodes in separator             +*/
 
112
      Gnum                  ncmpgain2;            /*+ Separator gain if moved to given part             +*/
 
113
      Gnum                  ncmpgaindlt;          /*+ Node load imbalance if element swapped            +*/
 
114
    } elem;
 
115
    struct {                                      /*+ Recovery data for node                            +*/
 
116
      int                   vertpart;             /*+ Vertex part                                       +*/
 
117
      Gnum                  ecmpsize0;            /*+ Number of element neighbors in part 0             +*/
 
118
    } node;
 
119
  } data;
 
120
} VmeshSeparateFmSave;
 
121
 
 
122
/*
 
123
**  The function prototypes.
 
124
*/
 
125
 
 
126
#ifndef VMESH_SEPARATE_FM
 
127
#define static
 
128
#endif
 
129
 
 
130
int                         vmeshSeparateFm     (Vmesh * restrict const, const VmeshSeparateFmParam * restrict const);
 
131
 
 
132
static VmeshSeparateFmElement * vmeshSeparateFmTablGet (GainTabl * const, const Gnum, const Gnum);
 
133
static int                  vmeshSeparateFmResize (GainTabl * restrict const, VmeshSeparateFmElement * restrict * const, VmeshSeparateFmNode * restrict * const, VmeshSeparateFmSave * restrict * const, const Gnum, VmeshSeparateFmElement **, VmeshSeparateFmElement **, const Gnum);
 
134
#ifdef SCOTCH_DEBUG_VMESH3
 
135
static int                  vmeshSeparateFmCheck (const Vmesh * const, const VmeshSeparateFmElement * restrict, const VmeshSeparateFmNode * restrict, const Gnum, const Gnum, const Gnum);
 
136
#endif /* SCOTCH_DEBUG_VMESH3 */
 
137
 
 
138
#undef static