summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/netgen/package.py
blob: c67ed8cced25e90816f939336e8588adc08b7976 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *


class Netgen(AutotoolsPackage):
    """NETGEN is an automatic 3d tetrahedral mesh generator. It accepts
       input from constructive solid geometry (CSG) or boundary
       representation (BRep) from STL file format. The connection to
       a geometry kernel allows the handling of IGES and STEP files.
       NETGEN contains modules for mesh optimization and hierarchical
       mesh refinement. """

    homepage = "https://ngsolve.org/"
    url = "https://gigenet.dl.sourceforge.net/project/netgen-mesher/netgen-mesher/5.3/netgen-5.3.1.tar.gz"

    version('5.3.1', 'afd5a9b0b1296c242a9c554f06af6510')

    variant("mpi", default=True, description='enable mpi support')
    variant("oce", default=False, description='enable oce geometry kernel')
    variant("gui", default=False, description='enable gui')
    variant("metis", default=False, description='use metis for partitioning')

    depends_on('zlib')
    depends_on('mpi', when='+mpi')
    depends_on('oce+X11', when='+oce')
    depends_on('metis', when='+metis')

    def url_for_version(self, version):
        url = "http://gigenet.dl.sourceforge.net/project/netgen-mesher/netgen-mesher/{0}/netgen-{1}.tar.gz"
        return url.format(version.up_to(2), version)

    def configure_args(self):
        spec = self.spec
        args = []
        if '+mpi' in spec:
            args.extend([
                "CC={0}".format(spec['mpi'].mpicc),
                "CXX={0}".format(spec['mpi'].mpicxx)
            ])
        else:
            args.append("--without-mpi")

        if '+oce' in spec:
            args.append("--with-occ={0}".format(spec['oce'].prefix))
        #  FIXME
        # due to a bug in netgen config, when --without-occ is specified
        #   or --with-occ=no, OCC flags is turned true, and build fails
        #   later; so do not specify anything like that
        # else:
        #    args.append("--without-occ")

        if '~gui' in spec:
            args.append("--disable-gui")
        else:
            args.append("--enable-gui")
        if '+metis' in spec:
            args.append('--with-metis=%s' % spec['metis'].prefix)
        else:
            args.append("--without-metis")

        return args