1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-05 01:55:52 +00:00

New port: science/opensph: Library and graphical tools for running SPH and N-body simulations

This commit is contained in:
Yuri Victorovich 2019-05-26 04:08:09 +00:00
parent add8bda17f
commit 62e00b1db5
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=502676
8 changed files with 163 additions and 0 deletions

View File

@ -174,6 +174,7 @@
SUBDIR += openkim
SUBDIR += openmx
SUBDIR += opensim-core
SUBDIR += opensph
SUBDIR += opsin
SUBDIR += p5-Algorithm-SVMLight
SUBDIR += p5-Chemistry-3DBuilder

33
science/opensph/Makefile Normal file
View File

@ -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>

3
science/opensph/distinfo Normal file
View File

@ -0,0 +1,3 @@
TIMESTAMP = 1558839946
SHA256 (sevecekp-sph-06686fa7f7307bdf8c9261e55b9875aafa278a13_GL0.tar.gz) = c8566141a37461a7445149c7460c6ef8daf630a75a755c7567761d2bb4ea6acc
SIZE (sevecekp-sph-06686fa7f7307bdf8c9261e55b9875aafa278a13_GL0.tar.gz) = 21945021

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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