easyblock = 'MakeCp'

name = 'ParMGridGen'
version = '1.0'

homepage = 'http://www-users.cs.umn.edu/~moulitsa/software.html'
description = """ParMGridGen is an MPI-based parallel library that is based on the serial package MGridGen,
 that implements (serial) algorithms for obtaining a sequence of successive coarse grids that are well-suited
 for geometric multigrid methods."""

toolchain = {'name': 'ictce', 'version': '4.1.13'}
toolchainopts = {'usempi': True, 'pic': True}

source_urls = ['http://www-users.cs.umn.edu/~moulitsa/download/']
sources = [SOURCE_TAR_GZ]

patches = ['ParMGridGen-1.0_malloc_include.patch']

buildopts = 'parallel CC="$CC" PARCC="$CC" PARLD="$CC" COPTIONS="$CFLAGS" LDOPTIONS="$CFLAGS" BINDIR="."'

files_to_copy = [
    (['MGridGen/Programs/mgridgen', 'ParMGridGen/Programs/parmgridgen'], 'bin'),
    (['mgridgen.h', 'parmgridgen.h'], 'include'),
    (['libmgrid.a', 'libparmgrid.a'], 'lib'),
]

moduleclass = 'math'
