diff options
3 files changed, 195 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/ffr/gfortran_format_30.patch b/var/spack/repos/builtin/packages/ffr/gfortran_format_30.patch new file mode 100755 index 0000000000..1669ca5550 --- /dev/null +++ b/var/spack/repos/builtin/packages/ffr/gfortran_format_30.patch @@ -0,0 +1,30 @@ +diff -ru ffr.old/FFR2VIZ/src/tovtk.f ffr.new/FFR_V3.1.004/FFR2VIZ/src/tovtk.f +--- ffr.old/FFR2VIZ/src/tovtk.f 2009-05-27 10:57:50.000000000 +0900 ++++ ffr.new/FFR2VIZ/src/tovtk.f 2020-04-07 18:55:05.000000000 +0900 +@@ -190,7 +190,7 @@ + + character(len=*), parameter :: FNAME = "write_vtk_points: " + c character(len=*), parameter ::fmt_data = "(3E)" +- character(len=*), parameter ::fmt_data = "(9E)" ++ character(len=*), parameter ::fmt_data = "(9E15.7)" + integer :: ii + + write(*, *)'dbg> ', FNAME, ' writing...' +@@ -491,7 +491,7 @@ + + character(len=*), parameter :: FNAME = "write_vtk_scalar: " + c character(len=*), parameter ::fmt_data = "(E)" +- character(len=*), parameter ::fmt_data = "(9E)" ++ character(len=*), parameter ::fmt_data = "(9E15.7)" + integer :: ii + + write(*, *)'dbg> ', FNAME, ' writing...', trim(byname) +@@ -541,7 +541,7 @@ + + character(len=*), parameter :: FNAME = "write_vtk_vector: " + c character(len=*), parameter ::fmt_data = "(3E)" +- character(len=*), parameter ::fmt_data = "(9E)" ++ character(len=*), parameter ::fmt_data = "(9E15.7)" + integer :: ii + + write(*, *)'dbg> ', FNAME, ' writing...', trim(byname) diff --git a/var/spack/repos/builtin/packages/ffr/gfortran_format_31.patch b/var/spack/repos/builtin/packages/ffr/gfortran_format_31.patch new file mode 100755 index 0000000000..8ebd66c72c --- /dev/null +++ b/var/spack/repos/builtin/packages/ffr/gfortran_format_31.patch @@ -0,0 +1,42 @@ +diff -ru ffr.old/FFR_V3.1.004/FFR2VIZ/src/tovtk.f ffr.new/FFR_V3.1.004/FFR2VIZ/src/tovtk.f +--- ffr.old/FFR_V3.1.004/FFR2VIZ/src/tovtk.f 2009-05-27 10:57:50.000000000 +0900 ++++ ffr.new/FFR_V3.1.004/FFR2VIZ/src/tovtk.f 2020-04-07 18:55:05.000000000 +0900 +@@ -190,7 +190,7 @@ + + character(len=*), parameter :: FNAME = "write_vtk_points: " + c character(len=*), parameter ::fmt_data = "(3E)" +- character(len=*), parameter ::fmt_data = "(9E)" ++ character(len=*), parameter ::fmt_data = "(9E15.7)" + integer :: ii + + write(*, *)'dbg> ', FNAME, ' writing...' +@@ -491,7 +491,7 @@ + + character(len=*), parameter :: FNAME = "write_vtk_scalar: " + c character(len=*), parameter ::fmt_data = "(E)" +- character(len=*), parameter ::fmt_data = "(9E)" ++ character(len=*), parameter ::fmt_data = "(9E15.7)" + integer :: ii + + write(*, *)'dbg> ', FNAME, ' writing...', trim(byname) +@@ -541,7 +541,7 @@ + + character(len=*), parameter :: FNAME = "write_vtk_vector: " + c character(len=*), parameter ::fmt_data = "(3E)" +- character(len=*), parameter ::fmt_data = "(9E)" ++ character(len=*), parameter ::fmt_data = "(9E15.7)" + integer :: ii + + write(*, *)'dbg> ', FNAME, ' writing...', trim(byname) +diff -ru ffr.old/FFR_V3.1.004/FFR2VIZ/src/writeFLUENTHeader.f ffr.new/FFR_V3.1.004/FFR2VIZ/src/writeFLUENTHeader.f +--- ffr.old/FFR_V3.1.004/FFR2VIZ/src/writeFLUENTHeader.f 2009-05-27 10:57:50.000000000 +0900 ++++ ffr.new/FFR_V3.1.004/FFR2VIZ/src/writeFLUENTHeader.f 2020-04-07 18:24:57.000000000 +0900 +@@ -162,7 +162,7 @@ + end if + + 120 format(A) +- 121 format(A,3I,A) ++ 121 format(A,3I10,A) + 122 format(A,A,A) + + status=0 diff --git a/var/spack/repos/builtin/packages/ffr/package.py b/var/spack/repos/builtin/packages/ffr/package.py new file mode 100644 index 0000000000..8cd10fe538 --- /dev/null +++ b/var/spack/repos/builtin/packages/ffr/package.py @@ -0,0 +1,123 @@ +# Copyright 2013-2020 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) + +import os +from spack import * + + +class Ffr(MakefilePackage): + """FFR: FrontFlow/red, developed in Frontier Simulation Software + for Industrial Science(FSIS) project supported by IT program of + Ministry of Education, Culture, Sports, Science and Technology(MEXT), + JAPAN.""" + + homepage = "http://www.ciss.iis.u-tokyo.ac.jp/rss21/theme/multi/fluid/fluid_softwareinfo.html" + + version('3.1.004', sha256='2b396f66bb6437366721fac987f9c6e8b830638c3e4cb5df6a08ff41633f8481', url="file://{0}/FFR_V3.1.004.zip".format(os.getcwd())) + version('3.0_000', sha256='edc69fb1fd9dbdb3f531a8f2b9533a9b3c1a28768bb4029b84a6b35c95db0b48', url="file://{0}/open_FrontFlowRed_3.0_000.tar.gz".format(os.getcwd())) + + # FrontFlow/red used Fortran format I/E without width (For Example 3I) + # But gfortran require width (For Example (3I6). + patch('gfortran_format_31.patch', when='@3.1.004 %gcc') + patch('gfortran_format_30.patch', when='@3.0_000 %gcc') + + depends_on('mpi') + depends_on('metis@:4', type='link') + + parallel = False + build_directories = [ + join_path('src_main', 'src'), + join_path('src_pre', 'src'), + join_path('FFR2VIZ', 'src'), + join_path('FFR2VIZ', 'src_P_for'), + ] + + def edit(self, spec, prefix): + flags = ['-O3', '-I.', '-I{0}'.format(spec['metis'].prefix.include)] + fflags = flags[:] + if spec.satisfies('%gcc'): + fflags.append('-ffixed-line-length-none') + d = find('.', 'src_main', recursive=True) + root_dir = os.path.dirname(d[0]) + make = join_path(root_dir, 'src_pre', 'src', 'Makefile') + os.chmod(make, 0o644) + filter_file('#CSRCS =.*$', 'CSRCS = kmetis_main.c io.c', make) + filter_file( + 'LIBPRE =.*$', + 'LIBPRE = ' + spec['metis'].libs.ld_flags, + make + ) + if spec.satisfies('@3.0_000'): + d = find('.', 'src_main', recursive=True) + root_dir = os.path.dirname(d[0]) + for d in ['src_pre', 'FFR2VIZ']: + workdir = join_path(root_dir, d, 'src') + make = join_path(workdir, 'Makefile') + os.chmod(make, 0o644) + m = FileFilter(make) + m.filter( + r'include Makefile\..*\.in', + 'include Makefile.spack.in' + ) + with open(join_path(workdir, 'Makefile.spack.in'), 'w') as m: + m.write('OS = {0}\n'.format(spec.os)) + m.write('F90 = {0}\n'.format(spack_fc)) + m.write('F90LINKER = {0}\n'.format(spack_fc)) + m.write('FOPTIONS = {0}\n'.format(' '.join(fflags))) + m.write('CC = {0}\n'.format(spack_cc)) + m.write('COPTIONS = {0}\n'.format(' '.join(flags))) + m.write('MPI_HOME = \n') + m.write('MPI_INCLUDE = \n') + m.write('MPI_LIBS = ') + m.write('MPI_F90 = {0} {1}\n'.format( + spec['mpi'].mpifc, ' '.join(fflags))) + m.write('AR = ar rv\n') + m.write('RANLIB = :\n') + for makefile_in in find('.', 'Makefile.in', recursive=True): + os.chmod(makefile_in, 0o644) + m = FileFilter(makefile_in) + m.filter(r'OS\s*=.*$', 'OS = {0}'.format(spec.os)) + m.filter(r'F90\s*=.*$', 'F90 = {0}'.format(spack_fc)) + m.filter(r'F90LINKER\s*=.*$', 'F90LINKER = {0}'.format(spack_fc)) + m.filter( + r'FOPTIONS\s+=.*$', + 'FOPTIONS = {0}'.format(' '.join(fflags)) + ) + m.filter(r'CC\s+=.*$', 'CC = {0}'.format(spack_cc)) + m.filter( + r'COPTIONS\s+=.*$', + 'COPTIONS = {0}'.format(' '.join(flags)) + ) + m.filter(r'MPI_HOME\s+=.*$', 'MPI_HOME = ') + m.filter(r'MPI_INC\s+=.*$', 'MPI_INCLUDE = ') + m.filter(r'MPI_LIBS\s+=.*$', 'MPI_LIBS = ') + m.filter( + r'MPI_F90\s+=.*$', + 'MPI_F90 = {0} {1}'.format(spec['mpi'].mpifc, ' '.join(fflags)) + ) + m.filter(r'AR\s+=.*$', 'AR = ar rv') + m.filter(r'RANLIB =.*$', 'RANLIB = :') + + def build(self, spec, prefix): + d = find('.', 'src_main', recursive=True) + root_dir = os.path.dirname(d[0]) + copy( + join_path(root_dir, 'src_metis_4.1_fflow', 'Lib', 'kmetis_main.c'), + join_path(root_dir, 'src_pre', 'src') + ) + copy( + join_path(root_dir, 'src_metis_4.1_fflow', 'Lib', 'io.c'), + join_path(root_dir, 'src_pre', 'src') + ) + mkdirp(join_path(root_dir, 'bin_FFR')) + for dir in self.build_directories: + with working_dir(join_path(root_dir, dir)): + make('clean') + make() + + def install(self, spec, prefix): + d = find('.', 'src_main', recursive=True) + root_dir = os.path.dirname(d[0]) + install_tree(join_path(root_dir, 'bin_FFR'), prefix.bin) |