From dd73620d50dd94e31228d0e919636a22f12a1f9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ruth=20Sch=C3=B6bel?= <r.schoebel@fz-juelich.de>
Date: Fri, 6 Jan 2023 14:29:14 +0100
Subject: [PATCH] add METIS

---
 .../METIS/METIS-5.1.0-GCC-11.3-RTW64-IDX32.eb | 41 +++++++++++++++
 .../METIS/METIS-5.1.0-GCCcore-11.2.0-IDX64.eb | 50 +++++++++++++++++++
 Golden_Repo/m/METIS/METIS-5.1.0-IDX64.patch   | 11 ++++
 Golden_Repo/m/METIS/METIS-5.1.0-foss-2022a.eb | 25 ++++++++++
 .../m/METIS/METIS-5.1.0-use-doubles.patch     | 11 ++++
 5 files changed, 138 insertions(+)
 create mode 100644 Golden_Repo/m/METIS/METIS-5.1.0-GCC-11.3-RTW64-IDX32.eb
 create mode 100644 Golden_Repo/m/METIS/METIS-5.1.0-GCCcore-11.2.0-IDX64.eb
 create mode 100644 Golden_Repo/m/METIS/METIS-5.1.0-IDX64.patch
 create mode 100644 Golden_Repo/m/METIS/METIS-5.1.0-foss-2022a.eb
 create mode 100644 Golden_Repo/m/METIS/METIS-5.1.0-use-doubles.patch

