From 9e540d187ed69c4d6e333e2a425d8ea43bffd51f Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Fri, 7 Jun 2019 14:39:51 +0200
Subject: [PATCH] Support for multiple configurations per python file

---
 pystencils_walberla/cmake_integration.py             | 8 +++++---
 pystencils_walberla/templates/SweepInnerOuter.tmpl.h | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/pystencils_walberla/cmake_integration.py b/pystencils_walberla/cmake_integration.py
index 00321a5..459c8a3 100644
--- a/pystencils_walberla/cmake_integration.py
+++ b/pystencils_walberla/cmake_integration.py
@@ -44,14 +44,15 @@ def parse_json_args():
                               'WALBERLA_OPTIMIZE_FOR_LOCALHOST': False,
                               'WALBERLA_DOUBLE_ACCURACY': True,
                               'WALBERLA_BUILD_WITH_MPI': True,
-                              'WALBERLA_BUILD_WITH_CUDA': False}
+                              'WALBERLA_BUILD_WITH_CUDA': False,
+                              "CODEGEN_CFG": ""}
                }
 
     if len(sys.argv) == 2:
         try:
             parsed = json.loads(sys.argv[1])
         except json.JSONDecodeError:
-            warnings.warn("Could not parse JSON arguments")
+            warnings.warn("Could not parse JSON arguments: " + sys.argv[1])
             parsed = default
     else:
         parsed = default
@@ -74,6 +75,7 @@ class CodeGenerationContext:
         self.mpi = cmake_vars['WALBERLA_BUILD_WITH_MPI']
         self.double_accuracy = cmake_vars['WALBERLA_DOUBLE_ACCURACY']
         self.cuda = cmake_vars['WALBERLA_BUILD_WITH_CUDA']
+        self.config = cmake_vars['CODEGEN_CFG'].strip()
 
     def write_file(self, name, content):
         self.files_written.append(os.path.abspath(name))
@@ -93,7 +95,7 @@ class ManualCodeGenerationContext:
         self.double_accuracy = double_accuracy
         self.files = dict()
         self.cuda = False
-
+        self.config = ""
     def write_file(self, name, content):
         self.files[name] = content
 
diff --git a/pystencils_walberla/templates/SweepInnerOuter.tmpl.h b/pystencils_walberla/templates/SweepInnerOuter.tmpl.h
index ff04541..466f510 100644
--- a/pystencils_walberla/templates/SweepInnerOuter.tmpl.h
+++ b/pystencils_walberla/templates/SweepInnerOuter.tmpl.h
@@ -43,6 +43,7 @@
 #if ( defined WALBERLA_CXX_COMPILER_IS_GNU ) || ( defined WALBERLA_CXX_COMPILER_IS_CLANG )
 #   pragma GCC diagnostic push
 #   pragma GCC diagnostic ignored "-Wunused-parameter"
+#   pragma GCC diagnostic ignored "-Wreorder"
 #endif
 
 namespace walberla {
-- 
GitLab