summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/netgen/package.py
blob: 1c890ef079067fc183bfc4c6a67fba2ac92547ee (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
# Copyright 2013-2023 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.package 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://sourceforge.net/projects/netgen-mesher/files/netgen-mesher/5.3/netgen-5.3.1.tar.gz"

    version("5.3.1", sha256="cb97f79d8f4d55c00506ab334867285cde10873c8a8dc783522b47d2bc128bf9")

    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-api")
    depends_on("mpi", when="+mpi")
    depends_on("oce+X11", when="+oce")
    depends_on("metis", when="+metis")

    def url_for_version(self, version):
        url = "https://sourceforge.net/projects/netgen-mesher/files/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