From 7f9a4c3946e5b545a5494ca3f6173117f63e9e7c Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Keck <Jean-Baptiste.Keck@imag.fr>
Date: Thu, 12 Jan 2017 12:33:35 +0100
Subject: [PATCH] working build

---
 CMakeLists.txt              |  3 ++-
 cmake/fortran_utils.cmake   |  6 +++---
 hysop/operator/diffusion.py | 11 ++++++++---
 hysop/testsenv.py           |  2 +-
 setup.py.in                 |  7 ++++---
 5 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ac6c73b3..a483ca96c 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -345,8 +345,9 @@ if(USE_FORTRAN)
   # includes the other required pyf files.
   # For example, if WITH_FFTW is ON, then
   # add a line 'include fftw2py.py'
+  set(F_2_HYSOP "f2hysop")
   include(fortran_utils)
-  write_main_pyf_file(f2hysop)
+  write_main_pyf_file(${F_2_HYSOP})
   # f2py failed with:
   # real(kind=wp), dimension(:) :: tab
   # whit wp = real64 or real32 from iso_fortran_env
diff --git a/cmake/fortran_utils.cmake b/cmake/fortran_utils.cmake
index 6805925b6..a86bb87cf 100644
--- a/cmake/fortran_utils.cmake
+++ b/cmake/fortran_utils.cmake
@@ -23,7 +23,7 @@ function(write_main_pyf_file filename)
 "!    -*- f90 -*-\n
 ! Generated file - Do not edit.\n
 ! Note: the context of this file is case sensitive.\n
-python module f2hysop ! in\n
+python module ${F_2_HYSOP} ! in\n
   interface\n")
  file(APPEND ${_file} 
       "      ! Example
@@ -47,9 +47,9 @@ python module f2hysop ! in\n
       include '@CMAKE_SOURCE_DIR@/hysop/numerics/extras_f/arnoldi.pyf'\n")
 	endif()
  file(APPEND ${_file} "  end interface\n
-end python module f2hysop")
+end python module ${F_2_HYSOP}")
 
-message(STATUS "Generate f2hysop.pyf file ...")
+message(STATUS "Generate ${F_2_HYSOP}.pyf file ...")
 configure_file(${_file} ${GENERATED_FORTRAN_FILES_DIR}/${filename}.pyf @ONLY)
 
 endfunction()
diff --git a/hysop/operator/diffusion.py b/hysop/operator/diffusion.py
index c46eb5076..cf5000d2d 100644
--- a/hysop/operator/diffusion.py
+++ b/hysop/operator/diffusion.py
@@ -37,15 +37,20 @@ class Diffusion(Computational):
         """
         assert 'variables' not in kwds, 'variables parameter is useless.'
         super(Diffusion, self).__init__(variables=[vorticity], **kwds)
-        msg = 'Diffusion : unknown method for space discretization'
-        if self.method is None:
+        if 'method' not in kwds:
             import hysop.default_methods as default
             self.method = default.DIFFUSION
+        else:
+            self.method = kwds.pop('method')
+        
+        msg = 'Diffusion : unknown method for space discretization'
         assert self.method[SpaceDiscretisation] in self._authorized_methods,\
-            msg
+               msg
+
         msg = 'Diffusion : on_gpu resolution is not available on your system.'
         if self.method[SpaceDiscretisation] is 'on_gpu':
             assert __GPU_ENABLED__, msg
+
         # input/output field, solution of the problem
         self.vorticity = vorticity
         # viscosity
diff --git a/hysop/testsenv.py b/hysop/testsenv.py
index d677d10b6..3bb17d867 100755
--- a/hysop/testsenv.py
+++ b/hysop/testsenv.py
@@ -1,6 +1,6 @@
 """Set some functions and variables useful to run tests.
 """
-from hysop import __FFTW_ENABLED__, __SCALES_ENABLED__
+from hysop import __FFTW_ENABLED__, __SCALES_ENABLED__, __ENABLE_LONG_TESTS__
 import pytest
 import shutil
 from hysop.tools.io_utils import IO
diff --git a/setup.py.in b/setup.py.in
index e28d8b617..cc9612d3b 100644
--- a/setup.py.in
+++ b/setup.py.in
@@ -305,7 +305,8 @@ if enable_fortran is "ON":
 
     # === Draft for future implementation of fortran interface ===
     # -- f2py signature file --
-    pyf_file = os.path.join('@GENERATED_FORTRAN_FILES_DIR@', 'f2hysop.pyf')
+    f2hysop = "@F_2_HYSOP@"
+    pyf_file = os.path.join('@GENERATED_FORTRAN_FILES_DIR@', f2hysop+'.pyf')
     # change from relative path in subdirs to absolute path in num_dirs
     num_dirs = []
     for sd in subdirs:
@@ -316,8 +317,8 @@ if enable_fortran is "ON":
     # For the moment, it includes the 'old' interface
     # to scales and fftw (in sources) and the new
     # interface, in src_dirs
-    ext['f2hysop'] = create_fortran_extension(
-        name='hysop.f2hysop',
+    ext[f2hysop] = create_fortran_extension(
+        name='hysop.'+f2hysop,
         sources=fortran_src,
         libdir=hysop_libdir,
         libs=hysoplib,
-- 
GitLab