diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp b/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp index 5a1ad9800262a12cc8a21a93f6f04c601fd98323..acab426b4868cc736710c883776c5626ec6b5753 100755 --- a/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp +++ b/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp @@ -60,7 +60,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void multipleLevel(vf::basics::ConfigurationFile& config) +void runVirtualFluids(const vf::basics::ConfigurationFile& config) { vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); @@ -516,8 +516,9 @@ int main(int argc, char *argv[]) if (argv != NULL) { try { + VF_LOG_TRACE("For the default config path to work, execute the app from the project root."); vf::basics::ConfigurationFile config = vf::basics::ConfigurationFile::loadConfig(argc, argv, "./apps/gpu/LBM/DrivenCavityMultiGPU/configDrivenCavityMultiGPU.txt"); - multipleLevel(config); + runVirtualFluids(config); ////////////////////////////////////////////////////////////////////////// } catch (const spdlog::spdlog_ex &ex) { diff --git a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp index 5b6456c499b62af04615e4d708f895acae161236..b583633b50542795fe4b27aca42c08cca1a5331c 100644 --- a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp +++ b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp @@ -84,7 +84,7 @@ const std::string simulationName("MusselOyster"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void multipleLevel(vf::basics::ConfigurationFile& config) +void runVirtualFluids(const vf::basics::ConfigurationFile& config) { vf::gpu::Communicator &communicator = vf::gpu::Communicator::getInstance(); @@ -583,8 +583,9 @@ int main(int argc, char *argv[]) if (argv != NULL) { try { + VF_LOG_TRACE("For the default config path to work, execute the app from the project root."); vf::basics::ConfigurationFile config = vf::basics::ConfigurationFile::loadConfig(argc, argv, "./apps/gpu/LBM/MusselOyster/configMusselOyster.txt"); - multipleLevel(config); + runVirtualFluids(config); ////////////////////////////////////////////////////////////////////////// } catch (const spdlog::spdlog_ex &ex) { diff --git a/apps/gpu/LBM/SphereGPU/Sphere.cpp b/apps/gpu/LBM/SphereGPU/Sphere.cpp index 3c4a7fb92e8299454402cb927e7f03f71bcf09fd..707c3ab9cb7de038a94010e69e6f77f9799b4f7f 100644 --- a/apps/gpu/LBM/SphereGPU/Sphere.cpp +++ b/apps/gpu/LBM/SphereGPU/Sphere.cpp @@ -102,6 +102,7 @@ int main(int argc, char *argv[]) GridScalingFactory scalingFactory = GridScalingFactory(); vf::basics::ConfigurationFile config; if (useConfigFile) { + VF_LOG_TRACE("For the default config path to work, execute the app from the project root."); vf::basics::ConfigurationFile config = vf::basics::ConfigurationFile::loadConfig(argc, argv, "./apps/gpu/LBM/SphereGPU/config.txt"); para = std::make_shared<Parameter>(&config); } else { diff --git a/apps/gpu/LBM/SphereScaling/SphereScaling.cpp b/apps/gpu/LBM/SphereScaling/SphereScaling.cpp index d7b6ddbe808b507a39a84ce3dfe5b0a347c0fcc4..da80302e9e9b5b6f43c7eb3eea0ae8be08f22b93 100755 --- a/apps/gpu/LBM/SphereScaling/SphereScaling.cpp +++ b/apps/gpu/LBM/SphereScaling/SphereScaling.cpp @@ -63,7 +63,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void multipleLevel(vf::basics::ConfigurationFile& config) +void runVirtualFluids(const vf::basics::ConfigurationFile& config) { vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); @@ -657,8 +657,9 @@ int main(int argc, char *argv[]) if (argv != NULL) { try { + VF_LOG_INFO("For the default config path to work, execute the app from the project root."); vf::basics::ConfigurationFile config = vf::basics::ConfigurationFile::loadConfig(argc, argv, "./apps/gpu/LBM/SphereScaling/config.txt"); - multipleLevel(config); + runVirtualFluids(config); ////////////////////////////////////////////////////////////////////////// } catch (const spdlog::spdlog_ex &ex) { diff --git a/src/basics/config/ConfigurationFile.cpp b/src/basics/config/ConfigurationFile.cpp index 6e6ba21c0cec5de886b6ad125a662adacb9f1654..547468cd2fd6aadccbdc5017230fcf6cdb803733 100644 --- a/src/basics/config/ConfigurationFile.cpp +++ b/src/basics/config/ConfigurationFile.cpp @@ -8,6 +8,7 @@ #include <fstream> #include <iostream> #include <stdlib.h> +#include <filesystem> #include <basics/utilities/UbException.h> @@ -26,7 +27,7 @@ bool ConfigurationFile::load(const std::string& file) if (!inFile.good()) { - UB_THROW(UbException(UB_EXARGS, "Cannot read configuration file "+file+"!")); + UB_THROW(UbException(UB_EXARGS, "Cannot read configuration file " + file + "! Your current directory is " + std::filesystem::current_path().string() + ".")); } while (inFile.good() && ! inFile.eof()) diff --git a/src/basics/config/ConfigurationFile.h b/src/basics/config/ConfigurationFile.h index aed29f31efd21077e9ceb1bd979020087f9b8909..8ca12306e0ef321832efb19a2a428e6dc753df41 100644 --- a/src/basics/config/ConfigurationFile.h +++ b/src/basics/config/ConfigurationFile.h @@ -70,20 +70,20 @@ public: template<class T> T getValue(const std::string& key, T defaultValue) const; - static ConfigurationFile loadConfig(int argc, char *argv[], std::filesystem::path configPath = "./config.txt") + static ConfigurationFile loadConfig(int argc, char *argv[], std::string configPath = "./config.txt") { // the config file's default path can be replaced by passing a command line argument if (argc > 1) { configPath = argv[1]; - VF_LOG_INFO("Using command line argument for config path: {}", configPath.string()); + VF_LOG_INFO("Using command line argument for config path: {}", configPath); } else { - VF_LOG_INFO("Using default config path: {}", configPath.string()); + VF_LOG_INFO("Using default config path: {}", configPath); } vf::basics::ConfigurationFile config; - config.load(configPath.string()); + config.load(configPath); return config; }