git: 0b9278ec684a - main - science/cardioid: New port: Cardiac simulation toolkit

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 24 Aug 2022 20:32:28 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0b9278ec684ab7923315214fec4171e97e7a021f

commit 0b9278ec684ab7923315214fec4171e97e7a021f
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-08-24 20:31:19 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-08-24 20:32:26 +0000

    science/cardioid: New port: Cardiac simulation toolkit
---
 science/Makefile                                   |  1 +
 science/cardioid/Makefile                          | 52 ++++++++++++++++++++++
 science/cardioid/distinfo                          |  5 +++
 .../cardioid/files/patch-simUtil_src_ddcMalloc.c   | 20 +++++++++
 .../cardioid/files/patch-simUtil_src_utilities.c   | 22 +++++++++
 science/cardioid/pkg-descr                         |  6 +++
 6 files changed, 106 insertions(+)

diff --git a/science/Makefile b/science/Makefile
index dc6dd9d62a78..75361ae656a0 100644
--- a/science/Makefile
+++ b/science/Makefile
@@ -38,6 +38,7 @@
     SUBDIR += bodr
     SUBDIR += buddy
     SUBDIR += cantera
+    SUBDIR += cardioid
     SUBDIR += cdcl
     SUBDIR += cdf
     SUBDIR += cdk
diff --git a/science/cardioid/Makefile b/science/cardioid/Makefile
new file mode 100644
index 000000000000..d60938ab7143
--- /dev/null
+++ b/science/cardioid/Makefile
@@ -0,0 +1,52 @@
+PORTNAME=	cardioid
+PORTVERSION=	g20211026
+CATEGORIES=	science
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Cardiac simulation toolkit
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+LIB_DEPENDS=	libblas.so:math/blas \
+		liblapack.so:math/lapack
+RUN_DEPENDS=	bash:shells/bash
+
+USES=		cmake:testing compiler:c++11-lang shebangfix
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	LLNL
+GH_TAGNAME=	2f66d9f
+GH_TUPLE=	mfem:mfem:v4.4:mfem
+
+SHEBANG_FILES=	elec/compileReaction.template
+
+CMAKE_TESTING_ON=	ENABLE_TESTS
+
+PLIST_FILES=	bin/cardioid \
+		bin/compileReaction \
+		bin/singleCell
+
+OPTIONS_DEFINE=		MFEM OPENMP
+OPTIONS_SINGLE=		MFEM MPI
+OPTIONS_SINGLE_MPI=	NOMPI MPICH OPENMPI
+OPTIONS_DEFAULT=	MPICH OPENMP
+OPTIONS_SUB=		yes
+
+MFEM_DESC=		Build with MFEM mesh library
+MFEM_CMAKE_ON=		-DMFEM_DIR=${WRKSRC_mfem}
+MFEM_BROKEN=		see https://github.com/LLNL/cardioid/issues/15
+
+NOMPI_DESC=		Build without parallel processing support
+NOMPI_BROKEN=		https://github.com/LLNL/axom/issues/913
+
+MPICH_USES=		mpi:mpich
+MPICH_CMAKE_ON=		-DENABLE_MPI=ON
+
+OPENMPI_USES=		mpi:openmpi
+OPENMPI_CMAKE_ON=	-DENABLE_MPI=ON
+
+OPENMP_CMAKE_BOOL=	ENABLE_OPENMP
+OPENMP_BROKEN_OFF=	https://github.com/LLNL/cardioid/issues/14
+
+.include <bsd.port.mk>
diff --git a/science/cardioid/distinfo b/science/cardioid/distinfo
new file mode 100644
index 000000000000..e951f8b0b77c
--- /dev/null
+++ b/science/cardioid/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1661371882
+SHA256 (LLNL-cardioid-g20211026-2f66d9f_GH0.tar.gz) = 16bfedb27110170adcf8f3090379a56c8e1637256e2761e85d98c9c043dcf970
+SIZE (LLNL-cardioid-g20211026-2f66d9f_GH0.tar.gz) = 6781832
+SHA256 (mfem-mfem-v4.4_GH0.tar.gz) = 0325a57854d9268dfe3f8d9b03836eb01b00a966d93162e6249857e9fab9c61f
+SIZE (mfem-mfem-v4.4_GH0.tar.gz) = 3078651
diff --git a/science/cardioid/files/patch-simUtil_src_ddcMalloc.c b/science/cardioid/files/patch-simUtil_src_ddcMalloc.c
new file mode 100644
index 000000000000..1fe7184b1200
--- /dev/null
+++ b/science/cardioid/files/patch-simUtil_src_ddcMalloc.c
@@ -0,0 +1,20 @@
+--- simUtil/src/ddcMalloc.c.orig	2022-08-24 19:49:58 UTC
++++ simUtil/src/ddcMalloc.c
+@@ -381,6 +381,8 @@ void printHeapInfo(FILE* file)
+ {
+ #ifdef __APPLE__
+  fprintf(file, "In routine printHeapInfo no mallinfo on OS X. Sorry.\n");
++#elif defined(__FreeBSD__)
++ fprintf(file, "In routine printHeapInfo no mallinfo on FreeBSD. Sorry.\n");
+ #else
+    struct mallinfo minfo;
+    minfo = mallinfo();
+@@ -397,6 +399,8 @@ void printHeapInfo_pio(PFILE* file)
+ {
+ #ifdef __APPLE__
+    Pprintf(file, "No mallinfo on OS X.  Sorry.\n");
++#elif defined(__FreeBSD__)
++   Pprintf(file, "No mallinfo on FreeBSD.  Sorry.\n");
+ #else
+    struct mallinfo minfo;
+    minfo = mallinfo();
diff --git a/science/cardioid/files/patch-simUtil_src_utilities.c b/science/cardioid/files/patch-simUtil_src_utilities.c
new file mode 100644
index 000000000000..7f058e25dbce
--- /dev/null
+++ b/science/cardioid/files/patch-simUtil_src_utilities.c
@@ -0,0 +1,22 @@
+--- simUtil/src/utilities.c.orig	2022-08-24 19:51:03 UTC
++++ simUtil/src/utilities.c
+@@ -72,6 +72,10 @@ void mem_debug(char *mem_str)
+    static int flag =1; 
+    if (flag) printf("No mallinfo on OS X.  Sorry no minfo for <%s>.\n",mem_str);
+    flag =0; 
++#elif defined(__FreeBSD__)
++   static int flag =1; 
++   if (flag) printf("No mallinfo on FreeBSD.  Sorry no minfo for <%s>.\n",mem_str);
++   flag =0; 
+ #else
+    static struct mallinfo old_minfo, minfo;
+    static int gstep = 0;
+@@ -98,7 +102,7 @@ void mem_debug(char *mem_str)
+ */
+ void CHKMEM(char *string)
+ {
+-#ifndef __APPLE__
++#if !defined(__APPLE__) && !defined(__FreeBSD__)
+ #include <sys/resource.h>
+ 	static struct mallinfo minfo, minfosave;
+ 	minfosave = minfo;
diff --git a/science/cardioid/pkg-descr b/science/cardioid/pkg-descr
new file mode 100644
index 000000000000..d8361d2e9d39
--- /dev/null
+++ b/science/cardioid/pkg-descr
@@ -0,0 +1,6 @@
+Cardioid is a cardiac multiscale simulation suite spanning from subcellular
+mechanisms up to simulations of organ-level clinical phenomena. The suite
+contains tools for simulating cardiac electrophysiology, cardiac mechanics,
+torso-ECGs, cardiac meshing and fiber generation tools.
+
+WWW: https://github.com/LLNL/cardioid