- Fix underlinkage of libraries - Use unified diffs for patches - Remove need for Sample apps wrapper scripts, add 0001-Add-default-for-WM5_PATH.patch - Clean up specfile OBS-URL: https://build.opensuse.org/request/show/999686 OBS-URL: https://build.opensuse.org/package/show/science/wildmagic5?expand=0&rev=2
107 lines
3.6 KiB
Diff
107 lines
3.6 KiB
Diff
From e084fb5b39e13a3809cac39ede4542a065fe348f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
|
|
Date: Sun, 28 Aug 2022 15:52:12 +0200
|
|
Subject: [PATCH] Fix output files
|
|
|
|
Save output data files to CWD instead of readonly data dir
|
|
---
|
|
.../SimplePendulum/SimplePendulum.cpp | 26 +++++++++----------
|
|
1 file changed, 12 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/WildMagic5/SamplePhysics/SimplePendulum/SimplePendulum.cpp b/WildMagic5/SamplePhysics/SimplePendulum/SimplePendulum.cpp
|
|
index eb4da8e..dd4f626 100644
|
|
--- a/WildMagic5/SamplePhysics/SimplePendulum/SimplePendulum.cpp
|
|
+++ b/WildMagic5/SamplePhysics/SimplePendulum/SimplePendulum.cpp
|
|
@@ -131,8 +131,7 @@ void SimplePendulum::SolveMethod (float* (*method)(float,float,float),
|
|
float h = 0.1f;
|
|
|
|
float* output = method(x0, y0, h);
|
|
- std::string path = Environment::GetPathW(outText);
|
|
- std::ofstream outFile(path.c_str());
|
|
+ std::ofstream outFile(outText);
|
|
int i;
|
|
for (i = 0; i < SIZE; ++i)
|
|
{
|
|
@@ -156,8 +155,7 @@ void SimplePendulum::SolveMethod (float* (*method)(float,float,float),
|
|
iY0 = iY1;
|
|
}
|
|
|
|
- path = Environment::GetPathW(outImage);
|
|
- msImage->Save(path.c_str());
|
|
+ msImage->Save(outImage);
|
|
|
|
delete1(output);
|
|
}
|
|
@@ -197,7 +195,7 @@ void SimplePendulum::Stiff1 ()
|
|
y0 = y1;
|
|
}
|
|
|
|
- std::string path = Environment::GetPathW("Data/stiff1.txt");
|
|
+ std::string path = "stiff1.txt";
|
|
std::ofstream outFile(path.c_str());
|
|
for (i = 0; i < maxIterations; ++i)
|
|
{
|
|
@@ -222,7 +220,7 @@ void SimplePendulum::Stiff1 ()
|
|
iY0 = iY1;
|
|
}
|
|
|
|
- path = Environment::GetPathW("Data/stiff1_true.im");
|
|
+ path = "stiff1_true.im";
|
|
msImage->Save(path.c_str());
|
|
|
|
// Set image to white.
|
|
@@ -243,7 +241,7 @@ void SimplePendulum::Stiff1 ()
|
|
iY0 = iY1;
|
|
}
|
|
|
|
- path = Environment::GetPathW("Data/stiff1_appr.im");
|
|
+ path = "stiff1_appr.im";
|
|
msImage->Save(path.c_str());
|
|
|
|
delete1(approx);
|
|
@@ -267,7 +265,7 @@ void SimplePendulum::Stiff2True ()
|
|
float t0 = 0.0f;
|
|
|
|
// true solution
|
|
- std::string path = Environment::GetPathW("Data/stiff2_true.txt");
|
|
+ std::string path = "stiff2_true.txt";
|
|
std::ofstream outFile(path.c_str());
|
|
char message[512];
|
|
const int maxIterations = 20;
|
|
@@ -326,7 +324,7 @@ void SimplePendulum::Stiff2Approximate ()
|
|
t0 += h;
|
|
}
|
|
|
|
- std::string path = Environment::GetPathW("Data/stiff2_appr_h0.05.txt");
|
|
+ std::string path = "stiff2_appr_h0.05.txt";
|
|
std::ofstream outFile(path.c_str());
|
|
char message[512];
|
|
for (i = 0; i <= maxIterations; ++i)
|
|
@@ -374,7 +372,7 @@ void SimplePendulum::Stiff2Approximate ()
|
|
t0 += h;
|
|
}
|
|
|
|
- path = Environment::GetPathW("Data/stiff2_appr_h0.10.txt");
|
|
+ path = "stiff2_appr_h0.10.txt";
|
|
outFile.open(path.c_str());
|
|
for (i = 0; i <= maxIterations/2; ++i)
|
|
{
|
|
@@ -392,10 +390,10 @@ int SimplePendulum::Main (int, char**)
|
|
{
|
|
msImage = new0 ImageRGB82D(SIZE, SIZE);
|
|
|
|
- SolveMethod(ExplicitEuler, "Data/explicit.im", "Data/explicit.txt");
|
|
- SolveMethod(ImplicitEuler, "Data/implicit.im", "Data/implicit.txt");
|
|
- SolveMethod(RungeKutta, "Data/runge.im", "Data/runge.txt");
|
|
- SolveMethod(LeapFrog, "Data/leapfrog.im", "Data/leapfrog.txt");
|
|
+ SolveMethod(ExplicitEuler, "explicit.im", "explicit.txt");
|
|
+ SolveMethod(ImplicitEuler, "implicit.im", "implicit.txt");
|
|
+ SolveMethod(RungeKutta, "runge.im", "runge.txt");
|
|
+ SolveMethod(LeapFrog, "leapfrog.im", "leapfrog.txt");
|
|
Stiff1();
|
|
Stiff2True();
|
|
Stiff2Approximate();
|
|
--
|
|
2.37.1
|
|
|