aboutsummaryrefslogtreecommitdiff
path: root/science
diff options
context:
space:
mode:
Diffstat (limited to 'science')
-rw-r--r--science/Makefile1
-rw-r--r--science/opensph/Makefile33
-rw-r--r--science/opensph/distinfo3
-rw-r--r--science/opensph/files/patch-gui_objects_Palette.cpp42
-rw-r--r--science/opensph/files/patch-lib_math_MathUtils.h10
-rw-r--r--science/opensph/files/patch-lib_objects_geometry_Generic.h10
-rw-r--r--science/opensph/files/patch-lib_system_Platform.cpp57
-rw-r--r--science/opensph/pkg-descr7
8 files changed, 163 insertions, 0 deletions
diff --git a/science/Makefile b/science/Makefile
index a93989fd54aa..0e6c6969f8df 100644
--- a/science/Makefile
+++ b/science/Makefile
@@ -174,6 +174,7 @@
SUBDIR += openkim
SUBDIR += openmx
SUBDIR += opensim-core
+ SUBDIR += opensph
SUBDIR += opsin
SUBDIR += p5-Algorithm-SVMLight
SUBDIR += p5-Chemistry-3DBuilder
diff --git a/science/opensph/Makefile b/science/opensph/Makefile
new file mode 100644
index 000000000000..20eca4a14da3
--- /dev/null
+++ b/science/opensph/Makefile
@@ -0,0 +1,33 @@
+# $FreeBSD$
+
+PORTNAME= OpenSPH
+DISTVERSIONPREFIX= v
+DISTVERSION= g20190519
+CATEGORIES= science
+
+MAINTAINER= yuri@FreeBSD.org
+COMMENT= Library and graphical tools for running SPH and N-body simulations
+
+LICENSE= MIT
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+LIB_DEPENDS= libwx_baseu-3.1.so:x11-toolkits/wxgtk31
+
+USES= compiler:c++14-lang eigen:3 qmake qt:5
+USE_GITLAB= yes
+GL_SITE= https://gitlab.com
+GL_ACCOUNT= sevecekp
+GL_PROJECT= sph
+GL_COMMIT= 06686fa7f7307bdf8c9261e55b9875aafa278a13
+
+QMAKE_SOURCE_PATH= ${WRKSRC}/sph.pro
+
+BINARY_ALIAS= wx-config=${LOCALBASE}/bin/wxgtk3u-3.1-config
+
+PLIST_FILES= bin/opensph-cli bin/opensph
+
+do-install: # https://gitlab.com/sevecekp/sph/issues/2
+ ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/cli/launcher/launcher ${STAGEDIR}${PREFIX}/bin/opensph-cli
+ ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/gui/launcherGui/launcherGui ${STAGEDIR}${PREFIX}/bin/opensph
+
+.include <bsd.port.mk>
diff --git a/science/opensph/distinfo b/science/opensph/distinfo
new file mode 100644
index 000000000000..de94f946f496
--- /dev/null
+++ b/science/opensph/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1558839946
+SHA256 (sevecekp-sph-06686fa7f7307bdf8c9261e55b9875aafa278a13_GL0.tar.gz) = c8566141a37461a7445149c7460c6ef8daf630a75a755c7567761d2bb4ea6acc
+SIZE (sevecekp-sph-06686fa7f7307bdf8c9261e55b9875aafa278a13_GL0.tar.gz) = 21945021
diff --git a/science/opensph/files/patch-gui_objects_Palette.cpp b/science/opensph/files/patch-gui_objects_Palette.cpp
new file mode 100644
index 000000000000..6ecabe9f54f3
--- /dev/null
+++ b/science/opensph/files/patch-gui_objects_Palette.cpp
@@ -0,0 +1,42 @@
+--- gui/objects/Palette.cpp.orig 2019-05-26 03:22:37 UTC
++++ gui/objects/Palette.cpp
+@@ -2,6 +2,7 @@
+ #include "io/Path.h"
+ #include "objects/utility/StringUtils.h"
+ #include <fstream>
++#include <cmath>
+
+ NAMESPACE_SPH_BEGIN
+
+@@ -41,12 +42,12 @@ float Palette::paletteToLinear(const float value) cons
+ case PaletteScale::LINEAR:
+ return value;
+ case PaletteScale::LOGARITHMIC:
+- return exp10(value);
++ return std::pow(10.,value);
+ case PaletteScale::HYBRID:
+ if (value > 1.f) {
+- return exp10(value - 1.f);
++ return std::pow(10.,value - 1.f);
+ } else if (value < -1.f) {
+- return -exp10(-value - 1.f);
++ return -std::pow(10.,-value - 1.f);
+ } else {
+ return value;
+ }
+@@ -142,12 +143,12 @@ float Palette::relativeToPalette(const float value) co
+ case PaletteScale::LINEAR:
+ return interpol;
+ case PaletteScale::LOGARITHMIC:
+- return exp10(interpol);
++ return std::pow(10.,interpol);
+ case PaletteScale::HYBRID:
+ if (interpol > 1.f) {
+- return exp10(interpol - 1.f);
++ return std::pow(10.,interpol - 1.f);
+ } else if (interpol < -1.f) {
+- return -exp10(-interpol - 1.f);
++ return -std::pow(10.,-interpol - 1.f);
+ } else {
+ return interpol;
+ }
diff --git a/science/opensph/files/patch-lib_math_MathUtils.h b/science/opensph/files/patch-lib_math_MathUtils.h
new file mode 100644
index 000000000000..dd2147e2431f
--- /dev/null
+++ b/science/opensph/files/patch-lib_math_MathUtils.h
@@ -0,0 +1,10 @@
+--- lib/math/MathUtils.h.orig 2019-05-26 03:08:36 UTC
++++ lib/math/MathUtils.h
+@@ -11,6 +11,7 @@
+ #include <limits>
+ #include <math.h>
+ #include <utility>
++#include <cmath>
+
+ NAMESPACE_SPH_BEGIN
+
diff --git a/science/opensph/files/patch-lib_objects_geometry_Generic.h b/science/opensph/files/patch-lib_objects_geometry_Generic.h
new file mode 100644
index 000000000000..614a637a93bb
--- /dev/null
+++ b/science/opensph/files/patch-lib_objects_geometry_Generic.h
@@ -0,0 +1,10 @@
+--- lib/objects/geometry/Generic.h.orig 2019-05-26 03:09:40 UTC
++++ lib/objects/geometry/Generic.h
+@@ -7,6 +7,7 @@
+
+ #include "objects/containers/StaticArray.h"
+ #include <math.h>
++#include <cmath>
+
+ NAMESPACE_SPH_BEGIN
+
diff --git a/science/opensph/files/patch-lib_system_Platform.cpp b/science/opensph/files/patch-lib_system_Platform.cpp
new file mode 100644
index 000000000000..ecc72a8068fc
--- /dev/null
+++ b/science/opensph/files/patch-lib_system_Platform.cpp
@@ -0,0 +1,57 @@
+--- lib/system/Platform.cpp.orig 2019-05-26 03:11:41 UTC
++++ lib/system/Platform.cpp
+@@ -8,14 +8,14 @@
+ #include <string.h>
+ #include <sys/stat.h>
+ #include <sys/times.h>
+-#include <sys/vtimes.h>
++//#include <sys/vtimes.h>
+ #include <unistd.h>
+
+ NAMESPACE_SPH_BEGIN
+
+ Expected<Path> getExecutablePath() {
+ char result[PATH_MAX];
+- ssize_t count = readlink("/proc/self/exe", result, PATH_MAX);
++ ssize_t count = readlink("/proc/curproc/file", result, PATH_MAX);
+ if (count != -1) {
+ Path path(result);
+ return path.parentPath();
+@@ -103,14 +103,18 @@ class CpuUsage { (private)
+
+ public:
+ CpuUsage() {
++#if !defined(__FreeBSD__)
+ FILE* file;
++#endif
+ struct tms timeSample;
++#if !defined(__FreeBSD__)
+ char line[128];
++#endif
+
+ lastCpu = times(&timeSample);
+ lastSysCpu = timeSample.tms_stime;
+ lastUserCpu = timeSample.tms_utime;
+-
++#if !defined(__FreeBSD__)
+ file = fopen("/proc/cpuinfo", "r");
+ numProcessors = 0;
+ while (fgets(line, 128, file) != NULL) {
+@@ -118,6 +122,8 @@ class CpuUsage { (private)
+ numProcessors++;
+ }
+ fclose(file);
++#endif
++ numProcessors = 8; // TODO
+ }
+
+ Optional<Float> getUsage() {
+@@ -151,7 +157,7 @@ bool isDebuggerPresent() {
+ char buf[1024];
+ bool debuggerPresent = false;
+
+- int status_fd = open("/proc/self/status", O_RDONLY);
++ int status_fd = open("/proc/curproc/status", O_RDONLY);
+ if (status_fd == -1) {
+ return false;
+ }
diff --git a/science/opensph/pkg-descr b/science/opensph/pkg-descr
new file mode 100644
index 000000000000..3fb67d1dfdcb
--- /dev/null
+++ b/science/opensph/pkg-descr
@@ -0,0 +1,7 @@
+OpenSPH is an integrator of hydrodynamic equations using SPH discretization in
+space, currently specialized on simulations of asteroid impacts. The code is
+being developed on Astronomical Institute of Charles University in Prague. It
+aims to provide a fast, versatile and easily extensible SPH solver utilizing
+modern CPU features (SSE/AVX instruction sets).
+
+WWW: https://gitlab.com/sevecekp/sph