From 9501798e9efe573393a73817b7976fdc1fd517fe Mon Sep 17 00:00:00 2001 From: Soeren Peters <peters@irmb.tu-bs.de> Date: Thu, 13 Apr 2023 10:52:58 +0000 Subject: [PATCH] Remove old logger from basics --- apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp | 6 - apps/gpu/LBM/Basel/main.cpp | 23 +--- apps/gpu/LBM/BaselMultiGPU/main.cpp | 22 +-- apps/gpu/LBM/BaselNU/main.cpp | 22 +-- apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp | 6 - apps/gpu/LBM/ChannelFlow/ChannelFlow.cpp | 10 +- apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp | 10 -- .../DrivenCavityMultiGPU.cpp | 5 - .../LBM/DrivenCavityUniform/DrivenCavity.cpp | 11 +- apps/gpu/LBM/MusselOyster/MusselOyster.cpp | 5 - apps/gpu/LBM/SphereGPU/Sphere.cpp | 11 +- apps/gpu/LBM/SphereScaling/SphereScaling.cpp | 5 - apps/gpu/LBM/TGV_3D/TGV_3D.cpp | 27 +--- .../gpu/LBM/TGV_3D_GridRef/TGV_3D_GridRef.cpp | 18 +-- .../LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp | 11 -- apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp | 11 +- .../LBM/gridGeneratorTest/gridGenerator.cpp | 16 +-- apps/gpu/LBM/lbmTest/main.cpp | 25 +--- apps/gpu/LBM/metisTest/main.cpp | 23 +--- src/basics/Core/Logger/Logger.cpp | 92 ------------- src/basics/Core/Logger/Logger.h | 88 ------------ .../Core/Logger/implementations/LoggerImp.cpp | 126 ------------------ .../Core/Logger/implementations/LoggerImp.h | 75 ----------- .../Logger/implementations/LoggerTest.cpp | 65 --------- src/gpu/GridGenerator/CMakeLists.txt | 2 +- .../geometries/Conglomerate/Conglomerate.cpp | 2 +- .../TriangularMesh/TriangularMesh.cpp | 9 +- .../TriangularMesh/TriangularMeshStrategy.cpp | 7 +- src/gpu/GridGenerator/global.h | 2 +- .../grid/GridBuilder/LevelGridBuilder.cpp | 24 ++-- .../grid/GridBuilder/MultipleGridBuilder.cpp | 17 ++- src/gpu/GridGenerator/grid/GridImp.cpp | 53 +++----- src/gpu/GridGenerator/grid/GridImpTest.cpp | 6 - .../io/GridVTKWriter/GridVTKWriter.cpp | 12 +- src/gpu/GridGenerator/io/QLineWriter.cpp | 2 +- .../io/STLReaderWriter/STLReader.cpp | 34 ++--- .../io/STLReaderWriter/STLWriter.cpp | 6 +- .../SimulationFileWriter.cpp | 12 +- .../GridReaderFiles/GridReader.cpp | 2 +- .../GridReaderGenerator/GridGenerator.cpp | 78 +++++------ .../GridReaderGenerator/GridGeneratorTest.cpp | 3 - .../IndexRearrangementForStreamsTest.cpp | 8 -- .../GPU/EnstrophyAnalyzer.cu | 2 - .../GPU/KineticEnergyAnalyzer.cu | 2 - 44 files changed, 148 insertions(+), 848 deletions(-) delete mode 100644 src/basics/Core/Logger/Logger.cpp delete mode 100644 src/basics/Core/Logger/Logger.h delete mode 100644 src/basics/Core/Logger/implementations/LoggerImp.cpp delete mode 100644 src/basics/Core/Logger/implementations/LoggerImp.h delete mode 100644 src/basics/Core/Logger/implementations/LoggerTest.cpp diff --git a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp index f6b152890..6548ac74b 100644 --- a/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp +++ b/apps/gpu/LBM/ActuatorLine/ActuatorLine.cpp @@ -107,12 +107,6 @@ std::string simulationName("ActuatorLine"); void multipleLevel(const std::string& configPath) { - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); auto gridFactory = GridFactory::make(); diff --git a/apps/gpu/LBM/Basel/main.cpp b/apps/gpu/LBM/Basel/main.cpp index c541d010e..b04e3c9d9 100644 --- a/apps/gpu/LBM/Basel/main.cpp +++ b/apps/gpu/LBM/Basel/main.cpp @@ -60,17 +60,6 @@ void multipleLevel(const std::string& configPath) { - //std::ofstream logFile( "F:/Work/Computations/gridGenerator/grid/gridGeneratorLog.txt" ); - //std::ofstream logFile("F:/Basel2019/log/gridGeneratorLog.txt"); - //logging::Logger::addStream(&logFile); - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - - //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); - auto gridFactory = GridFactory::make(); gridFactory->setGridStrategy(Device::CPU); //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); @@ -229,7 +218,6 @@ int main(int argc, char* argv[]) } catch (const std::exception& e) { - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) @@ -249,22 +237,17 @@ int main(int argc, char* argv[]) } catch (const std::exception& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (const std::bad_alloc e) { - - *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) { - *logging::out << logging::Logger::LOGGER_ERROR << "Unknown exception!\n"; - //std::cout << "unknown exeption" << std::endl; + std::cout << "unknown exeption" << std::endl; } std::cout << "\nConfiguration file must be set!: lbmgm <config file>" << std::endl << std::flush; diff --git a/apps/gpu/LBM/BaselMultiGPU/main.cpp b/apps/gpu/LBM/BaselMultiGPU/main.cpp index a18b663ea..3a98079a0 100644 --- a/apps/gpu/LBM/BaselMultiGPU/main.cpp +++ b/apps/gpu/LBM/BaselMultiGPU/main.cpp @@ -57,14 +57,6 @@ void multipleLevel(const std::string& configPath) { - //std::ofstream logFile( "F:/Work/Computations/gridGenerator/grid/gridGeneratorLog.txt" ); - //std::ofstream logFile( "grid/gridGeneratorLog.txt" ); - //logging::Logger::addStream(&logFile); - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); @@ -95,8 +87,6 @@ void multipleLevel(const std::string& configPath) logFile2.open(gridpath + std::to_string(generatePart) + "/gridGeneratorLog.txt");//Phoenix //logFile2.open(std::string("M:/Basel2019/grids4/") + std::to_string(generatePart) + "/gridGeneratorLog.txt");//Baumbart - logging::Logger::addStream(&logFile2); - bool useGridGenerator = false; if(useGridGenerator){ @@ -249,7 +239,6 @@ int main( int argc, char* argv[]) } catch (const std::exception& e) { - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) @@ -268,22 +257,17 @@ int main( int argc, char* argv[]) } catch (const std::exception& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (const std::bad_alloc e) { - - *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) { - *logging::out << logging::Logger::LOGGER_ERROR << "Unknown exception!\n"; - //std::cout << "unknown exeption" << std::endl; + std::cout << "unknown exeption" << std::endl; } std::cout << "\nConfiguration file must be set!: lbmgm <config file>" << std::endl << std::flush; diff --git a/apps/gpu/LBM/BaselNU/main.cpp b/apps/gpu/LBM/BaselNU/main.cpp index 69013d157..4e32b1925 100644 --- a/apps/gpu/LBM/BaselNU/main.cpp +++ b/apps/gpu/LBM/BaselNU/main.cpp @@ -57,16 +57,6 @@ void multipleLevel(const std::string& configPath) { - std::ofstream logFile("F:/Basel2019NU/grid/gridGeneratorLog.txt"); - logging::Logger::addStream(&logFile); - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - - //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); - auto gridFactory = GridFactory::make(); gridFactory->setGridStrategy(Device::CPU); //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); @@ -222,7 +212,6 @@ int main(int argc, char* argv[]) } catch (const std::exception& e) { - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) @@ -242,22 +231,17 @@ int main(int argc, char* argv[]) } catch (const std::exception& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (const std::bad_alloc e) { - - *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) { - *logging::out << logging::Logger::LOGGER_ERROR << "Unknown exception!\n"; - //std::cout << "unknown exeption" << std::endl; + std::cout << "unknown exeption" << std::endl; } std::cout << "\nConfiguration file must be set!: lbmgm <config file>" << std::endl << std::flush; diff --git a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp index dacb4e2f8..8e8d8b45f 100644 --- a/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp +++ b/apps/gpu/LBM/BoundaryLayer/BoundaryLayer.cpp @@ -105,12 +105,6 @@ using namespace vf::basics::constant; void multipleLevel(const std::string& configPath) { - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - auto gridFactory = GridFactory::make(); auto gridBuilder = MultipleGridBuilder::makeShared(gridFactory); diff --git a/apps/gpu/LBM/ChannelFlow/ChannelFlow.cpp b/apps/gpu/LBM/ChannelFlow/ChannelFlow.cpp index 80e104052..4a6a9bfa7 100644 --- a/apps/gpu/LBM/ChannelFlow/ChannelFlow.cpp +++ b/apps/gpu/LBM/ChannelFlow/ChannelFlow.cpp @@ -46,7 +46,7 @@ ////////////////////////////////////////////////////////////////////////// #include "Core/DataTypes.h" -#include "Core/Logger/Logger.h" +#include <logger/Logger.h> #include "Core/VectorTypes.h" #include "PointerDefinitions.h" #include "config/ConfigurationFile.h" @@ -109,14 +109,6 @@ int main(int argc, char *argv[]) // setup logger ////////////////////////////////////////////////////////////////////////// - std::ofstream logFile("output/log_process" + std::to_string(vf::gpu::Communicator::getInstance().getPID()) + - ".txt"); - logging::Logger::addStream(&logFile); - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - vf::logging::Logger::changeLogPath("output/vflog_process" + std::to_string(vf::gpu::Communicator::getInstance().getPID()) + ".txt"); vf::logging::Logger::initializeLogger(); diff --git a/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp b/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp index ae0e35991..31db786aa 100644 --- a/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp +++ b/apps/gpu/LBM/DrivenCavity/DrivenCavity.cpp @@ -42,7 +42,6 @@ ////////////////////////////////////////////////////////////////////////// #include "Core/DataTypes.h" -#include "Core/Logger/Logger.h" #include "Core/VectorTypes.h" #include "PointerDefinitions.h" @@ -91,15 +90,6 @@ int main() const uint timeStepOut = 1000; const uint timeStepEnd = 10000; - ////////////////////////////////////////////////////////////////////////// - // setup logger - ////////////////////////////////////////////////////////////////////////// - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - ////////////////////////////////////////////////////////////////////////// // setup gridGenerator ////////////////////////////////////////////////////////////////////////// diff --git a/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp b/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp index 7cf64f029..a6f50ae55 100755 --- a/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp +++ b/apps/gpu/LBM/DrivenCavityMultiGPU/DrivenCavityMultiGPU.cpp @@ -64,11 +64,6 @@ void multipleLevel(std::filesystem::path& configPath) { - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); auto gridFactory = GridFactory::make(); diff --git a/apps/gpu/LBM/DrivenCavityUniform/DrivenCavity.cpp b/apps/gpu/LBM/DrivenCavityUniform/DrivenCavity.cpp index c72de4999..f3002e833 100644 --- a/apps/gpu/LBM/DrivenCavityUniform/DrivenCavity.cpp +++ b/apps/gpu/LBM/DrivenCavityUniform/DrivenCavity.cpp @@ -42,7 +42,7 @@ ////////////////////////////////////////////////////////////////////////// #include "Core/DataTypes.h" -#include "Core/Logger/Logger.h" +#include <logger/Logger.h> #include "Core/VectorTypes.h" #include "PointerDefinitions.h" @@ -91,15 +91,6 @@ int main() const uint timeStepOut = 1000; const uint timeStepEnd = 10000; - ////////////////////////////////////////////////////////////////////////// - // setup logger - ////////////////////////////////////////////////////////////////////////// - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - ////////////////////////////////////////////////////////////////////////// // setup gridGenerator ////////////////////////////////////////////////////////////////////////// diff --git a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp index 40ecc2ef1..8a2d9bb1c 100644 --- a/apps/gpu/LBM/MusselOyster/MusselOyster.cpp +++ b/apps/gpu/LBM/MusselOyster/MusselOyster.cpp @@ -88,11 +88,6 @@ const std::string simulationName("MusselOyster"); void multipleLevel(std::filesystem::path &configPath) { - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - vf::gpu::Communicator &communicator = vf::gpu::Communicator::getInstance(); auto gridFactory = GridFactory::make(); diff --git a/apps/gpu/LBM/SphereGPU/Sphere.cpp b/apps/gpu/LBM/SphereGPU/Sphere.cpp index 29cf169d4..b0ba87ff0 100644 --- a/apps/gpu/LBM/SphereGPU/Sphere.cpp +++ b/apps/gpu/LBM/SphereGPU/Sphere.cpp @@ -43,7 +43,7 @@ ////////////////////////////////////////////////////////////////////////// #include "Core/DataTypes.h" -#include "Core/Logger/Logger.h" +#include <logger/Logger.h> #include "Core/VectorTypes.h" #include "PointerDefinitions.h" #include "config/ConfigurationFile.h" @@ -94,15 +94,6 @@ int main(int argc, char *argv[]) const uint timeStepOut = 1000; const uint timeStepEnd = 10000; - ////////////////////////////////////////////////////////////////////////// - // setup logger - ////////////////////////////////////////////////////////////////////////// - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - ////////////////////////////////////////////////////////////////////////// // setup simulation parameters (with or without config file) ////////////////////////////////////////////////////////////////////////// diff --git a/apps/gpu/LBM/SphereScaling/SphereScaling.cpp b/apps/gpu/LBM/SphereScaling/SphereScaling.cpp index 8994453e5..ca26c4c76 100755 --- a/apps/gpu/LBM/SphereScaling/SphereScaling.cpp +++ b/apps/gpu/LBM/SphereScaling/SphereScaling.cpp @@ -67,11 +67,6 @@ void multipleLevel(std::filesystem::path& configPath) { - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); auto gridFactory = GridFactory::make(); diff --git a/apps/gpu/LBM/TGV_3D/TGV_3D.cpp b/apps/gpu/LBM/TGV_3D/TGV_3D.cpp index f7964f382..f3d1454a8 100644 --- a/apps/gpu/LBM/TGV_3D/TGV_3D.cpp +++ b/apps/gpu/LBM/TGV_3D/TGV_3D.cpp @@ -46,7 +46,7 @@ ////////////////////////////////////////////////////////////////////////// #include "Core/DataTypes.h" -#include "Core/Logger/Logger.h" +#include <logger/Logger.h> #include "Core/VectorTypes.h" #include "PointerDefinitions.h" @@ -133,15 +133,6 @@ std::string simulationName("TGV_3D"); void multipleLevel(const std::string& configPath) { - //std::ofstream logFile( "F:/Work/Computations/gridGenerator/grid/gridGeneratorLog.txt" ); - //std::ofstream logFile( "grid/gridGeneratorLog.txt" ); - //logging::Logger::addStream(&logFile); - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); @@ -170,9 +161,8 @@ void multipleLevel(const std::string& configPath) const real viscosity = nx / ( 2.0 * PI ) * velocity / Re; - *logging::out << logging::Logger::INFO_HIGH << "velocity = " << velocity << " s\n"; - - *logging::out << logging::Logger::INFO_HIGH << "viscosity = " << viscosity << "\n"; + VF_LOG_INFO("velocity = {}", velocity); + VF_LOG_INFO("viscosity = {}", viscosity); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -342,22 +332,17 @@ int main( int argc, char* argv[]) } catch (const std::bad_alloc& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (const std::exception& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) { - *logging::out << logging::Logger::LOGGER_ERROR << "Unknown exception!\n"; - //std::cout << "unknown exeption" << std::endl; + std::cout << "unknown exeption" << std::endl; } //std::cout << "\nConfiguration file must be set!: lbmgm <config file>" << std::endl << std::flush; diff --git a/apps/gpu/LBM/TGV_3D_GridRef/TGV_3D_GridRef.cpp b/apps/gpu/LBM/TGV_3D_GridRef/TGV_3D_GridRef.cpp index c8d8f166d..2ff220d67 100644 --- a/apps/gpu/LBM/TGV_3D_GridRef/TGV_3D_GridRef.cpp +++ b/apps/gpu/LBM/TGV_3D_GridRef/TGV_3D_GridRef.cpp @@ -46,7 +46,7 @@ ////////////////////////////////////////////////////////////////////////// #include "Core/DataTypes.h" -#include "Core/Logger/Logger.h" +#include <logger/Logger.h> #include "Core/VectorTypes.h" #include "PointerDefinitions.h" @@ -133,11 +133,6 @@ std::string simulationName("TGV_3D_Gridref_noSqPress"); void multipleLevel(const std::string& configPath) { - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); auto gridFactory = GridFactory::make(); @@ -352,22 +347,17 @@ int main( int argc, char* argv[]) } catch (const std::bad_alloc& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (const std::exception& e) { - - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) { - *logging::out << logging::Logger::LOGGER_ERROR << "Unknown exception!\n"; - //std::cout << "unknown exeption" << std::endl; + std::cout << "unknown exeption" << std::endl; } //std::cout << "\nConfiguration file must be set!: lbmgm <config file>" << std::endl << std::flush; diff --git a/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp b/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp index c36fc0cb3..64a375482 100644 --- a/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp +++ b/apps/gpu/LBM/TGV_3D_MultiGPU/TGV_3D_MultiGPU.cpp @@ -156,17 +156,6 @@ void multipleLevel(const std::string& configPath) rankY = ( mpirank % ( sideLengthX * sideLengthY ) ) / sideLengthX; rankZ = mpirank / ( sideLengthY * sideLengthX ); - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - logging::Logger::addStream(&std::cout); - - std::ofstream logFile( path + simulationName + "_rank_" + std::to_string(mpirank) + ".log" ); - logging::Logger::addStream(&logFile); - - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); diff --git a/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp b/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp index 25baf638d..13463d371 100644 --- a/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp +++ b/apps/gpu/LBM/WTG_RUB/WTG_RUB.cpp @@ -48,7 +48,7 @@ #include "Core/DataTypes.h" #include "PointerDefinitions.h" #include "Core/VectorTypes.h" -#include "Core/Logger/Logger.h" +#include <logger/Logger.h> ////////////////////////////////////////////////////////////////////////// @@ -130,11 +130,6 @@ std::string chooseVariation(); void multipleLevel(const std::string& configPath) { - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - vf::gpu::Communicator& communicator = vf::gpu::Communicator::getInstance(); auto gridFactory = GridFactory::make(); @@ -233,8 +228,8 @@ void multipleLevel(const std::string& configPath) //const real vx = velocityLB / (real)sqrt(2.0); // LB units //const real vy = velocityLB / (real)sqrt(2.0); // LB units - *logging::out << logging::Logger::INFO_HIGH << "velocity [dx/dt] = " << velocityLB << " \n"; - *logging::out << logging::Logger::INFO_HIGH << "viscosity [dx^2/dt] = " << viscosityLB << "\n"; + VF_LOG_INFO("velocityLB [dx/dt] = " << velocityLB); + VF_LOG_INFO("viscosityLB [dx^2/dt] = " << viscosityLB); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/apps/gpu/LBM/gridGeneratorTest/gridGenerator.cpp b/apps/gpu/LBM/gridGeneratorTest/gridGenerator.cpp index 4552d4997..fe2835547 100644 --- a/apps/gpu/LBM/gridGeneratorTest/gridGenerator.cpp +++ b/apps/gpu/LBM/gridGeneratorTest/gridGenerator.cpp @@ -58,17 +58,6 @@ void multipleLevel(const std::string& configPath) { - std::ofstream logFile( "F:/Work/Computations/out/Sphere/gridGeneratorLog.txt" ); - //std::ofstream logFile( "grid/gridGeneratorLog.txt" ); - logging::Logger::addStream(&logFile); - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - - //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); - auto gridFactory = GridFactory::make(); //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); @@ -672,7 +661,6 @@ void multipleLevel(const std::string& configPath) logFile2.open( "F:/Work/Computations/gridGenerator/grid/1/gridGeneratorLog.txt" ); //logFile2.open( "grid/1/gridGeneratorLog.txt" ); - logging::Logger::addStream(&logFile2); auto triangularMesh = std::make_shared<TriangularMesh>("F:/Work/Computations/gridGenerator/stl/Sphere/SphereNotOptimal.stl"); //auto triangularMesh = std::make_shared<TriangularMesh>("stl/ShpereNotOptimal.lnx.stl"); @@ -821,16 +809,14 @@ int main( int argc, char* argv[]) catch (const std::bad_alloc& e) { - *logging::out << logging::Logger::LOGGER_ERROR << "Bad Alloc:" << e.what() << "\n"; } catch (const std::exception& e) { - *logging::out << logging::Logger::LOGGER_ERROR << e.what() << "\n"; } catch (...) { - *logging::out << logging::Logger::LOGGER_ERROR << "Unknown exception!\n"; + } } diff --git a/apps/gpu/LBM/lbmTest/main.cpp b/apps/gpu/LBM/lbmTest/main.cpp index 01b1543b1..1063040e2 100644 --- a/apps/gpu/LBM/lbmTest/main.cpp +++ b/apps/gpu/LBM/lbmTest/main.cpp @@ -262,17 +262,6 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input void multipleLevel(const std::string& configPath) { - //std::ofstream logFile( "F:/Work/Computations/gridGenerator/grid/gridGeneratorLog.txt" ); - std::ofstream logFile( "grid/gridGeneratorLog.txt" ); - logging::Logger::addStream(&logFile); - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - - //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); - auto gridFactory = GridFactory::make(); gridFactory->setGridStrategy(Device::CPU); //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); @@ -632,8 +621,6 @@ void multipleLevel(const std::string& configPath) logFile2.open( "F:/Work/Computations/gridGenerator/grid/1/gridGeneratorLog.txt" ); //logFile2.open( "grid/1/gridGeneratorLog.txt" ); - logging::Logger::addStream(&logFile2); - real dx = 1.0 / 40.0; real vx = 0.05; @@ -774,7 +761,6 @@ int main( int argc, char* argv[]) } catch (const std::exception& e) { - *logging::out << logging::Logger::ERROR << e.what() << "\n"; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) @@ -791,22 +777,17 @@ int main( int argc, char* argv[]) } catch (const std::exception& e) { - - *logging::out << logging::Logger::ERROR << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (const std::bad_alloc e) { - - *logging::out << logging::Logger::ERROR << "Bad Alloc:" << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) { - *logging::out << logging::Logger::ERROR << "Unknown exception!\n"; - //std::cout << "unknown exeption" << std::endl; + std::cout << "unknown exeption" << std::endl; } std::cout << "\nConfiguration file must be set!: lbmgm <config file>" << std::endl << std::flush; diff --git a/apps/gpu/LBM/metisTest/main.cpp b/apps/gpu/LBM/metisTest/main.cpp index 7c94a6781..e3f319565 100644 --- a/apps/gpu/LBM/metisTest/main.cpp +++ b/apps/gpu/LBM/metisTest/main.cpp @@ -262,17 +262,6 @@ void setParameters(std::shared_ptr<Parameter> para, std::unique_ptr<input::Input void multipleLevel(const std::string& configPath) { - //std::ofstream logFile( "F:/Work/Computations/gridGenerator/grid/gridGeneratorLog.txt" ); - std::ofstream logFile( "grid/gridGeneratorLog.txt" ); - logging::Logger::addStream(&logFile); - - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::INFO_LOW); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); - - //UbLog::reportingLevel() = UbLog::logLevelFromString("DEBUG5"); - auto gridFactory = GridFactory::make(); gridFactory->setGridStrategy(Device::CPU); //gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::RAYCASTING); @@ -783,7 +772,6 @@ int main( int argc, char* argv[]) } catch (const std::exception& e) { - *logging::out << logging::Logger::ERROR << e.what() << "\n"; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) @@ -799,22 +787,17 @@ int main( int argc, char* argv[]) } catch (const std::exception& e) { - - *logging::out << logging::Logger::ERROR << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (const std::bad_alloc e) { - - *logging::out << logging::Logger::ERROR << "Bad Alloc:" << e.what() << "\n"; - //std::cout << e.what() << std::flush; + std::cout << e.what() << std::flush; //MPI_Abort(MPI_COMM_WORLD, -1); } catch (...) { - *logging::out << logging::Logger::ERROR << "Unknown exception!\n"; - //std::cout << "unknown exeption" << std::endl; + std::cout << "unknown exeption" << std::endl; } std::cout << "\nConfiguration file must be set!: lbmgm <config file>" << std::endl << std::flush; diff --git a/src/basics/Core/Logger/Logger.cpp b/src/basics/Core/Logger/Logger.cpp deleted file mode 100644 index 1a27ef6f2..000000000 --- a/src/basics/Core/Logger/Logger.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Logger.cpp -//! \ingroup Logger -//! \author Stephan Lenz -//======================================================================================= -#include "Logger.h" -#include <iostream> -#include <memory> - -#include "implementations/LoggerImp.h" - -namespace logging -{ - -std::shared_ptr<Logger> out = nullptr; - -logging::Logger::Level logging::Logger::globalLogLevel = logging::Logger::INFO_LOW; -logging::Logger::Level logging::Logger::localLogLevel = logging::Logger::INFO_LOW; -bool logging::Logger::printRankNumber = false; -bool logging::Logger::timeStampEnabled = false; - -logging::Logger::Logger(std::ostream *stream) { streams.push_back(stream); } - -logging::Logger::~Logger() = default; - -void Logger::addStreamToList(std::ostream *stream) { streams.push_back(stream); } - -void Logger::resetStreamList() { streams.clear(); } - -//-----------static methods----------------// -void logging::Logger::resetStreams() -{ - if (!out) - out = std::make_shared<LoggerImp>(&std::cout); - - out->resetStreamList(); -} - -void logging::Logger::setStream(std::ostream *stream) { out = std::make_shared<LoggerImp>(stream); } - -void logging::Logger::addStream(std::ostream *stream) -{ - if (!out) - out = std::make_shared<LoggerImp>(stream); - else - out->addStreamToList(stream); -} - -void logging::Logger::timeStamp(TimeStamp timeStamp) -{ - switch (timeStamp) { - case ENABLE: - timeStampEnabled = true; - break; - case DISABLE: - timeStampEnabled = false; - break; - } -} - -void logging::Logger::setDebugLevel(const Level &level) { globalLogLevel = level; } - -void logging::Logger::enablePrintedRankNumbers(bool print) { printRankNumber = print; } - -} // namespace logging diff --git a/src/basics/Core/Logger/Logger.h b/src/basics/Core/Logger/Logger.h deleted file mode 100644 index 53cb974b8..000000000 --- a/src/basics/Core/Logger/Logger.h +++ /dev/null @@ -1,88 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file Logger.h -//! \ingroup Logger -//! \author Stephan Lenz -//======================================================================================= -#ifndef Logger_H -#define Logger_H - -#include "basics_export.h" - -#include <memory> -#include <ostream> -#include <string> -#include <vector> - -namespace logging -{ -class BASICS_EXPORT Logger -{ -protected: - Logger(std::ostream *stream); - -public: - virtual ~Logger(); - - enum Level { INFO_LOW = 3, INFO_INTERMEDIATE = 2, INFO_HIGH = 1, WARNING = 0, LOGGER_ERROR = -1 }; - - enum TimeStamp { ENABLE, DISABLE }; - - static void setStream(std::ostream *stream); - static void addStream(std::ostream *stream); - static void resetStreams(); - - static void timeStamp(TimeStamp timeStamp); - - static void setDebugLevel(const Level &level = Level::LOGGER_ERROR); - static void enablePrintedRankNumbers(bool printRankNumbers); - - virtual Logger &operator<<(const Level &level) = 0; - virtual Logger &operator<<(const std::string &log) = 0; - virtual Logger &operator<<(const int &log) = 0; - virtual Logger &operator<<(const unsigned int &log) = 0; - virtual Logger &operator<<(const unsigned long &log) = 0; - virtual Logger &operator<<(const float &log) = 0; - virtual Logger &operator<<(const double &log) = 0; - -protected: - void addStreamToList(std::ostream *stream); - void resetStreamList(); - - std::vector<std::ostream *> streams; - - static Level globalLogLevel; - static Level localLogLevel; - static bool printRankNumber; - static bool timeStampEnabled; -}; -extern BASICS_EXPORT std::shared_ptr<Logger> out; -} // namespace logging - -#endif diff --git a/src/basics/Core/Logger/implementations/LoggerImp.cpp b/src/basics/Core/Logger/implementations/LoggerImp.cpp deleted file mode 100644 index 086c0e3aa..000000000 --- a/src/basics/Core/Logger/implementations/LoggerImp.cpp +++ /dev/null @@ -1,126 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file LoggerImp.cpp -//! \ingroup Logger -//! \author Stephan Lenz -//======================================================================================= -#include "LoggerImp.h" - -#include <chrono> -#include <iomanip> -#include <iostream> -#include <mpi.h> -#include <sstream> - -logging::LoggerImp::LoggerImp(std::ostream *stream) : logging::Logger(stream) -{ - levelString[Level::WARNING] = "[WARNING] "; - levelString[Level::LOGGER_ERROR] = "[ERROR] "; - levelString[Level::INFO_LOW] = "[INFO_LOW] "; - levelString[Level::INFO_INTERMEDIATE] = "[INFO_INTERMEDIATE]"; - levelString[Level::INFO_HIGH] = "[INFO_HIGH] "; -} - -logging::LoggerImp::~LoggerImp() = default; - -logging::Logger &logging::LoggerImp::operator<<(const Level &level) -{ - localLogLevel = level; - return *this; -} - -logging::Logger &logging::LoggerImp::operator<<(const std::string &message) { return this->log(message); } - -logging::Logger &logging::LoggerImp::operator<<(const int &message) { return this->log(std::to_string(message)); } - -logging::Logger &logging::LoggerImp::operator<<(const unsigned int &message) -{ - return this->log(std::to_string(message)); -} - -logging::Logger &logging::LoggerImp::operator<<(const unsigned long &message) -{ - return this->log(std::to_string(message)); -} - -logging::Logger &logging::LoggerImp::operator<<(const float &message) { return this->log(std::to_string(message)); } - -logging::Logger &logging::LoggerImp::operator<<(const double &message) { return this->log(std::to_string(message)); } - -logging::Logger &logging::LoggerImp::log(const std::string &message) -{ - if (shouldBeLogged()) { - std::string modifiedMessage = message; - addDebugInformation(modifiedMessage); - for (auto stream : streams) - *stream << modifiedMessage << std::flush; - } - std::size_t found = message.find(std::string("\n")); - if (found != std::string::npos) - newLoggingLine = true; - else - newLoggingLine = false; - - return *this; -} - -bool logging::LoggerImp::shouldBeLogged() { return localLogLevel <= globalLogLevel; } - -void logging::LoggerImp::addDebugInformation(std::string &message) -{ - if (newLoggingLine) { - std::stringstream os; - os << levelString[localLogLevel] << getTimeStamp() << " " << message; - message = os.str(); - } -} - -std::string logging::LoggerImp::getTimeStamp() -{ - if (!timeStampEnabled) - return ""; - - const auto now = std::chrono::system_clock::now(); - time_t tt = std::chrono::system_clock::to_time_t(now); - // const tm utc_tm = *gmtime(&tt); - const tm local_tm = *localtime(&tt); - - std::stringstream os; - os << " [" << std::setw(2) << std::setfill('0') << local_tm.tm_hour << ":"; - os << std::setw(2) << std::setfill('0') << local_tm.tm_min << ":"; - os << std::setw(2) << std::setfill('0') << local_tm.tm_sec << "]"; - return os.str(); -} - -std::string logging::LoggerImp::getRankString() -{ - int rank; - MPI_Comm_rank(MPI_COMM_WORLD, &rank); - return printRankNumber ? "[" + std::to_string(rank) + "] " : ""; -} diff --git a/src/basics/Core/Logger/implementations/LoggerImp.h b/src/basics/Core/Logger/implementations/LoggerImp.h deleted file mode 100644 index 070b06a23..000000000 --- a/src/basics/Core/Logger/implementations/LoggerImp.h +++ /dev/null @@ -1,75 +0,0 @@ -//======================================================================================= -// ____ ____ __ ______ __________ __ __ __ __ -// \ \ | | | | | _ \ |___ ___| | | | | / \ | | -// \ \ | | | | | |_) | | | | | | | / \ | | -// \ \ | | | | | _ / | | | | | | / /\ \ | | -// \ \ | | | | | | \ \ | | | \__/ | / ____ \ | |____ -// \ \ | | |__| |__| \__\ |__| \________/ /__/ \__\ |_______| -// \ \ | | ________________________________________________________________ -// \ \ | | | ______________________________________________________________| -// \ \| | | | __ __ __ __ ______ _______ -// \ | | |_____ | | | | | | | | | _ \ / _____) -// \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ | -// \ _____| |__| |________| \_______/ |__| |______/ (_______/ -// -// This file is part of VirtualFluids. VirtualFluids is free software: you can -// redistribute it and/or modify it under the terms of the GNU General Public -// License as published by the Free Software Foundation, either version 3 of -// the License, or (at your option) any later version. -// -// VirtualFluids is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -// for more details. -// -// You should have received a copy of the GNU General Public License along -// with VirtualFluids (see COPYING.txt). If not, see <http://www.gnu.org/licenses/>. -// -//! \file LoggerImp.h -//! \ingroup Logger -//! \author Stephan Lenz -//======================================================================================= -#ifndef LoggerImp_H -#define LoggerImp_H - -#include "basics_export.h" - -#include <string> - -#include "../Logger.h" -#include <map> - -namespace logging -{ - -class BASICS_EXPORT LoggerImp : public Logger -{ -public: - LoggerImp(std::ostream *stream); - ~LoggerImp() override; - - Logger &operator<<(const Level &level) override; - Logger &operator<<(const std::string &message) override; - Logger &operator<<(const int &message) override; - Logger &operator<<(const unsigned int &message) override; - Logger &operator<<(const unsigned long &log) override; - Logger &operator<<(const float &message) override; - Logger &operator<<(const double &message) override; - -private: - std::string getRankString(); - static bool shouldBeLogged(); - - static std::string getTimeStamp(); - void addDebugInformation(std::string &message); - logging::Logger &log(const std::string &message); - -private: - std::map<Logger::Level, std::string> levelString; - bool newLoggingLine = true; -}; - -} // namespace logging - -#endif diff --git a/src/basics/Core/Logger/implementations/LoggerTest.cpp b/src/basics/Core/Logger/implementations/LoggerTest.cpp deleted file mode 100644 index 2c4e4e681..000000000 --- a/src/basics/Core/Logger/implementations/LoggerTest.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "gmock/gmock.h" -#include <fstream> -#include <memory> - -#include "../Logger.h" - -TEST(DISABLED_LoggerTest, logStringWithoutSettingLevels_WillPutTheLogMesssageIntoTheStream) -{ - std::ostringstream stream; - logging::Logger::setStream(&stream); - - *logging::out << logging::Logger::INFO_LOW << "Hello World\n"; - - EXPECT_THAT(stream.str(), "[LOW] Hello World\n"); -} - -TEST(DISABLED_LoggerTest, logStringWithHighDebugLevel_logOnlyHighLevelMessages) -{ - std::ostringstream stream; - logging::Logger::setStream(&stream); - - logging::Logger::setDebugLevel(logging::Logger::INFO_HIGH); - *logging::out << logging::Logger::INFO_LOW << "Low Debug Message\n" - << logging::Logger::INFO_HIGH << "HIGH Debug Message\n"; - - EXPECT_THAT(stream.str(), "[HIGH] HIGH Debug Message\n"); -} - -TEST(DISABLED_LoggerTest, addTwoStreams_shouldWriteToBoth) -{ - logging::Logger::resetStreams(); - - std::ostringstream stream1, stream2; - logging::out->addStream(&stream1); - logging::out->addStream(&stream2); - logging::Logger::setDebugLevel(logging::Logger::INFO_LOW); - - *logging::out << logging::Logger::INFO_LOW << "Hello World\n"; - - EXPECT_THAT(stream1.str(), "[LOW] Hello World\n"); - EXPECT_THAT(stream2.str(), "[LOW] Hello World\n"); -} - -TEST(DISABLED_LoggerTest, splittetOutputShouldHaveDebugInformationOnce) -{ - std::ostringstream stream; - logging::Logger::setStream(&stream); - - *logging::out << logging::Logger::INFO_LOW << "Hello" - << " World\n"; - - EXPECT_THAT(stream.str(), "[LOW] Hello World\n"); -} - -TEST(DISABLED_LoggerTest, enableTimeStampInOutput) -{ - std::ostringstream stream; - logging::Logger::setStream(&stream); - logging::Logger::timeStamp(logging::Logger::TimeStamp::ENABLE); - - *logging::out << logging::Logger::INFO_LOW << "Hello" - << " World\n"; - - EXPECT_THAT(stream.str(), testing::StrNe("[LOW] Hello World\n")); -} diff --git a/src/gpu/GridGenerator/CMakeLists.txt b/src/gpu/GridGenerator/CMakeLists.txt index 8102ad3a1..7cc0f0e20 100644 --- a/src/gpu/GridGenerator/CMakeLists.txt +++ b/src/gpu/GridGenerator/CMakeLists.txt @@ -1,6 +1,6 @@ project(GridGenerator LANGUAGES CXX) -vf_add_library(PRIVATE_LINK basics OpenMP::OpenMP_CXX) +vf_add_library(PUBLIC_LINK basics logger OpenMP::OpenMP_CXX) vf_add_tests() if(NOT MSVC) diff --git a/src/gpu/GridGenerator/geometries/Conglomerate/Conglomerate.cpp b/src/gpu/GridGenerator/geometries/Conglomerate/Conglomerate.cpp index 912832308..b41813e12 100644 --- a/src/gpu/GridGenerator/geometries/Conglomerate/Conglomerate.cpp +++ b/src/gpu/GridGenerator/geometries/Conglomerate/Conglomerate.cpp @@ -177,5 +177,5 @@ void Conglomerate::findInnerNodes(SPtr<GridImp> grid) addObjects[i]->findInnerNodes(grid); if( numberOfSubtractObjects > 0 ) - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Warning: Conglomerate::substract() is currently nut fully implemented!\n"; + VF_LOG_WARNING("Warning: Conglomerate::substract() is currently nut fully implemented!"); } diff --git a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp index 56545a8d4..57437e910 100644 --- a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp +++ b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cpp @@ -95,7 +95,7 @@ uint TriangularMesh::getNumberOfTriangles() const void TriangularMesh::findNeighbors() { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "start finding neighbors ...\n"; + VF_LOG_INFO("start finding neighbors ..."); auto t = Timer::makeStart(); @@ -103,8 +103,7 @@ void TriangularMesh::findNeighbors() finder.fillWithNeighborAngles(this); t->end(); - - *logging::out << logging::Logger::INFO_INTERMEDIATE << "time finding neighbors: " << t->getTimeInSeconds() << "s\n"; + VF_LOG_INFO("time finding neighbors = {}", t->getTimeInSeconds()); } void TriangularMesh::setTriangles(std::vector<Triangle> triangles) @@ -152,7 +151,7 @@ GRIDGENERATOR_EXPORT void TriangularMesh::generateGbTriFaceMesh3D() { if( this->VF_GbTriFaceMesh3D ) return; - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start generating GbTriFaceMesh3D:\n"; + VF_LOG_INFO("Start generating GbTriFaceMesh3D"); std::vector<GbTriFaceMesh3D::Vertex> *gbVertices = new std::vector<GbTriFaceMesh3D::Vertex>(this->triangleVec.size() * 3); std::vector<GbTriFaceMesh3D::TriFace> *gbTriangles = new std::vector<GbTriFaceMesh3D::TriFace>(this->triangleVec.size()); @@ -168,7 +167,7 @@ GRIDGENERATOR_EXPORT void TriangularMesh::generateGbTriFaceMesh3D() this->VF_GbTriFaceMesh3D = std::make_shared<GbTriFaceMesh3D>( "stl", gbVertices, gbTriangles, GbTriFaceMesh3D::KDTREE_SAHPLIT, false ); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Done generating GbTriFaceMesh3D\n"; + VF_LOG_INFO("Done generating GbTriFaceMesh3D"); } diff --git a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp index d9c1486e2..21541a6a5 100644 --- a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp +++ b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMeshStrategy.cpp @@ -56,7 +56,7 @@ void PointInObjectDiscretizationStrategy::doDiscretize(TriangularMesh* triangula { triangularMesh->generateGbTriFaceMesh3D(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start Point-In-Object Test:\n"; + VF_LOG_INFO("Start Point-In-Object Test"); // trigger the GbTriFaceMesh3D to generate a kd-tree triangularMesh->getGbTriFaceMesh3D()->isPointInGbObject3D(0.0, 0.0, 0.0); @@ -79,12 +79,11 @@ void PointInObjectDiscretizationStrategy::doDiscretize(TriangularMesh* triangula // grid->setNodeTo(i, OuterType); if( timer->getCurrentRuntimeInSeconds() > outputTime ){ - *logging::out << logging::Logger::INFO_INTERMEDIATE << " " << index << "/" << grid->getSize() <<" nodes tested!\n"; + VF_LOG_INFO(" {} / {} nodes tested", index, grid->getSize()); timer->start(); } } - - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Done Point-In-Object Test\n"; + VF_LOG_INFO("Done Point-In-Object Test"); } diff --git a/src/gpu/GridGenerator/global.h b/src/gpu/GridGenerator/global.h index 79f62bb35..e77b912ed 100644 --- a/src/gpu/GridGenerator/global.h +++ b/src/gpu/GridGenerator/global.h @@ -45,6 +45,6 @@ #include "basics/PointerDefinitions.h" #include "basics/Core/DataTypes.h" -#include "basics/Core/Logger/Logger.h" +#include <logger/Logger.h> #endif diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp index 003e6dcd2..87ec7bab0 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp +++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp @@ -94,7 +94,7 @@ void LevelGridBuilder::setSlipBoundaryCondition(SideType sideType, real normalX, slipBoundaryCondition->fillSlipNormalLists(); boundaryConditions[level]->slipBoundaryConditions.push_back(slipBoundaryCondition); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Slip BC on level " << level << " with " << (int)slipBoundaryCondition->indices.size() << "\n"; + VF_LOG_INFO("Set Slip BC on level {} with {}", level, slipBoundaryCondition->indices.size()); } } } @@ -114,7 +114,7 @@ void LevelGridBuilder::setSlipGeometryBoundaryCondition(real normalX, real norma boundaryConditions[level]->geometryBoundaryCondition->fillSlipNormalLists(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Geometry Slip BC on level " << level << " with " << (int)boundaryConditions[level]->geometryBoundaryCondition->indices.size() <<"\n"; + VF_LOG_INFO("Set Geometry Slip BC on level {} with {}", level, boundaryConditions[level]->geometryBoundaryCondition->indices.size()); } } } @@ -144,7 +144,7 @@ void LevelGridBuilder::setStressBoundaryCondition( SideType sideType, boundaryConditions[level]->stressBoundaryConditions.push_back(stressBoundaryCondition); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Stress BC on level " << level << " with " << (int)stressBoundaryCondition->indices.size() << "\n"; + VF_LOG_INFO("Set Stress BC on level {} with {}", level, stressBoundaryCondition->indices.size()); } } @@ -167,7 +167,7 @@ void LevelGridBuilder::setVelocityBoundaryCondition(SideType sideType, real vx, boundaryConditions[level]->velocityBoundaryConditions.push_back(velocityBoundaryCondition); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Velocity BC on level " << level << " with " << (int)velocityBoundaryCondition->indices.size() <<"\n"; + VF_LOG_INFO("Set Velocity BC on level {} with {}", level, velocityBoundaryCondition->indices.size()); } } } @@ -187,7 +187,7 @@ void LevelGridBuilder::setVelocityGeometryBoundaryCondition(real vx, real vy, re boundaryConditions[level]->geometryBoundaryCondition->fillVelocityLists(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Geometry Velocity BC on level " << level << " with " << (int)boundaryConditions[level]->geometryBoundaryCondition->indices.size() <<"\n"; + VF_LOG_INFO("Set Geometry BC on level {} with {}", level, boundaryConditions[level]->geometryBoundaryCondition->indices.size()); } } } @@ -204,7 +204,7 @@ void LevelGridBuilder::setPressureBoundaryCondition(SideType sideType, real rho) boundaryConditions[level]->pressureBoundaryConditions.push_back(pressureBoundaryCondition); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Pressure BC on level " << level << " with " << (int)pressureBoundaryCondition->indices.size() <<"\n"; + VF_LOG_INFO("Set Pressure BC on level {} with {}", level, pressureBoundaryCondition->indices.size()); } } @@ -245,7 +245,7 @@ void LevelGridBuilder::setNoSlipGeometryBoundaryCondition() { boundaryConditions[level]->geometryBoundaryCondition->side->addIndices(grids, level, boundaryConditions[level]->geometryBoundaryCondition); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Geometry No-Slip BC on level " << level << " with " << (int)boundaryConditions[level]->geometryBoundaryCondition->indices.size() <<"\n"; + VF_LOG_INFO("Set Geometry No-Slip BC on level {} with {}", level, boundaryConditions[level]->geometryBoundaryCondition->indices.size()); } } } @@ -255,7 +255,7 @@ void LevelGridBuilder::setPrecursorBoundaryCondition(SideType sideType, SPtr<Fil { if(fileLevelToGridLevelMap.empty()) { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Mapping precursor file levels to the corresponding grid levels" << "\n"; + VF_LOG_INFO("Mapping precursor file levels to the corresponding grid levels"); for (uint level = 0; level < getNumberOfGridLevels(); level++) fileLevelToGridLevelMap.push_back(level); @@ -264,7 +264,7 @@ void LevelGridBuilder::setPrecursorBoundaryCondition(SideType sideType, SPtr<Fil { if(fileLevelToGridLevelMap.size()!=getNumberOfGridLevels()) throw std::runtime_error("In setPrecursorBoundaryCondition: fileLevelToGridLevelMap does not match with the number of levels"); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Using user defined file to grid level mapping" << "\n"; + VF_LOG_INFO("Using user defined file to grid level mapping"); } for (uint level = 0; level < getNumberOfGridLevels(); level++) @@ -279,7 +279,7 @@ void LevelGridBuilder::setPrecursorBoundaryCondition(SideType sideType, SPtr<Fil boundaryConditions[level]->precursorBoundaryConditions.push_back(precursorBoundaryCondition); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Set Precursor BC on level " << level << " with " << (int)precursorBoundaryCondition->indices.size() << "\n"; + VF_LOG_INFO("Set Precursor BC on level {} with {}", level, precursorBoundaryCondition->indices.size()); } } @@ -790,10 +790,10 @@ GRIDGENERATOR_EXPORT SPtr<GeometryBoundaryCondition> LevelGridBuilder::getGeomet void LevelGridBuilder::findFluidNodes(bool splitDomain) { - *logging::out << logging::Logger::INFO_HIGH << "Start findFluidNodes()\n"; + VF_LOG_TRACE("Start findFluidNodes()"); for (uint i = 0; i < grids.size(); i++) grids[i]->findFluidNodeIndices(splitDomain); - *logging::out << logging::Logger::INFO_HIGH << "Done with findFluidNodes()\n"; + VF_LOG_TRACE("Done findFluidNodes()"); } diff --git a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp index bf226f235..e45ad99d8 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp +++ b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp @@ -490,7 +490,7 @@ void MultipleGridBuilder::buildGrids(bool enableThinWalls ) // for( int level = (int)grids.size()-1; level >= 0; level-- ) { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start initializing level " << level << "\n"; + VF_LOG_INFO("Start initializing level {}", level); // On the coarse grid every thing is Fluid (w.r.t. the refinement) // On the finest grid the Fluid region is defined by the Object @@ -502,7 +502,7 @@ void MultipleGridBuilder::buildGrids(bool enableThinWalls ) else grids[level]->inital( grids[level+1], this->numberOfLayersBetweenLevels ); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Done initializing level " << level << "\n"; + VF_LOG_INFO("Done initializing level {}", level); } ////////////////////////////////////////////////////////////////////////// @@ -516,8 +516,7 @@ void MultipleGridBuilder::buildGrids(bool enableThinWalls ) // if (solidObject) { - - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start with Q Computation\n"; + VF_LOG_TRACE("Start with Q Computation"); // Currently the solid object is only used on the finest grid, // because refinement into solid objects is not yet implemented. @@ -554,7 +553,7 @@ void MultipleGridBuilder::buildGrids(bool enableThinWalls ) grids[level]->findQs(solidObject.get()); } - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Done with Q Computation\n"; + VF_LOG_TRACE("Done with Q Computation"); } ////////////////////////////////////////////////////////////////////////// @@ -603,24 +602,24 @@ GRIDGENERATOR_EXPORT void MultipleGridBuilder::setNumberOfLayers(uint numberOfLa void MultipleGridBuilder::emitNoCoarseGridExistsWarning() { - *logging::out << logging::Logger::WARNING << "No Coarse grid was added before. Actual Grid is not added, please create coarse grid before.\n"; + VF_LOG_WARNING("No Coarse grid was added before. Actual Grid is not added, please create coarse grid before."); } void MultipleGridBuilder::emitGridIsNotInCoarseGridWarning() { - *logging::out << logging::Logger::WARNING << "Grid lies not inside of coarse grid. Actual Grid is not added.\n"; + VF_LOG_WARNING("Grid lies not inside of coarse grid. Actual Grid is not added."); } void MultipleGridBuilder::findCommunicationIndices(int direction) { - *logging::out << logging::Logger::INFO_HIGH << "Start findCommunicationIndices()\n"; + VF_LOG_TRACE("Start findCommunicationIndices()"); if( this->subDomainBox ) for (size_t i = 0; i < grids.size(); i++) grids[i]->findCommunicationIndices(direction, this->subDomainBox); - *logging::out << logging::Logger::INFO_HIGH << "Done with findCommunicationIndices()\n"; + VF_LOG_TRACE("Done findCommunicationIndices()"); } void MultipleGridBuilder::writeGridsToVtk(const std::string& path) const diff --git a/src/gpu/GridGenerator/grid/GridImp.cpp b/src/gpu/GridGenerator/grid/GridImp.cpp index e709e42d0..8ece06116 100644 --- a/src/gpu/GridGenerator/grid/GridImp.cpp +++ b/src/gpu/GridGenerator/grid/GridImp.cpp @@ -131,31 +131,31 @@ void GridImp::inital(const SPtr<Grid> fineGrid, uint numberOfLayers) for (uint i = 0; i < this->size; i++) this->qIndices[i] = INVALID_INDEX; - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start initalNodesToOutOfGrid()\n"; + VF_LOG_TRACE("Start initalNodesToOutOfGrid()"); + #pragma omp parallel for for (int index = 0; index < (int)this->size; index++) this->initalNodeToOutOfGrid(index); if( this->innerRegionFromFinerGrid ){ - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start setInnerBasedOnFinerGrid()\n"; + VF_LOG_TRACE("Start setInnerBasedOnFinerGrid()"); this->setInnerBasedOnFinerGrid(fineGrid); } else{ - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start findInnerNodes()\n"; + VF_LOG_TRACE("Start findInnerNodes()"); this->object->findInnerNodes( shared_from_this() ); } - - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start addOverlap()\n"; + VF_LOG_TRACE("Start addOverlap()"); this->addOverlap(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start fixOddCells()\n"; + VF_LOG_TRACE("Start fixOddCells()"); #pragma omp parallel for for (int index = 0; index < (int)this->size; index++) this->fixOddCell(index); if( enableFixRefinementIntoTheWall ) { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start fixRefinementIntoWall()\n"; + VF_LOG_TRACE("Start fixRefinementIntoWall()"); #pragma omp parallel for for (int xIdx = 0; xIdx < (int)this->nx; xIdx++) { for (uint yIdx = 0; yIdx < this->ny; yIdx++) { @@ -180,15 +180,13 @@ void GridImp::inital(const SPtr<Grid> fineGrid, uint numberOfLayers) } } } - - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start findEndOfGridStopperNodes()\n"; + VF_LOG_TRACE("Start findEndOfGridStopperNodes()"); #pragma omp parallel for for (int index = 0; index < (int)this->size; index++) this->findEndOfGridStopperNode(index); - *logging::out << logging::Logger::INFO_INTERMEDIATE - << "Grid created: " << "from (" << this->startX << ", " << this->startY << ", " << this->startZ << ") to (" << this->endX << ", " << this->endY << ", " << this->endZ << ")\n" - << "nodes: " << this->nx << " x " << this->ny << " x " << this->nz << " = " << this->size << "\n"; + VF_LOG_INFO("Grid created: from ({}, {}, {}) to ({}, {}, {})", this->startX, this->startY, this->startZ, this->endX, this->endY, this->endZ); + VF_LOG_INFO("nodes: {} x {} x {} = {}", this->nx, this->ny, this->nz, this->size); } void GridImp::setOddStart(bool xOddStart, bool yOddStart, bool zOddStart) @@ -862,7 +860,7 @@ void GridImp::setNumberOfLayers(uint numberOfLayers) void GridImp::findSparseIndices(SPtr<Grid> finerGrid) { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Find sparse indices..."; + VF_LOG_TRACE("Find sparse indices..."); auto fineGrid = std::static_pointer_cast<GridImp>(finerGrid); this->updateSparseIndices(); @@ -877,8 +875,7 @@ void GridImp::findSparseIndices(SPtr<Grid> finerGrid) } const uint newGridSize = this->getSparseSize(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "... done. new size: " << newGridSize - << ", delete nodes:" << this->getSize() - newGridSize << "\n"; + VF_LOG_TRACE("... done. new size: {}, delete nodes: {}", newGridSize, this->getSize() - newGridSize); } void GridImp::findForGridInterfaceNewIndices(SPtr<GridImp> fineGrid) @@ -1112,8 +1109,7 @@ void GridImp::findGridInterface(SPtr<Grid> finerGrid) const auto coarseLevel = this->getLevel(); const auto fineLevel = fineGrid->getLevel(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "find interface level " << coarseLevel << " -> " - << fineLevel; + VF_LOG_TRACE("find interface level {} -> {}", coarseLevel, fineLevel); this->gridInterface = new GridInterface(); // TODO: this is stupid! concave refinements can easily have many more interface cells @@ -1134,7 +1130,7 @@ void GridImp::findGridInterface(SPtr<Grid> finerGrid) for (uint index = 0; index < this->getSize(); index++) this->findOverlapStopper(index, *fineGrid); - *logging::out << logging::Logger::INFO_INTERMEDIATE << " ... done. \n"; + VF_LOG_TRACE(" ... done."); } void GridImp::repairGridInterfaceOnMultiGPU(SPtr<Grid> fineGrid) @@ -1236,7 +1232,7 @@ void GridImp::mesh(TriangularMesh &triangularMesh) const clock_t end = clock(); const real time = (real)(real(end - begin) / CLOCKS_PER_SEC); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "time grid generation: " << time << "s\n"; + VF_LOG_INFO("time grid generation: {}s", time); } void GridImp::mesh(Triangle &triangle) @@ -1267,7 +1263,7 @@ void GridImp::mesh(Triangle &triangle) void GridImp::closeNeedleCells() { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start closeNeedleCells()\n"; + VF_LOG_TRACE("Start closeNeedleCells()"); uint numberOfClosedNeedleCells = 0; @@ -1279,7 +1275,7 @@ void GridImp::closeNeedleCells() numberOfClosedNeedleCells++; } - *logging::out << logging::Logger::INFO_INTERMEDIATE << numberOfClosedNeedleCells << " cells closed!\n"; + VF_LOG_TRACE("{} cells closed!", numberOfClosedNeedleCells); } while( numberOfClosedNeedleCells > 0 ); } @@ -1308,7 +1304,7 @@ bool GridImp::closeCellIfNeedle(uint index) void GridImp::closeNeedleCellsThinWall() { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start closeNeedleCellsThinWall()\n"; + VF_LOG_TRACE("Start closeNeedleCellsThinWall()"); uint numberOfClosedNeedleCells = 0; @@ -1319,8 +1315,7 @@ void GridImp::closeNeedleCellsThinWall() if (this->closeCellIfNeedleThinWall(index)) numberOfClosedNeedleCells++; } - - *logging::out << logging::Logger::INFO_INTERMEDIATE << numberOfClosedNeedleCells << " cells closed!\n"; + VF_LOG_TRACE("{} cells closed!", numberOfClosedNeedleCells); } while( numberOfClosedNeedleCells > 0 ); } @@ -1380,7 +1375,7 @@ void GridImp::findQs(TriangularMesh &triangularMesh) const clock_t end = clock(); const real time = (real)(real(end - begin) / CLOCKS_PER_SEC); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "time finding qs: " << time << "s\n"; + VF_LOG_TRACE("time finding qs: {}s", time); } void GridImp::findQs(Triangle &triangle) @@ -1727,12 +1722,8 @@ void GridImp::repairCommunicationIndices(int direction) this->communicationIndices[direction].receiveIndices = this->communicationIndices[direction+1].receiveIndices; - - - - - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size send " << (int)this->communicationIndices[direction].sendIndices.size() << "\n"; - *logging::out << logging::Logger::INFO_INTERMEDIATE << "recv send " << (int)this->communicationIndices[direction].receiveIndices.size() << "\n"; + VF_LOG_INFO("size send {}", (int)this->communicationIndices[direction].sendIndices.size()); + VF_LOG_INFO("recv send {}",(int)this->communicationIndices[direction].receiveIndices.size()); } diff --git a/src/gpu/GridGenerator/grid/GridImpTest.cpp b/src/gpu/GridGenerator/grid/GridImpTest.cpp index 397d76a77..07b2a03f4 100644 --- a/src/gpu/GridGenerator/grid/GridImpTest.cpp +++ b/src/gpu/GridGenerator/grid/GridImpTest.cpp @@ -175,12 +175,6 @@ protected: auto gridFactory = GridFactory::make(); gridFactory->setTriangularMeshDiscretizationMethod(TriangularMeshDiscretizationMethod::POINT_IN_OBJECT); gridBuilder = MultipleGridBuilder::makeShared(gridFactory); - - // init logger to avoid segmentation fault in buildGrids - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::Level::WARNING); - logging::Logger::timeStamp(logging::Logger::ENABLE); - logging::Logger::enablePrintedRankNumbers(logging::Logger::ENABLE); } }; diff --git a/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp b/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp index 7f818f321..bccd95253 100644 --- a/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp +++ b/src/gpu/GridGenerator/io/GridVTKWriter/GridVTKWriter.cpp @@ -85,7 +85,7 @@ void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name) std::vector<std::string> nodedatanames; std::vector< std::vector<double> > nodedata; - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Write Grid to XML VTK (*.vtu) output file : " + name + "_Part_" + std::to_string(part) + "\n"; + VF_LOG_INFO("Write Grid to XML VTK (*.vtu) output file : {}_Part_{}", name, part); nodedatanames.emplace_back("types"); nodedatanames.emplace_back("sparse_id"); @@ -154,7 +154,7 @@ void GridVTKWriter::writeGridToVTKXML(SPtr<Grid> grid, const std::string& name) } } WbWriterVtkXmlBinary::getInstance()->writeOctsWithNodeData(name + "_Part_" + std::to_string(part), nodes, cells, nodedatanames, nodedata); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "done. \n"; + VF_LOG_INFO("done."); } } @@ -282,14 +282,14 @@ void GridVTKWriter::initalVtkWriter(WRITING_FORMAT format, const std::string& na { GridVTKWriter::format = format; - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Write Grid to vtk output file : " + name + "\n"; + VF_LOG_INFO("Write Grid to vtk output file: {}", name); std::string mode = "w"; if (isBinaryWritingFormat()) mode = "wb"; GridVTKWriter::openFile(name, mode); - *logging::out << logging::Logger::INFO_INTERMEDIATE << " Output file opened ...\n"; + VF_LOG_INFO("Output file opened ..."); } bool GridVTKWriter::isBinaryWritingFormat() @@ -306,14 +306,14 @@ void GridVTKWriter::writeVtkFile(SPtr<Grid> grid) GridVTKWriter::writeTypes(grid); GridVTKWriter::closeFile(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Output file closed\n"; + VF_LOG_INFO("Output file closed"); } void GridVTKWriter::openFile(const std::string& name, const std::string& mode) { file = fopen(name.c_str(), mode.c_str()); if(file==NULL) - *logging::out << logging::Logger::INFO_HIGH << " cannot open file ...\n"; + VF_LOG_CRITICAL("cannot open file {}", name); } void GridVTKWriter::closeFile() diff --git a/src/gpu/GridGenerator/io/QLineWriter.cpp b/src/gpu/GridGenerator/io/QLineWriter.cpp index 29894e8d5..67a586b47 100644 --- a/src/gpu/GridGenerator/io/QLineWriter.cpp +++ b/src/gpu/GridGenerator/io/QLineWriter.cpp @@ -50,7 +50,7 @@ void QLineWriter::writeArrows(std::string fileName, SPtr<GeometryBoundaryConditi { if (geometryBoundaryCondition == nullptr) { - *logging::out << logging::Logger::WARNING << "(QLineWriter::writeArrows) no geometry bc on this grid level.\n"; + VF_LOG_WARNING("(QLineWriter::writeArrows) no geometry bc on this grid level."); return; } std::vector<UbTupleFloat3> nodes; diff --git a/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp b/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp index d3eb22126..d73adc73e 100644 --- a/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp +++ b/src/gpu/GridGenerator/io/STLReaderWriter/STLReader.cpp @@ -55,17 +55,17 @@ std::vector<Triangle> STLReader::readSTL(const std::string& name) line[strcspn(line.c_str(), "\r\n")] = 0; if (strcmp(line.c_str(), "solid ascii") == 0) { file.close(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "start reading ascii STL file: " + name + "\n"; + VF_LOG_INFO("start reading ascii STL file: {}" , name); return readASCIISTL(name); } else { file.close(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "start reading binary STL file: " + name + "\n"; + VF_LOG_INFO("start reading binary STL file: {}" , name); + return readBinarySTL(name); } } - - *logging::out << logging::Logger::INFO_INTERMEDIATE << "can't open STL-file" + name + " ... exit program! \n"; + VF_LOG_CRITICAL("can't open STL-file {} ... exit program!" , name); exit(1); } @@ -81,7 +81,7 @@ std::vector<Triangle> STLReader::readASCIISTL(const std::string& name) const int lines = countLinesInFile(name); const int nTriangles = (lines) / 7; // seven lines per triangle - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Number of Triangles: " << nTriangles << "\n"; + VF_LOG_INFO("Number of Triangles: {}" , nTriangles); std::vector<Triangle> triangles; std::string line; @@ -109,8 +109,7 @@ std::vector<Triangle> STLReader::readASCIISTL(const std::string& name) std::vector<Triangle> STLReader::readASCIISTLWithPatches(const std::string& name, const std::vector<uint> ignorePatches) { - *logging::out << logging::Logger::INFO_HIGH << "Start reading ascii STL file:\n"; - *logging::out << logging::Logger::INFO_HIGH << " " + name + "\n"; + VF_LOG_INFO("Start reading ascii STL file: {}" , name); std::vector<Triangle> triangles; @@ -141,9 +140,10 @@ std::vector<Triangle> STLReader::readASCIISTLWithPatches(const std::string& name ignoreCurrentPatch = std::find( ignorePatches.begin(), ignorePatches.end(), currentPatchIndex ) != ignorePatches.end(); if( !ignoreCurrentPatch ) - *logging::out << logging::Logger::INFO_INTERMEDIATE << " Reading STL-Group " << line.substr( line.find(' ') + 1 ) << " as patch " << currentPatchIndex << "\n"; + VF_LOG_INFO(" Reading STL-Group {} as patch {}" , line.substr( line.find(' ') + 1 ) , currentPatchIndex); else - *logging::out << logging::Logger::WARNING << " Ignoring STL-Group " << line.substr( line.find(' ') + 1 ) << " as patch " << currentPatchIndex << "\n"; + VF_LOG_WARNING(" Ignoring STL-Group {} as patch {}" , line.substr( line.find(' ') + 1 ) , currentPatchIndex); + currentFacetLine++; } @@ -202,7 +202,7 @@ std::vector<Triangle> STLReader::readASCIISTLWithPatches(const std::string& name file.close(); - *logging::out << logging::Logger::INFO_HIGH << "Done reading ascii STL file\n"; + VF_LOG_INFO("Done reading ascii STL file"); return triangles; } @@ -218,7 +218,7 @@ std::vector<Triangle> STLReader::readBinarySTL(const std::string& name) char nTri[4]; sizef = fread(nTri, sizeof(char), 4, file); unsigned long nTriLong = *((unsigned long*)nTri); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Number of Triangles: " << nTriLong << "\n"; + VF_LOG_INFO("Number of Triangles: {}" , nTriLong); std::vector<Triangle> triangles; char facet[50]; @@ -248,18 +248,18 @@ std::vector<Triangle> STLReader::readSTL(const BoundingBox &box, const std::stri line[strcspn(line.c_str(), "\r\n")] = 0; if (strcmp(line.c_str(), "solid ascii") == 0) { file.close(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "start reading ascii STL file: " + name + "\n"; + VF_LOG_INFO("start reading ascii STL file {}", name); return readASCIISTL(box, name); } else { file.close(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "start reading binary STL file: " + name + "\n"; + VF_LOG_INFO("start reading binary STL file {}", name); std::vector<Triangle> triangles = readBinarySTL(box, name); return triangles; } } else { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "can't open STL-file" + name + "\n"; + VF_LOG_CRITICAL("can't open STL-file {}", name); exit(1); } } @@ -311,7 +311,7 @@ std::vector<Triangle> STLReader::readBinarySTL(const BoundingBox &box, const std sizef = fread(nTri, sizeof(char), 4, file); nTriLong = *((unsigned long*)nTri); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Number of Triangles complete geometry: " << nTriLong << "\n"; + VF_LOG_INFO("Number of Triangles complete geometry: {}", nTriLong); std::vector<Triangle> triangles; char facet[50]; @@ -329,8 +329,8 @@ std::vector<Triangle> STLReader::readBinarySTL(const BoundingBox &box, const std triangles.push_back(t); } int size = (int)triangles.size(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Number of Triangles in process: " << size << "\n"; - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Complete reading STL file. \n"; + VF_LOG_INFO("Number of Triangles in process: {}", size); + VF_LOG_INFO("Complete reading STL file"); (void)sizef; fclose(file); diff --git a/src/gpu/GridGenerator/io/STLReaderWriter/STLWriter.cpp b/src/gpu/GridGenerator/io/STLReaderWriter/STLWriter.cpp index e29320cbd..c1f306839 100644 --- a/src/gpu/GridGenerator/io/STLReaderWriter/STLWriter.cpp +++ b/src/gpu/GridGenerator/io/STLReaderWriter/STLWriter.cpp @@ -42,7 +42,7 @@ void STLWriter::writeSTL(std::vector<Triangle> &vec, const std::string &name, bool writeBinary) { const int size = (int)vec.size(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Write " << size << " Triangles to STL : " + name + "\n"; + VF_LOG_INFO("Write {} Triangles to STL : {}" , size, name); std::ios_base::openmode mode = std::ios::out; if (writeBinary) @@ -51,7 +51,7 @@ void STLWriter::writeSTL(std::vector<Triangle> &vec, const std::string &name, bo std::ofstream ofstream(name, mode); if (!ofstream.is_open()) { - *logging::out << logging::Logger::INFO_HIGH << " Output file not open - exit function\n"; + VF_LOG_WARNING("Output file not open - exit function"); return; } @@ -61,7 +61,7 @@ void STLWriter::writeSTL(std::vector<Triangle> &vec, const std::string &name, bo writeAsciiSTL(ofstream, vec); ofstream.close(); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Output file closed\n"; + VF_LOG_INFO("Output file closed"); } diff --git a/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp b/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp index 0238434dc..7e301dfe4 100644 --- a/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp +++ b/src/gpu/GridGenerator/io/SimulationFileWriter/SimulationFileWriter.cpp @@ -59,13 +59,13 @@ void SimulationFileWriter::write(const std::string& folder, SPtr<GridBuilder> bu { SimulationFileWriter::folder = folder; - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start writing simulation files to " << folder << ":\n"; + VF_LOG_INFO("Start writing simulation files to {}", folder); auto timer = Timer::makeStart(); write(builder, format); - *logging::out << logging::Logger::INFO_INTERMEDIATE << " Time writing files: " << timer->getCurrentRuntimeInSeconds() << " sec\n"; - *logging::out << logging::Logger::INFO_INTERMEDIATE << "Done writing simulation Files!\n"; + VF_LOG_INFO(" Time writing files: {} sec", timer->getCurrentRuntimeInSeconds()); + VF_LOG_INFO("Done writing simulation Files!"); } @@ -79,7 +79,7 @@ void SimulationFileWriter::write(SPtr<GridBuilder> builder, FILEFORMAT format) writeLevel(numberOfLevel); //auto qs = createBCVectors(builder->getGrid(0)); - *logging::out << logging::Logger::INFO_INTERMEDIATE << " Coordinate and neighbor files:\n"; + VF_LOG_INFO(" Coordinate and neighbor files:"); for (uint level = 0; level < numberOfLevel; level++) { writeNumberNodes(builder, level); @@ -95,10 +95,10 @@ void SimulationFileWriter::write(SPtr<GridBuilder> builder, FILEFORMAT format) } } - *logging::out << logging::Logger::INFO_INTERMEDIATE << " Boundary Condition files:\n"; + VF_LOG_INFO(" Boundary Condition files:"); writeBoundaryQsFile(builder); - *logging::out << logging::Logger::INFO_INTERMEDIATE << " Communication files:\n"; + VF_LOG_INFO(" Communication files:"); writeCommunicationFiles(builder); closeFiles(); diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp index 647ab169b..20c46bc2c 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp @@ -390,7 +390,7 @@ void GridReader::initalValuesDomainDecompostion(int level) { //////////////////////////////////////////////////////////////////////////////////////// //send - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for X send buffer, Level " << i << " : " << tempSend << "\n"; + VF_LOG_INFO("size of Data for X send buffer, Level {} : {}", i, tempSend); //////////////////////////////////////////////////////////////////////////////////////// para->setNumberOfProcessNeighborsX((unsigned int)procNeighborsSendX.size(), i, "send"); para->getParH(i)->sendProcessNeighborX[j].rankNeighbor = neighborRankX[j]; diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp index 533382211..21dc23a5a 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp @@ -207,7 +207,7 @@ void GridGenerator::allocArrays_BoundaryValues() for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { const auto numberOfPressureValues = int(builder->getPressureSize(level)); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size pressure level " << level << " : " << numberOfPressureValues << "\n"; + VF_LOG_INFO("size pressure level {}: {}", level, numberOfPressureValues); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->pressureBC.numberOfBCnodes = 0; @@ -227,7 +227,7 @@ void GridGenerator::allocArrays_BoundaryValues() for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { const auto numberOfSlipValues = int(builder->getSlipSize(level)); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size slip level " << level << " : " << numberOfSlipValues << "\n"; + VF_LOG_INFO("size slip level {}: {}", level, numberOfSlipValues); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->slipBC.numberOfBCnodes = 0; @@ -246,7 +246,7 @@ void GridGenerator::allocArrays_BoundaryValues() for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { const auto numberOfStressValues = int(builder->getStressSize(level)); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size stress level " << level << " : " << numberOfStressValues << "\n"; + VF_LOG_INFO("size stress level {}: {}", level, numberOfStressValues); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->stressBC.numberOfBCnodes = 0; @@ -274,7 +274,7 @@ void GridGenerator::allocArrays_BoundaryValues() for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { const auto numberOfVelocityValues = int(builder->getVelocitySize(level)); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size velocity level " << level << " : " << numberOfVelocityValues << "\n"; + VF_LOG_INFO("size velocity level {}: {}", level, numberOfVelocityValues); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->velocityBC.numberOfBCnodes = 0; @@ -300,8 +300,8 @@ void GridGenerator::allocArrays_BoundaryValues() ////////////////////////////////////////////////////////////////////////// para->getParH(level)->TempVel.kTemp = para->getParH(level)->velocityBC.numberOfBCnodes; //cout << "Groesse kTemp = " << para->getParH(i)->TempPress.kTemp << endl; - std::cout << "getTemperatureInit = " << para->getTemperatureInit() << std::endl; - std::cout << "getTemperatureBC = " << para->getTemperatureBC() << std::endl; + VF_LOG_INFO("getTemperatureInit = {}", para->getTemperatureInit()); + VF_LOG_INFO("getTemperatureBC = {}", para->getTemperatureBC()); ////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaAllocTempVeloBC(level); //cout << "nach alloc " << endl; @@ -328,7 +328,7 @@ void GridGenerator::allocArrays_BoundaryValues() for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { const auto numberOfPrecursorValues = int(builder->getPrecursorSize(level)); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size precursor level " << level << " : " << numberOfPrecursorValues << "\n"; + VF_LOG_INFO("size precursor level {}: {}", level, numberOfPrecursorValues); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// blocks = (numberOfPrecursorValues / para->getParH(level)->numberofthreads) + 1; para->getParH(level)->precursorBC.sizeQ = blocks * para->getParH(level)->numberofthreads; @@ -426,7 +426,7 @@ void GridGenerator::allocArrays_BoundaryValues() para->setUseGeometryValues(true); for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { int numberOfGeometryValues = builder->getGeometrySize(level); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size geometry values, Level " << level << " : " << numberOfGeometryValues << "\n"; + VF_LOG_INFO("size geometry values, Level {} : {}", level, numberOfGeometryValues); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->geometryBC.numberOfBCnodes = 0; @@ -521,8 +521,7 @@ void GridGenerator::initalValuesDomainDecompostion() para->getParH(level)->sendProcessNeighborX.back().rankNeighbor = builder->getCommunicationProcess(direction); //////////////////////////////////////////////////////////////////////////////////////// - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for X send buffer, \t\tLevel " << level << " : " << tempSend - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for X send buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempSend, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->sendProcessNeighborX.back().numberOfNodes = tempSend; para->getParD(level)->sendProcessNeighborX.back().numberOfNodes = tempSend; @@ -536,8 +535,7 @@ void GridGenerator::initalValuesDomainDecompostion() para->getParD(level)->sendProcessNeighborX.back().memsizeFs = sizeof(real) * tempSend; //////////////////////////////////////////////////////////////////////////////////////// // recv - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for X receive buffer, \tLevel " << level << " : " << tempRecv - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for X receive buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempRecv, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->recvProcessNeighborX.back().rankNeighbor = builder->getCommunicationProcess(direction); @@ -587,8 +585,7 @@ void GridGenerator::initalValuesDomainDecompostion() } //////////////////////////////////////////////////////////////////////////////////////// // send - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Y send buffer, \t\tLevel " << level << " : " << tempSend - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for Y send buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempSend, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->sendProcessNeighborY.back().rankNeighbor = builder->getCommunicationProcess(direction); @@ -605,8 +602,7 @@ void GridGenerator::initalValuesDomainDecompostion() para->getParD(level)->sendProcessNeighborY.back().memsizeFs = sizeof(real) * tempSend; //////////////////////////////////////////////////////////////////////////////////////// // recv - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Y receive buffer, \tLevel " << level << " : " << tempRecv - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for Y receive buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempRecv, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->recvProcessNeighborY.back().rankNeighbor = builder->getCommunicationProcess(direction); @@ -656,8 +652,7 @@ void GridGenerator::initalValuesDomainDecompostion() } //////////////////////////////////////////////////////////////////////////////////////// // send - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Z send buffer, \t\tLevel " << level << " : " << tempSend - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for Z send buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempSend, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->sendProcessNeighborZ.back().rankNeighbor = builder->getCommunicationProcess(direction); @@ -674,8 +669,7 @@ void GridGenerator::initalValuesDomainDecompostion() para->getParD(level)->sendProcessNeighborZ.back().memsizeFs = sizeof(real) * tempSend; //////////////////////////////////////////////////////////////////////////////////////// // recv - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Z receive buffer, \tLevel " << level << " : " << tempRecv - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for Z receive buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempRecv, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->recvProcessNeighborZ.back().rankNeighbor = builder->getCommunicationProcess(direction); @@ -729,8 +723,7 @@ void GridGenerator::initalValuesDomainDecompostion() if (tempSend > 0) { //////////////////////////////////////////////////////////////////////////////////////// // send - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for X send buffer, \t\tLevel " << level << " : " << tempSend - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for X send buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempSend, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->sendProcessNeighborF3X.back().rankNeighbor = builder->getCommunicationProcess(direction); @@ -749,8 +742,7 @@ void GridGenerator::initalValuesDomainDecompostion() sizeof(real) * para->getParH(level)->sendProcessNeighborF3X.back().numberOfGs; //////////////////////////////////////////////////////////////////////////////////////// // recv - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for X receive buffer, \tLevel " << level << " : " << tempRecv - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for X recv buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempRecv, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->recvProcessNeighborF3X.back().rankNeighbor = builder->getCommunicationProcess(direction); @@ -795,8 +787,7 @@ void GridGenerator::initalValuesDomainDecompostion() if (tempSend > 0) { //////////////////////////////////////////////////////////////////////////////////////// // send - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Y send buffer, \t\tLevel " << level << " : " << tempSend - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for Y send buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempSend, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->sendProcessNeighborF3Y.back().rankNeighbor = builder->getCommunicationProcess(direction); @@ -815,8 +806,7 @@ void GridGenerator::initalValuesDomainDecompostion() sizeof(real) * para->getParH(level)->sendProcessNeighborF3Y.back().numberOfGs; //////////////////////////////////////////////////////////////////////////////////////// // recv - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Y receive buffer, \tLevel " << level << " : " << tempRecv - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for Y recv buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempRecv, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->recvProcessNeighborF3Y.back().rankNeighbor = builder->getCommunicationProcess(direction); @@ -861,8 +851,7 @@ void GridGenerator::initalValuesDomainDecompostion() if (tempSend > 0) { //////////////////////////////////////////////////////////////////////////////////////// // send - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Z send buffer, \t\tLevel " << level << " : " << tempSend - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for Z send buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempSend, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->sendProcessNeighborF3Z.back().rankNeighbor = builder->getCommunicationProcess(direction); @@ -881,8 +870,7 @@ void GridGenerator::initalValuesDomainDecompostion() sizeof(real) * para->getParH(level)->sendProcessNeighborF3Z.back().numberOfGs; //////////////////////////////////////////////////////////////////////////////////////// // recv - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of Data for Z receive buffer, \tLevel " << level << " : " << tempRecv - << " \t(neighbor rank: " << builder->getCommunicationProcess(direction) << ")\n"; + VF_LOG_INFO("size of Data for Z recv buffer, \t\tLevel {}: {} \t(neighbor rank: {})", level, tempRecv, builder->getCommunicationProcess(direction)); //////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->recvProcessNeighborF3Z.back().rankNeighbor = builder->getCommunicationProcess(direction); @@ -927,8 +915,7 @@ void GridGenerator::allocArrays_BoundaryQs() const auto numberOfPressureValues = (int)builder->getPressureSize(i); if (numberOfPressureValues > 0) { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size Pressure: " << i << " : " << numberOfPressureValues << "\n"; - //cout << "Groesse Pressure: " << i << " : " << temp1 << "MyID: " << para->getMyID() << endl; + VF_LOG_INFO("size Pressure: {}: {}", i, numberOfPressureValues); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //preprocessing real* QQ = para->getParH(i)->pressureBC.q27[0]; @@ -947,7 +934,7 @@ void GridGenerator::allocArrays_BoundaryQs() //cout << "vor setzen von kTemp" << endl; para->getParH(i)->TempPress.kTemp = numberOfPressureValues; para->getParD(i)->TempPress.kTemp = numberOfPressureValues; - std::cout << "Groesse TempPress.kTemp = " << para->getParH(i)->TempPress.kTemp << std::endl; + VF_LOG_INFO("size TempPress.kTemp: {}: {}", i, para->getParH(i)->TempPress.kTemp); ////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaAllocTempPressBC(i); //cout << "nach alloc" << endl; @@ -974,8 +961,7 @@ void GridGenerator::allocArrays_BoundaryQs() int numberOfSlipValues = (int)builder->getSlipSize(i); if (numberOfSlipValues > 0) { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size Slip: " << i << " : " << numberOfSlipValues << "\n"; - //cout << "Groesse Pressure: " << i << " : " << temp1 << "MyID: " << para->getMyID() << endl; + VF_LOG_INFO("size Slip: {}: {}", i, numberOfSlipValues); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //preprocessing real* QQ = para->getParH(i)->slipBC.q27[0]; @@ -994,8 +980,7 @@ void GridGenerator::allocArrays_BoundaryQs() int numberOfStressValues = (int)builder->getStressSize(i); if (numberOfStressValues > 0) { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size Stress: " << i << " : " << numberOfStressValues << "\n"; - //cout << "Groesse Pressure: " << i << " : " << temp1 << "MyID: " << para->getMyID() << endl; + VF_LOG_INFO("size Stress: {}: {}", i, numberOfStressValues); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //preprocessing real* QQ = para->getParH(i)->stressBC.q27[0]; @@ -1014,8 +999,7 @@ void GridGenerator::allocArrays_BoundaryQs() const auto numberOfVelocityNodes = int(builder->getVelocitySize(i)); if (numberOfVelocityNodes > 0) { - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size velocity level " << i << " : " << numberOfVelocityNodes << "\n"; - //cout << "Groesse velocity level: " << i << " : " << temp3 << "MyID: " << para->getMyID() << "\n"; + VF_LOG_INFO("size velocity level {}: {}", i, numberOfVelocityNodes); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //preprocessing real* QQ = para->getParH(i)->velocityBC.q27[0]; @@ -1031,9 +1015,11 @@ void GridGenerator::allocArrays_BoundaryQs() std::cout << "Groesse TempVel.kTemp = " << para->getParH(i)->TempPress.kTemp << std::endl; std::cout << "getTemperatureInit = " << para->getTemperatureInit() << std::endl; std::cout << "getTemperatureBC = " << para->getTemperatureBC() << std::endl; + VF_LOG_INFO("size TempVel.kTemp: {}", para->getParH(i)->TempVel.kTemp); + VF_LOG_INFO("getTemperatureInit: {}", para->getTemperatureInit()); + VF_LOG_INFO("getTemperatureBC: {}", para->getTemperatureBC()); ////////////////////////////////////////////////////////////////////////// cudaMemoryManager->cudaAllocTempVeloBC(i); - //cout << "nach alloc " << "\n"; ////////////////////////////////////////////////////////////////////////// for (int m = 0; m < numberOfVelocityNodes; m++) { @@ -1042,11 +1028,7 @@ void GridGenerator::allocArrays_BoundaryQs() para->getParH(i)->TempVel.velo[m] = para->getVelocity(); para->getParH(i)->TempVel.k[m] = para->getParH(i)->velocityBC.k[m]; } - ////////////////////////////////////////////////////////////////////////// - //cout << "vor copy " << "\n"; cudaMemoryManager->cudaCopyTempVeloBCHD(i); - //cout << "nach copy " << "\n"; - ////////////////////////////////////////////////////////////////////////// } cudaMemoryManager->cudaCopyVeloBC(i); } @@ -1056,7 +1038,7 @@ void GridGenerator::allocArrays_BoundaryQs() const auto numberOfPrecursorNodes = int(builder->getPrecursorSize(i)); if (numberOfPrecursorNodes > 0) { - std::cout << "size velocity level " << i << " : " << numberOfPrecursorNodes << std::endl; + VF_LOG_INFO("size velocity level {}: {}", i, numberOfPrecursorNodes); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //preprocessing real* QQ = para->getParH(i)->precursorBC.q27[0]; @@ -1099,7 +1081,7 @@ void GridGenerator::allocArrays_BoundaryQs() for (uint i = 0; i < builder->getNumberOfGridLevels(); i++) { const int numberOfGeometryNodes = builder->getGeometrySize(i); - *logging::out << logging::Logger::INFO_INTERMEDIATE << "size of GeomBoundaryQs, Level " << i << " : " << numberOfGeometryNodes << "\n"; + VF_LOG_INFO("size of GeomBoundaryQs, Level {}: {}", i, numberOfGeometryNodes); para->getParH(i)->geometryBC.numberOfBCnodes = numberOfGeometryNodes; para->getParD(i)->geometryBC.numberOfBCnodes = para->getParH(i)->geometryBC.numberOfBCnodes; diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp index 3009bc4ae..23d858f5b 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGeneratorTest.cpp @@ -104,9 +104,6 @@ protected: private: void SetUp() override { - logging::Logger::addStream(&std::cout); - logging::Logger::setDebugLevel(logging::Logger::WARNING); - para = std::make_shared<Parameter>(); para->setMaxLevel(level + 1); // setMaxLevel resizes parH and parD for (uint i = 0; i <= level; i++) { diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp index 542eb07ec..3fe223948 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/IndexRearrangementForStreamsTest.cpp @@ -119,8 +119,6 @@ protected: private: void SetUp() override { - logging::Logger::addStream(&std::cout); - SPtr<GridImpDouble> grid = GridImpDouble::makeShared(nullptr, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, Distribution(), 1); std::shared_ptr<LevelGridBuilderDouble> builder = std::make_shared<LevelGridBuilderDouble>(grid); @@ -216,8 +214,6 @@ protected: private: void SetUp() override { - logging::Logger::addStream(&std::cout); - para = testingVF::createParameterForLevel(level); para->setNumberOfProcessNeighborsX(numberOfProcessNeighbors, level, "send"); @@ -337,8 +333,6 @@ protected: private: void SetUp() override { - logging::Logger::addStream(&std::cout); - para = testingVF::createParameterForLevel(level); para->setNumberOfProcessNeighborsY(numberOfProcessNeighbors, level, "send"); @@ -458,8 +452,6 @@ protected: private: void SetUp() override { - logging::Logger::addStream(&std::cout); - para = testingVF::createParameterForLevel(level); para->setNumberOfProcessNeighborsZ(numberOfProcessNeighbors, level, "send"); diff --git a/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu b/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu index 54968be40..e447062d2 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/EnstrophyAnalyzer.cu @@ -325,7 +325,6 @@ EnstrophyAnalyzer::EnstrophyAnalyzer(SPtr<Parameter> para, uint analyzeIter) void EnstrophyAnalyzer::writeToFile( std::string filename ) { - //*logging::out << logging::Logger::INFO_INTERMEDIATE << "EnstrophyAnalyzer::writeToFile( " << filename << " )" << "\n"; std::cout << "EnstrophyAnalyzer::writeToFile( " << filename << " )" << "\n"; std::ofstream file; @@ -338,7 +337,6 @@ void EnstrophyAnalyzer::writeToFile( std::string filename ) file.close(); std::cout << "done!\n"; - //*logging::out << logging::Logger::INFO_INTERMEDIATE << "done!\n"; } diff --git a/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu b/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu index bc847aee5..df88632f8 100644 --- a/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu +++ b/src/gpu/VirtualFluids_GPU/GPU/KineticEnergyAnalyzer.cu @@ -139,7 +139,6 @@ KineticEnergyAnalyzer::KineticEnergyAnalyzer(SPtr<Parameter> para, uint analyzeI void KineticEnergyAnalyzer::writeToFile(std::string filename) { - //*logging::out << logging::Logger::INFO_INTERMEDIATE << "KineticEnergyAnalyzer::writeToFile( " << filename << " )" << "\n"; std::cout << "KineticEnergyAnalyzer::writeToFile( " << filename << " )" << "\n"; std::ofstream file; @@ -151,7 +150,6 @@ void KineticEnergyAnalyzer::writeToFile(std::string filename) file.close(); - //*logging::out << logging::Logger::INFO_INTERMEDIATE << "done!\n"; std::cout << "done!\n"; } -- GitLab