From bd012f8ced8c134c42e901fed93a06765b49215b Mon Sep 17 00:00:00 2001 From: Soeren Peters <peters@irmb.tu-bs.de> Date: Thu, 8 Jul 2021 10:54:29 +0200 Subject: [PATCH] Adapt WTG_RUB main to new config reader --- apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp | 41 +++++++-------------- apps/gpu/LBM/WTG_RUB/configDrivenCavity.txt | 1 + 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp b/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp index 2528cd00a..2263bf9ff 100644 --- a/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp +++ b/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp @@ -7,6 +7,7 @@ #include <fstream> #include <exception> #include <memory> +#include <filesystem> #include "mpi.h" @@ -16,13 +17,13 @@ #include "PointerDefinitions.h" #include "Core/LbmOrGks.h" -#include "Core/Input/Input.h" #include "Core/StringUtilities/StringUtil.h" -#include "Core/Input/ConfigFileReader/ConfigFileReader.h" #include "Core/VectorTypes.h" #include "Core/Logger/Logger.h" +#include <basics/config/ConfigurationFile.h> + ////////////////////////////////////////////////////////////////////////// #include "GridGenerator/grid/GridBuilder/LevelGridBuilder.h" @@ -111,12 +112,6 @@ void multipleLevel(const std::string& configPath) gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - - vf::gpu::Communicator* comm = vf::gpu::Communicator::getInstanz(); - SPtr<ConfigFileReader> configReader = ConfigFileReader::getNewInstance(); - - std::cout << configPath << std::endl; - SPtr<ConfigData> configData = configReader->readConfigFile(configPath.c_str()); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -194,7 +189,12 @@ void multipleLevel(const std::string& configPath) //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - SPtr<Parameter> para = Parameter::make(configData, comm); + vf::gpu::Communicator* comm = vf::gpu::Communicator::getInstanz(); + + vf::basics::ConfigurationFile config; + config.load(configPath); + + SPtr<Parameter> para = std::make_shared<Parameter>(config, comm->getNummberOfProcess(), comm->getPID()); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// const real velocityLB = (real)0.0844; // LB units @@ -583,29 +583,16 @@ std::string chooseVariation() int main( int argc, char* argv[]) { MPI_Init(&argc, &argv); - std::string str, str2; if ( argv != NULL ) { - //str = static_cast<std::string>(argv[0]); - try { - ////////////////////////////////////////////////////////////////////////// - - std::string targetPath; - - targetPath = __FILE__; + // assuming that the config files is stored parallel to this file. + std::filesystem::path filePath = __FILE__; + filePath.replace_filename("configDrivenCavity.txt"); - targetPath = targetPath.substr(0, targetPath.find_last_of('/') + 1); - - - - std::cout << targetPath << std::endl; - - multipleLevel(targetPath + "configDrivenCavity.txt"); - - ////////////////////////////////////////////////////////////////////////// - } + multipleLevel(filePath.string()); + } catch (const std::bad_alloc& e) { *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; diff --git a/apps/gpu/LBM/WTG_RUB/configDrivenCavity.txt b/apps/gpu/LBM/WTG_RUB/configDrivenCavity.txt index a3d6622d5..f6ff6c107 100644 --- a/apps/gpu/LBM/WTG_RUB/configDrivenCavity.txt +++ b/apps/gpu/LBM/WTG_RUB/configDrivenCavity.txt @@ -9,6 +9,7 @@ ################################################## #Path="E:/DrivenCavity/results" #Path="F:/Work/Computations/out/DrivenCavity/" +Path="/" #Prefix="DrivenCavity" #WriteGrid=true ################################################## -- GitLab