Changeset 2806


Ignore:
Timestamp:
May 5, 2006, 4:27:36 PM (17 years ago)
Author:
jack
Message:

Update to use long as the index type. Needs verification on 32-bit
machines.

Location:
inundation/pymetis
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • inundation/pymetis/Makefile

    r2115 r2806  
    1515pymetis: metis pymetis_module
    1616
    17 metis:
     17metis: patched
    1818        make -C $(METIS_DIR)
    1919
     
    2323for_win32: metis_win32 pymetis_module_win32
    2424
    25 metis_win32:
     25metis_win32: patched
    2626        make -C win32 METIS_DIR=$(METIS_DIR)
    2727########make -C $(METIS_DIR)/Lib is implied by make -C win32
     
    3333
    3434###
     35# Patch the metis sources to use long as the idxtype
     36# (for x86_64 mainly, but this allows a drop-in of the metis dir.)
     37#
     38patched:
     39        patch -p0<long_idxtype.patch
     40        touch patched
     41
     42###
    3543# Clean
    3644#
    37 
    3845clean:
    3946        make -C $(METIS_DIR) clean
     
    4754        -rm -f metis.so
    4855        -rm -f metis.pyd
     56        patch -p0 -R<long_idxtype.patch
     57        -rm -f patched
  • inundation/pymetis/README

    r2513 r2806  
    1010Should the metis version change, the new metis package should be in a new
    1111subdirectory. Metis 4.0 is in metis-4.0
     12
     13The build scripts patch the metis sources to use longs instead of ints for the
     14index type. If a future metis version does not require manually patching,
     15either edit the makefile or create an empty file with the name `patched' in
     16the top pymetis directory.
    1217
    1318The METIS_DIR= line in the makefile will need to be changed appropriately.
  • inundation/pymetis/metis-4.0/Lib/struct.h

    r2051 r2806  
    1212 */
    1313
    14 /* Undefine the following #define in order to use short int as the idxtype */
    15 #define IDXTYPE_INT
    16 
    17 /* Indexes are as long as integers for now */
    18 #ifdef IDXTYPE_INT
    19 typedef int idxtype;
    20 #else
    21 typedef short idxtype;
    22 #endif
     14typedef long idxtype;
    2315
    2416#define MAXIDX  (1<<8*sizeof(idxtype)-2)
  • inundation/pymetis/pymetis/metis.c

    r2071 r2806  
    33
    44/* This must be the same as the metis idxtype */
    5 typedef int idxtype;
     5typedef long idxtype;
    66
    77#include "bridge.h"
     
    6161    return NULL;
    6262
    63   elem_arr = (PyArrayObject *) PyArray_ContiguousFromObject(elements, PyArray_INT, 1, 1);
     63  elem_arr = (PyArrayObject *) PyArray_ContiguousFromObject(elements, PyArray_LONG, 1, 1);
    6464
    6565  if(!elem_arr)
  • inundation/pymetis/test_metis.py

    r2115 r2806  
    3838        #print epart
    3939        #print npart
     40        epart_expected = array([2, 0, 2, 0, 0, 0], 'i')
     41        npart_expected = array([0, 0, 2, 0, 2, 0, 2], 'i')
    4042        self.assert_(edgecut == 5)
    41         self.assert_(epart   == array([2, 2, 0, 0, 0, 0], 'i'))
    42         self.assert_(npart   == array([0, 2, 2, 2, 0, 0, 0], 'i'))
     43        for i in range(len(epart)):
     44            self.assert_(epart[i] == epart_expected[i])
     45        for i in range(len(npart)):
     46            self.assert_(npart[i] == npart_expected[i])
    4347
    4448if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.