1
/* Copyright 2004,2007 ENSEIRB, INRIA & CNRS
3
** This file is part of the Scotch software package for static mapping,
4
** graph partitioning and sparse matrix ordering.
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".
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
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.
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.
32
/************************************************************/
34
/** NAME : vmesh_separate_fm.h **/
36
/** AUTHOR : Francois PELLEGRINI **/
38
/** FUNCTION : These lines are the data declarations **/
39
/** for the improved Fiduccia-Mattheyses **/
40
/** mesh element separation routine. **/
42
/** DATES : # Version 4.0 : from : 26 feb 2003 **/
43
/** to 06 may 2004 **/
45
/************************************************************/
51
/*+ Gain table subbits. +*/
53
#define VMESHSEPAFMGAINBITS 4
55
/*+ Prime number for hashing vertex numbers. +*/
57
#define VMESHSEPAFMHASHPRIME 11 /*+ Prime number for hashing +*/
59
/*+ Gain table vertex status. +*/
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 +*/
66
** The type and structure definitions.
69
/*+ This structure holds the method parameters. +*/
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;
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
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;
94
/*+ The hash node structure. +*/
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;
104
/*+ The move recording structure. +*/
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 +*/
115
struct { /*+ Recovery data for node +*/
116
int vertpart; /*+ Vertex part +*/
117
Gnum ecmpsize0; /*+ Number of element neighbors in part 0 +*/
120
} VmeshSeparateFmSave;
123
** The function prototypes.
126
#ifndef VMESH_SEPARATE_FM
130
int vmeshSeparateFm (Vmesh * restrict const, const VmeshSeparateFmParam * restrict const);
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 */