Advertisement
foadsf

Untitled

Apr 16th, 2024
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.23 KB | None | 0 0
  1.  
  2.     def fortran_extensionlists(self):
  3.         """
  4.        Adds the Fortran extensions using Numpy's distutils extension.
  5.        """
  6.         extra_link_flags = self.static_link_gfortran + self.static_link_gcc + self.flag_32bit + self.extra_fortran_link_flags
  7.         extra_compile_flags = self.flag_32bit + self.extra_c_flags
  8.        
  9.         config = np.distutils.misc_util.Configuration()
  10.         extraargs={'extra_link_args':extra_link_flags[:], 'extra_compile_args':extra_compile_flags[:]}
  11.                  
  12.         extraargs['extra_f77_compile_args'] = extra_compile_flags[:]
  13.         extraargs['extra_f90_compile_args'] = extra_compile_flags[:]
  14.    
  15.         #Hairer
  16.         sources='assimulo'+os.sep+'thirdparty'+os.sep+'hairer'+os.sep+'{0}.f','assimulo'+os.sep+'thirdparty'+os.sep+'hairer'+os.sep+'{0}.pyf'
  17.         config.add_extension('assimulo.lib.dopri5', sources=[s.format('dopri5') for s in sources], **extraargs)
  18.         config.add_extension('assimulo.lib.rodas', sources=[s.format('rodas_decsol') for s in sources], include_dirs=[np.get_include()],**extraargs)
  19.         config.add_extension('assimulo.lib.radau5', sources=[s.format('radau_decsol') for s in sources], include_dirs=[np.get_include()],**extraargs)
  20.                              
  21.         radar_list=['contr5.f90', 'radar5_int.f90', 'radar5.f90', 'dontr5.f90', 'decsol.f90', 'dc_decdel.f90', 'radar5.pyf']
  22.         src=['assimulo'+os.sep+'thirdparty'+os.sep+'hairer'+os.sep+code for code in radar_list]
  23.         config.add_extension('assimulo.lib.radar5', sources= src, include_dirs=[np.get_include()],**extraargs)
  24.        
  25.         #ODEPACK
  26.         odepack_list = ['opkdmain.f', 'opkda1.f', 'opkda2.f', 'odepack_aux.f90','odepack.pyf']
  27.         src=['assimulo'+os.sep+'thirdparty'+os.sep+'odepack'+os.sep+code for code in odepack_list]
  28.         config.add_extension('assimulo.lib.odepack', sources= src, include_dirs=[np.get_include()],**extraargs)
  29.      
  30.         #ODASSL
  31.         odassl_list=['odassl.pyf','odassl.f','odastp.f','odacor.f','odajac.f','d1mach.f','daxpy.f','ddanrm.f','ddatrp.f','ddot.f',
  32.                       'ddwats.f','dgefa.f','dgesl.f','dscal.f','idamax.f','xerrwv.f']
  33.         src=['assimulo'+os.sep+'thirdparty'+os.sep+'odassl'+os.sep+code for code in odassl_list]
  34.         config.add_extension('assimulo.lib.odassl', sources= src, include_dirs=[np.get_include()],**extraargs)
  35.    
  36.         dasp3_f77_compile_flags = ["-fdefault-double-8","-fdefault-real-8"]
  37.         dasp3_f77_compile_flags += extra_compile_flags
  38.        
  39.         #NOTE, THERE IS A PROBLEM WITH PASSING F77 COMPILER ARGS FOR NUMPY LESS THAN 1.6.1
  40.         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']
  41.         src=['assimulo'+os.sep+'thirdparty'+os.sep+'dasp3'+os.sep+code for code in dasp3_list]
  42.         config.add_extension('assimulo.lib.dasp3dp',
  43.                               sources= src,
  44.                               include_dirs=[np.get_include()], extra_link_args=extra_link_flags[:],extra_f77_compile_args=dasp3_f77_compile_flags[:],
  45.                               extra_compile_args=extra_compile_flags[:],extra_f90_compile_args=extra_compile_flags[:])
  46.    
  47.         #GLIMDA
  48.         if self.with_BLAS and self.with_LAPACK:
  49.             glimda_list = ['glimda_complete.f','glimda_complete.pyf']
  50.             src=['assimulo'+os.sep+'thirdparty'+os.sep+'glimda'+os.sep+code for code in glimda_list]
  51.             extraargs_glimda={'extra_link_args':extra_link_flags[:], 'extra_compile_args':extra_compile_flags[:], 'library_dirs':[self.BLASdir, self.LAPACKdir], 'libraries':['lapack', self.BLASname]}
  52.             extraargs_glimda["extra_f77_compile_args"] = extra_compile_flags[:]
  53.             config.add_extension('assimulo.lib.glimda', sources= src,include_dirs=[np.get_include()],**extraargs_glimda)
  54.             extra_link_flags=extra_link_flags[:-2]  # remove LAPACK flags after GLIMDA
  55.         else:
  56.             L.warning("Could not find Blas or Lapack, disabling support for the solver GLIMDA.")
  57.        
  58.    
  59.         return config.todict()["ext_modules"]
  60.        
  61.  
  62. for e in ext_list:
  63.     e.extra_f77_compile_args = []
  64.     e.extra_f90_compile_args = []
  65.  
  66. ext_list += prepare.fortran_extensionlists()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement