summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/ppopen-math-mp/package.py
blob: 55ca6600cd75b5957e9542cac29da4842a733fe4 (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
# Copyright 2013-2022 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 PpopenMathMp(MakefilePackage):
    """
    ppOpen-Math/MP ia a coupling library that enables weak coupling on various
    simulation models, such as an atmospheric model and an ocean model,
    a seismic model and a structure model. For getting very wide applicability,
    ppOpen-Math/MP is designed so as that it is independent from grid
    structure.  Instead of grid structure, PpohMATHMP requires a data set
    called 'mapping table'. Mapping table is composed of a correspondence
    table of grid indexes between a send model and a receive model and
    interpolation coefficients. A subroutine for making a mapping table
    file is provided by ppOpen-Math/MP API.

    Current version of ppOpen-Math/MP is ver.1.0 which targets scalar
    data exchange.  An exchange code of vector data which requires rotation
    calculation is under development and will be released the next version.
    """

    homepage = "http://ppopenhpc.cc.u-tokyo.ac.jp/ppopenhpc/"
    git = "https://github.com/Post-Peta-Crest/ppOpenHPC.git"

    version('master', branch='MATH/MP')

    depends_on('mpi')

    build_directory = 'src'
    build_targets = ['FC_XXX=spack']
    parallel = False

    def edit(self, spec, prefix):
        flags = ['-I.']
        if spec.satisfies('%gcc'):
            flags.append('-ffree-line-length-none')
        with open('src/Makefile', 'a') as makefile:
            makefile.write('FC_spack = {0}\n'.format(spec['mpi'].mpifc))
            makefile.write('FFLAGS_spack = {0}\n'.format(' '.join(flags)))
            makefile.write('AR_spack = ar cr\n')
        mkdirp('include')
        mkdirp('lib')

    def install(self, spec, prefix):
        for d in ['include', 'lib', 'doc', 'test']:
            mkdir(join_path(prefix, d))
            copy_tree(d, join_path(prefix, d))