Scotch Brand 5.1.10 User Manual

Page 131

Advertising
background image

1. Write the code of the method itself. First, choose a free two-letter code to

describe your method, say “xy”. In the libscotch source directory, create
files vgraph separate xy.c and vgraph separate xy.h, basing on existing
files such as vgraph separate gg.c and vgraph separate gg.h, for instance.

If the method is complex, it can be split across several other files, which will
be named vgraph separate xy firstmodulename.c, vgraph separate xy
secondmodulename.c

, eventually with matching header files.

If the method has parameters, create a structure called VgraphSeparateXy
Param

, which contains fields of types that can be handled by the strategy

parser, such as the INT generic integer type (see below), or double, for in-
stance.

The execution of your method should result in the setting or in the updating
of the Vgraph structure that is passed to it. See its definition in vgraph.h
and read several simple graph separation methods, such as vgraph separate
zr.c

, to figure out what all of its parameters mean.

At the end of your method, always call, when the SCOTCH DEBUG VGRAPH2
debug flag is set, the vgraphCheck routine, to avoid the spreading of eventual
bugs to other parts of the libScotch library.

2. Add the method to the parser tables.

The files to update are vgraph

separate st.c

and vgraph separate st.h, where “st” stands for “strat-

egy”.

First, edit vgraph separate st.h. In the VgraphSeparateStMethodType
enumeration, add a line for your new method VGRAPHSEPASTMETHXY. Then,
edit vgraph separate st.c, where all of the remaining actions take place.

In the top of the file, add a #include directive to include vgraph separate
xy.h

.

If the method has parameters, create a vgraphseparatedefaultxy C union,
basing on an existing one, and fill it with the default values of your method
parameters.

In the vgraphseparatestmethtab method array, add a line for the new
method. To do so, choose a free single-letter code that will be used to desig-
nate the new method in strategy strings. If the method has parameters, the
last field should be a pointer to the default structure, else it should be set to
NULL

.

If the method has parameters, update the vgraphseparatestparatab pa-
rameter array. Add one data block per parameter. The first field is the name
of the method to which the parameter applies, that is, VGRAPHSEPASTMETH
XY

. The second field is the type of the parameter, which can be:

• STRATPARAMCASE: the support type is an int. It receives the index in the

case string, which is provided as the last field of the parameter line, of
the given case character;

• STRATPARAMDOUBLE: the support type is a double;

• STRATPARAMINT: the support type is an INT, which is the generic inte-

ger type handled internally by Scotch. This type has variable extent,
depending on compilation flags, as described in Section 7.1.4;

• STRATPARAMSTRING: a (small) character string;

131

Advertising