From a66840144ffe623fae17f731cdee0a9dc965e9fc Mon Sep 17 00:00:00 2001
From: Philippe WAUTELET <philippe.wautelet@aero.obs-mip.fr>
Date: Mon, 20 Mar 2023 14:20:42 +0100
Subject: [PATCH] Philippe 20/03/2023: MGSOLVER: add MNH_MGSOLVER key to
 compile with the multigrid solver

---
 src/Makefile.MESONH.mk   | 15 ++++++++++++++-
 src/Rules.AIX64.mk       |  7 ++++++-
 src/Rules.BG.mk          |  7 ++++++-
 src/Rules.BGQ.mk         |  7 ++++++-
 src/Rules.LXNAGfor.mk    |  7 ++++++-
 src/Rules.LXarm.mk       |  7 ++++++-
 src/Rules.LXcray.mk      |  7 ++++++-
 src/Rules.LXg95.mk       |  7 ++++++-
 src/Rules.LXgfortran.mk  |  7 ++++++-
 src/Rules.LXifort.mk     |  7 ++++++-
 src/Rules.LXnvhpc.mk     |  7 ++++++-
 src/Rules.LXnvhpc2005.mk |  7 ++++++-
 src/Rules.LXnvhpc2202.mk |  7 ++++++-
 src/Rules.LXpathf95.mk   |  7 ++++++-
 src/Rules.LXpgi.mk       |  7 ++++++-
 src/Rules.LXpgi2004.mk   |  7 ++++++-
 src/Rules.SX8.mk         |  7 ++++++-
 17 files changed, 110 insertions(+), 17 deletions(-)

diff --git a/src/Makefile.MESONH.mk b/src/Makefile.MESONH.mk
index 4bb42a92c..fa9490a25 100644
--- a/src/Makefile.MESONH.mk
+++ b/src/Makefile.MESONH.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2022 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -298,6 +298,19 @@ INC                   += $(INC_S4PY)
 VPATH                 += $(DIR_S4PY)
 endif
 ##########################################################
+#           Source MGSOLVER                              #
+##########################################################
+ifdef MNH_MGSOLVER
+DIR_MGSOLVER           = LIB/tensorproductmultigrid_Source
+INC_MGSOLVER           = -I$(B)$(DIR_MGSOLVER)
+DIR_MASTER            += $(DIR_MGSOLVER)
+#OBJS_LISTE_MASTER     += mg_main_mnh.o
+INC                   += $(INC_MGSOLVER)
+VPATH                 += $(DIR_MGSOLVER)
+CPPFLAGS_MGSOLVER     ?= -DMNH_MGSOLVER
+CPPFLAGS_MNH          += $(CPPFLAGS_MGSOLVER)
+endif
+##########################################################
 #           Source FOREFIRE                              #
 ##########################################################
 ifdef MNH_FOREFIRE
