Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:redwil:15.4
wildmagic5
wildmagic5-fix-SimplePendulum_output_files.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File wildmagic5-fix-SimplePendulum_output_files.patch of Package wildmagic5
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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor