From ce51d125d9716a5af94b10de9ea7a3cbd140bf24 Mon Sep 17 00:00:00 2001 From: Anna Wellmann <a.wellmann@tu-braunschweig.de> Date: Tue, 23 Nov 2021 13:40:10 +0100 Subject: [PATCH] Fix bugs in config paths of apps MusselOyster --- apps/gpu/LBM/MusselOyster/MusselOyster.cpp | 15 +++++++-------- .../gpu/LBM/MusselOyster2x/MusselOyster2x.cpp | 19 ++++++++++--------- .../gpu/LBM/MusselOyster3z/MusselOyster3z.cpp | 8 +++++--- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp index 68a584167..5ca312470 100644 --- a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp +++ b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp @@ -470,13 +470,12 @@ int main( int argc, char* argv[]) { //str = static_cast<std::string>(argv[0]); - try - { + try { ////////////////////////////////////////////////////////////////////////// - std::string targetPath; + std::string targetPath; - targetPath = __FILE__; + targetPath = __FILE__; if (argc == 2) { configFile = argv[1]; @@ -489,16 +488,16 @@ int main( int argc, char* argv[]) targetPath = targetPath.substr(0, targetPath.find_last_of('/') + 1); #endif - std::cout << targetPath << std::endl; + std::cout << targetPath << std::endl; - if (configFile.size()==0) { + if (configFile.size() == 0) { configFile = targetPath + "configMusselOyster.txt"; } - multipleLevel(configFile); + multipleLevel(configFile); ////////////////////////////////////////////////////////////////////////// - } + } catch (const std::bad_alloc& e) { *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; diff --git a/apps/gpu/LBM/MusselOyster2x/MusselOyster2x.cpp b/apps/gpu/LBM/MusselOyster2x/MusselOyster2x.cpp index dadd433c9..ca8cba6c3 100644 --- a/apps/gpu/LBM/MusselOyster2x/MusselOyster2x.cpp +++ b/apps/gpu/LBM/MusselOyster2x/MusselOyster2x.cpp @@ -368,19 +368,16 @@ int main( int argc, char* argv[]) { //str = static_cast<std::string>(argv[0]); - try - { + try { ////////////////////////////////////////////////////////////////////////// - std::string targetPath; + std::string targetPath; - targetPath = __FILE__; + targetPath = __FILE__; if (argc == 2) { configFile = argv[1]; std::cout << "Using configFile command line argument: " << configFile << std::endl; - } else { - configFile = targetPath + "configMusselOyster.txt"; } #ifdef _WIN32 @@ -389,12 +386,16 @@ int main( int argc, char* argv[]) targetPath = targetPath.substr(0, targetPath.find_last_of('/') + 1); #endif - std::cout << targetPath << std::endl; + std::cout << targetPath << std::endl; + + if (configFile.size() == 0) { + configFile = targetPath + "configMusselOyster.txt"; + } - multipleLevel(configFile); + multipleLevel(configFile); ////////////////////////////////////////////////////////////////////////// - } + } catch (const std::bad_alloc& e) { *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; diff --git a/apps/gpu/LBM/MusselOyster3z/MusselOyster3z.cpp b/apps/gpu/LBM/MusselOyster3z/MusselOyster3z.cpp index 577d217e6..0bc6d2e87 100644 --- a/apps/gpu/LBM/MusselOyster3z/MusselOyster3z.cpp +++ b/apps/gpu/LBM/MusselOyster3z/MusselOyster3z.cpp @@ -380,9 +380,7 @@ int main( int argc, char* argv[]) if (argc == 2) { configFile = argv[1]; std::cout << "Using configFile command line argument: " << configFile << std::endl; - } else { - configFile = targetPath + "configMusselOyster.txt"; - } + } #ifdef _WIN32 targetPath = targetPath.substr(0, targetPath.find_last_of('\\') + 1); @@ -392,6 +390,10 @@ int main( int argc, char* argv[]) std::cout << targetPath << std::endl; + if (configFile.size() == 0) { + configFile = targetPath + "configMusselOyster.txt"; + } + multipleLevel(configFile); ////////////////////////////////////////////////////////////////////////// -- GitLab