diff --git a/src/Rules.AIX64.mk b/src/Rules.AIX64.mk
index 5f750fdcd..2391213f1 100644
--- a/src/Rules.AIX64.mk
+++ b/src/Rules.AIX64.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -106,6 +106,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.BG.mk b/src/Rules.BG.mk
index 7f4261c75..1f8893b2d 100644
--- a/src/Rules.BG.mk
+++ b/src/Rules.BG.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -117,6 +117,11 @@ MNH_IOLFI=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.BGQ.mk b/src/Rules.BGQ.mk
index 1fd0a07bd..05a7bbf5b 100644
--- a/src/Rules.BGQ.mk
+++ b/src/Rules.BGQ.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -173,6 +173,11 @@ MNH_IOLFI=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.LXNAGfor.mk b/src/Rules.LXNAGfor.mk
index f623af39c..ab86e6370 100644
--- a/src/Rules.LXNAGfor.mk
+++ b/src/Rules.LXNAGfor.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -99,6 +99,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.LXarm.mk b/src/Rules.LXarm.mk
index e517a95b0..8cc83a245 100644
--- a/src/Rules.LXarm.mk
+++ b/src/Rules.LXarm.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -129,6 +129,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.LXcray.mk b/src/Rules.LXcray.mk
index 5fdd9a8d4..e1725ac08 100644
--- a/src/Rules.LXcray.mk
+++ b/src/Rules.LXcray.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2022 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -243,6 +243,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.LXg95.mk b/src/Rules.LXg95.mk
index 305f9f56c..6668c4371 100644
--- a/src/Rules.LXg95.mk
+++ b/src/Rules.LXg95.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -87,6 +87,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.LXgfortran.mk b/src/Rules.LXgfortran.mk
index b4a1cf079..5f4fffc6b 100644
--- a/src/Rules.LXgfortran.mk
+++ b/src/Rules.LXgfortran.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -154,6 +154,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.LXifort.mk b/src/Rules.LXifort.mk
index 46c66c03a..6a0c69a7c 100644
--- a/src/Rules.LXifort.mk
+++ b/src/Rules.LXifort.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -227,6 +227,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.LXnvhpc.mk b/src/Rules.LXnvhpc.mk
index 7f18c08c6..2fbd5e9d6 100644
--- a/src/Rules.LXnvhpc.mk
+++ b/src/Rules.LXnvhpc.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2022 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -233,6 +233,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.LXnvhpc2005.mk b/src/Rules.LXnvhpc2005.mk
index e8e199e86..550965884 100644
--- a/src/Rules.LXnvhpc2005.mk
+++ b/src/Rules.LXnvhpc2005.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -226,6 +226,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
diff --git a/src/Rules.LXnvhpc2202.mk b/src/Rules.LXnvhpc2202.mk
index 838866084..ac1d75773 100644
--- a/src/Rules.LXnvhpc2202.mk
+++ b/src/Rules.LXnvhpc2202.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -245,6 +245,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.LXpathf95.mk b/src/Rules.LXpathf95.mk
index 932b438aa..7a7219610 100644
--- a/src/Rules.LXpathf95.mk
+++ b/src/Rules.LXpathf95.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -67,6 +67,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.LXpgi.mk b/src/Rules.LXpgi.mk
index a01198eda..ac1886174 100644
--- a/src/Rules.LXpgi.mk
+++ b/src/Rules.LXpgi.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -180,6 +180,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
diff --git a/src/Rules.LXpgi2004.mk b/src/Rules.LXpgi2004.mk
index 63451e430..f8b4c2073 100644
--- a/src/Rules.LXpgi2004.mk
+++ b/src/Rules.LXpgi2004.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2019 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -223,6 +223,11 @@ MNH_COMPRESS=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ##########################################################
 #                                                        #
 # Source of MESONH PACKAGE  Distribution                 #
diff --git a/src/Rules.SX8.mk b/src/Rules.SX8.mk
index 79e63f46c..6a04e0f15 100644
--- a/src/Rules.SX8.mk
+++ b/src/Rules.SX8.mk
@@ -1,4 +1,4 @@
-#MNH_LIC Copyright 1994-2021 CNRS, Meteo-France and Universite Paul Sabatier
+#MNH_LIC Copyright 1994-2023 CNRS, Meteo-France and Universite Paul Sabatier
 #MNH_LIC This is part of the Meso-NH software governed by the CeCILL-C licence
 #MNH_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
 #MNH_LIC for details. version 1.
@@ -109,6 +109,11 @@ MNH_IOLFI=yes
 #if MNH_S4PY exists => compile the libs4py library (for epygram)
 #MNH_S4PY=no
 #
+## MGSOLVER flag (multigrid solver)
+#
+#if MNH_MGSOLVER exists => compile the multigrid solver
+MNH_MGSOLVER ?= YES
+#
 ## ecCodes or grib_api selection
 #MNH_GRIBAPI: if set to no:  use ecCodes
 #             if set to yes: use grib_api (deprecated library)
-- 
GitLab