diff --git a/Golden_Repo/m/METIS/METIS-5.1.0-GCC-11.3-RTW64-IDX32.eb b/Golden_Repo/m/METIS/METIS-5.1.0-GCC-11.3-RTW64-IDX32.eb
new file mode 100644
index 000000000..638384a4f
--- /dev/null
+++ b/Golden_Repo/m/METIS/METIS-5.1.0-GCC-11.3-RTW64-IDX32.eb
@@ -0,0 +1,41 @@
+name = 'METIS'
+
+version = '5.1.0'
+
+versionsuffix = '-RTW64-IDX32'
+
+homepage = 'http://glaros.dtc.umn.edu/gkhome/metis/metis/overview'
+
+description = """METIS is a set of serial programs for partitioning graphs, partitioning finite element meshes,
+
+and producing fill reducing orderings for sparse matrices. The algorithms implemented in METIS are based on the
+
+multilevel recursive-bisection, multilevel k-way, and multi-constraint partitioning schemes.
+
+"""
+
+toolchain = {'name': 'GCC', 'version': '11.3.0'}
+
+toolchainopts = {'pic': True}
+
+source_urls = [
+    'https://src.fedoraproject.org/repo/pkgs/metis/metis-5.1.0.tar.gz/5465e67079419a69e0116de24fce58fe'
+]
+sources = [SOURCELOWER_TAR_GZ]
+patches = ['METIS-5.1.0-use-doubles.patch']
+checksums = [
+    {'metis-5.1.0.tar.gz': '76faebe03f6c963127dbb73c13eab58c9a3faeae48779f049066a21c087c5db2'},
+    {'METIS-5.1.0-use-doubles.patch': '8e79f5970c0fb36394dd6338dd3160eb346dc00e38c37ac90303e1ee5eb4c53f'},
+]
+
+# We use 32bit for indices and 64bit for content
+
+builddependencies = [
+
+    ('CMake', '3.23.1')
+
+]
+
+configopts = ['', 'shared=1']
+
+moduleclass = 'math'
diff --git a/Golden_Repo/m/METIS/METIS-5.1.0-GCCcore-11.2.0-IDX64.eb b/Golden_Repo/m/METIS/METIS-5.1.0-GCCcore-11.2.0-IDX64.eb
new file mode 100644
index 000000000..1a58a5a09
--- /dev/null
+++ b/Golden_Repo/m/METIS/METIS-5.1.0-GCCcore-11.2.0-IDX64.eb
@@ -0,0 +1,50 @@
+name = 'METIS'
+
+version = '5.1.0'
+
+versionsuffix = '-IDX64'
+
+homepage = 'http://glaros.dtc.umn.edu/gkhome/metis/metis/overview'
+
+description = """METIS is a set of serial programs for partitioning graphs, partitioning finite element meshes,
+
+and producing fill reducing orderings for sparse matrices. The algorithms implemented in METIS are based on the
+
+multilevel recursive-bisection, multilevel k-way, and multi-constraint partitioning schemes.
+
+"""
+
+toolchain = {'name': 'GCCcore', 'version': '11.3.0'}
+
+toolchainopts = {'pic': True}
+
+source_urls = [
+
+    'https://src.fedoraproject.org/repo/pkgs/metis/metis-5.1.0.tar.gz/5465e67079419a69e0116de24fce58fe/'
+]
+
+sources = [SOURCELOWER_TAR_GZ]
+
+patches = ['METIS-5.1.0-IDX64.patch']
+
+checksums = [
+
+    '76faebe03f6c963127dbb73c13eab58c9a3faeae48779f049066a21c087c5db2',  # metis-5.1.0.tar.gz
+
+    # METIS-5.1.0-IDX64.patch
+
+    '382337016508006671e5495652f25a7f835e56134681a21b0c8525b4b88ab99e',
+
+]
+
+builddependencies = [
+
+    ('binutils', '2.38'),
+
+    ('CMake', '3.23.1')
+
+]
+
+configopts = ['', 'shared=1']
+
+moduleclass = 'math'
diff --git a/Golden_Repo/m/METIS/METIS-5.1.0-IDX64.patch b/Golden_Repo/m/METIS/METIS-5.1.0-IDX64.patch
new file mode 100644
index 000000000..708166923
--- /dev/null
+++ b/Golden_Repo/m/METIS/METIS-5.1.0-IDX64.patch
@@ -0,0 +1,11 @@
+--- include/metis_orig.h	2021-01-20 15:05:51.807203000 +0100
++++ include/metis.h	2021-01-20 15:07:06.391591000 +0100
+@@ -30,7 +30,7 @@
+  GCC does provides these definitions in stdint.h, but it may require some
+  modifications on other architectures.
+ --------------------------------------------------------------------------*/
+-#define IDXTYPEWIDTH 32
++#define IDXTYPEWIDTH 64
+ 
+ 
+ /*--------------------------------------------------------------------------
diff --git a/Golden_Repo/m/METIS/METIS-5.1.0-foss-2022a.eb b/Golden_Repo/m/METIS/METIS-5.1.0-foss-2022a.eb
new file mode 100644
index 000000000..3f716841a
--- /dev/null
+++ b/Golden_Repo/m/METIS/METIS-5.1.0-foss-2022a.eb
@@ -0,0 +1,25 @@
+name = 'METIS'
+version = '5.1.0'
+
+homepage = 'http://glaros.dtc.umn.edu/gkhome/metis/metis/overview'
+description = """METIS is a set of serial programs for partitioning graphs, partitioning finite element meshes,
+ and producing fill reducing orderings for sparse matrices. The algorithms implemented in METIS are based on the
+ multilevel recursive-bisection, multilevel k-way, and multi-constraint partitioning schemes."""
+
+toolchain = {'name': 'foss', 'version': '2022a'}
+toolchainopts = {'optarch': True, 'pic': True}
+
+source_urls = ['https://src.fedoraproject.org/repo/pkgs/metis/metis-5.1.0.tar.gz/5465e67079419a69e0116de24fce58fe']
+sources = [SOURCELOWER_TAR_GZ]
+patches = ['METIS-5.1.0-use-doubles.patch']
+checksums = [
+    {'metis-5.1.0.tar.gz': '76faebe03f6c963127dbb73c13eab58c9a3faeae48779f049066a21c087c5db2'},
+    {'METIS-5.1.0-use-doubles.patch': '8e79f5970c0fb36394dd6338dd3160eb346dc00e38c37ac90303e1ee5eb4c53f'},
+]
+
+# we use 32bit for indices and 64bit for content
+builddependencies = [('CMake', '3.23.1')]
+
+configopts = ['', 'shared=1']
+
+moduleclass = 'math'
diff --git a/Golden_Repo/m/METIS/METIS-5.1.0-use-doubles.patch b/Golden_Repo/m/METIS/METIS-5.1.0-use-doubles.patch
new file mode 100644
index 000000000..c7b875167
--- /dev/null
+++ b/Golden_Repo/m/METIS/METIS-5.1.0-use-doubles.patch
@@ -0,0 +1,11 @@
+# Use double for floating point (64 bit) in METIS by default
+# OpenFOAM 4 uses doubles be default
+diff -ur metis-5.1.0.orig/include/metis.h metis-5.1.0/include/metis.h
+--- metis-5.1.0.orig/include/metis.h	2013-03-30 17:24:45.000000000 +0100
++++ metis-5.1.0/include/metis.h	2016-09-05 11:39:33.004384533 +0200
+@@ -40,7 +40,7 @@
+    32 : single precission floating point (float)
+    64 : double precission floating point (double)
+ --------------------------------------------------------------------------*/
+-#define REALTYPEWIDTH 32
++#define REALTYPEWIDTH 64
-- 
GitLab