Based on the metismex.c code by Robert Bridson and using pieces of the meshpart toolkit by John Gilbert and Shanghua Teng.
This code has been modified to work with the latest version of Metis (5.0.2 as if 2012-05-22). All functions except for one (NodeBisect) currently work.
The following instructions worked on Ubuntu Linux (10.10) and OSX 10.7.
-
Download and extract the 5.0.2 version of metis.
wget http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.0.2.tar.gz tar xzvf metis-5.0.2.tar.gz cd metis-5.0.2/
-
Configure metis for 64-bit integers. This step is only required for 64-bit versions of Matlab. We need to edit
include/metis.h
and change#define IDXTYPEWIDTH 32
to#define IDXTYPEWIDTH 64
. On my system, this change was to line 33. -
Make sure you have a working version of
cmake
installed. On OSX 10.7, I used the homebrew port.brew install cmake
-
Compile metis.
make config make all
-
Download and compile metismex. It is critical that this is in a subdirectory of metis otherwise the relative paths won't work.
# in the metis-5.0.2 directory git clone git://github.com/dgleich/metismex.git cd metismex matlab -nodisplay >> make
-
Check that it works
>> A = blkdiag(ones(5),ones(5)); A(1,10) = 1; A(10,1) = 1; A(5,6) = 1; A(6,5) = 1; >> [p1,p2] = metispart(sparse(A)) p1 = 1 2 3 4 5 p2 = 6 7 8 9 10