Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def fortran_extensionlists(self):
- """
- Adds the Fortran extensions using Numpy's distutils extension.
- """
- extra_link_flags = self.static_link_gfortran + self.static_link_gcc + self.flag_32bit + self.extra_fortran_link_flags
- extra_compile_flags = self.flag_32bit + self.extra_c_flags
- config = np.distutils.misc_util.Configuration()
- extraargs={'extra_link_args':extra_link_flags[:], 'extra_compile_args':extra_compile_flags[:]}
- extraargs['extra_f77_compile_args'] = extra_compile_flags[:]
- extraargs['extra_f90_compile_args'] = extra_compile_flags[:]
- #Hairer
- sources='assimulo'+os.sep+'thirdparty'+os.sep+'hairer'+os.sep+'{0}.f','assimulo'+os.sep+'thirdparty'+os.sep+'hairer'+os.sep+'{0}.pyf'
- config.add_extension('assimulo.lib.dopri5', sources=[s.format('dopri5') for s in sources], **extraargs)
- config.add_extension('assimulo.lib.rodas', sources=[s.format('rodas_decsol') for s in sources], include_dirs=[np.get_include()],**extraargs)
- config.add_extension('assimulo.lib.radau5', sources=[s.format('radau_decsol') for s in sources], include_dirs=[np.get_include()],**extraargs)
- radar_list=['contr5.f90', 'radar5_int.f90', 'radar5.f90', 'dontr5.f90', 'decsol.f90', 'dc_decdel.f90', 'radar5.pyf']
- src=['assimulo'+os.sep+'thirdparty'+os.sep+'hairer'+os.sep+code for code in radar_list]
- config.add_extension('assimulo.lib.radar5', sources= src, include_dirs=[np.get_include()],**extraargs)
- #ODEPACK
- odepack_list = ['opkdmain.f', 'opkda1.f', 'opkda2.f', 'odepack_aux.f90','odepack.pyf']
- src=['assimulo'+os.sep+'thirdparty'+os.sep+'odepack'+os.sep+code for code in odepack_list]
- config.add_extension('assimulo.lib.odepack', sources= src, include_dirs=[np.get_include()],**extraargs)
- #ODASSL
- odassl_list=['odassl.pyf','odassl.f','odastp.f','odacor.f','odajac.f','d1mach.f','daxpy.f','ddanrm.f','ddatrp.f','ddot.f',
- 'ddwats.f','dgefa.f','dgesl.f','dscal.f','idamax.f','xerrwv.f']
- src=['assimulo'+os.sep+'thirdparty'+os.sep+'odassl'+os.sep+code for code in odassl_list]
- config.add_extension('assimulo.lib.odassl', sources= src, include_dirs=[np.get_include()],**extraargs)
- dasp3_f77_compile_flags = ["-fdefault-double-8","-fdefault-real-8"]
- dasp3_f77_compile_flags += extra_compile_flags
- #NOTE, THERE IS A PROBLEM WITH PASSING F77 COMPILER ARGS FOR NUMPY LESS THAN 1.6.1
- dasp3_list = ['dasp3dp.pyf', 'DASP3.f', 'ANORM.f','CTRACT.f','DECOMP.f', 'HMAX.f','INIVAL.f','JACEST.f','PDERIV.f','PREPOL.f','SOLVE.f','SPAPAT.f']
- src=['assimulo'+os.sep+'thirdparty'+os.sep+'dasp3'+os.sep+code for code in dasp3_list]
- config.add_extension('assimulo.lib.dasp3dp',
- sources= src,
- include_dirs=[np.get_include()], extra_link_args=extra_link_flags[:],extra_f77_compile_args=dasp3_f77_compile_flags[:],
- extra_compile_args=extra_compile_flags[:],extra_f90_compile_args=extra_compile_flags[:])
- #GLIMDA
- if self.with_BLAS and self.with_LAPACK:
- glimda_list = ['glimda_complete.f','glimda_complete.pyf']
- src=['assimulo'+os.sep+'thirdparty'+os.sep+'glimda'+os.sep+code for code in glimda_list]
- extraargs_glimda={'extra_link_args':extra_link_flags[:], 'extra_compile_args':extra_compile_flags[:], 'library_dirs':[self.BLASdir, self.LAPACKdir], 'libraries':['lapack', self.BLASname]}
- extraargs_glimda["extra_f77_compile_args"] = extra_compile_flags[:]
- config.add_extension('assimulo.lib.glimda', sources= src,include_dirs=[np.get_include()],**extraargs_glimda)
- extra_link_flags=extra_link_flags[:-2] # remove LAPACK flags after GLIMDA
- else:
- L.warning("Could not find Blas or Lapack, disabling support for the solver GLIMDA.")
- return config.todict()["ext_modules"]
- for e in ext_list:
- e.extra_f77_compile_args = []
- e.extra_f90_compile_args = []
- ext_list += prepare.fortran_extensionlists()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement