diff --git a/3rdParty/fftw/fftw-3.3.7/CMakeLists.txt b/3rdParty/fftw/fftw-3.3.7/CMakeLists.txt index e2155c440bacff38adb3419224dac051611c2771..52e70d7d00f538d7b1404707d24ba1305aaf4ea3 100644 --- a/3rdParty/fftw/fftw-3.3.7/CMakeLists.txt +++ b/3rdParty/fftw/fftw-3.3.7/CMakeLists.txt @@ -10,8 +10,8 @@ if (POLICY CMP0042) cmake_policy (SET CMP0042 NEW) endif () -option (BUILD_SHARED_LIBS "Build shared libraries" ON) -option (BUILD_TESTS "Build tests" OFF) +#option (BUILD_SHARED_LIBS "Build shared libraries" ON) +#option (BUILD_TESTS "Build tests" OFF) option (ENABLE_OPENMP "Use OpenMP for multithreading" OFF) option (ENABLE_THREADS "Use pthread for multithreading" OFF) @@ -335,7 +335,8 @@ if (OPENMP_FOUND) target_compile_options (${fftw3_lib}_omp PRIVATE ${OpenMP_C_FLAGS}) endif () -groupTarget(${fftw3_lib} ${thirdPartyFolder}) +groupTarget(${fftw3_lib} ${thirdFolder}) +target_include_directories(${fftw3_lib} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/api) foreach(subtarget ${subtargets}) set_target_properties (${subtarget} PROPERTIES SOVERSION 3.5.7 VERSION 3) @@ -344,16 +345,23 @@ foreach(subtarget ${subtargets}) LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) endforeach () -install(TARGETS ${fftw3_lib} - EXPORT FFTW3LibraryDepends - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -install (FILES api/fftw3.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -if (EXISTS api/fftw3.f) - install (FILES api/fftw3.f DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -endif () +#install(TARGETS ${fftw3_lib} +# EXPORT FFTW3LibraryDepends +# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +set_target_properties(${fftw3_lib} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") + +#install (FILES api/fftw3.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +#if (EXISTS api/fftw3.f) +# install (FILES api/fftw3.f DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +#endif () if (BUILD_TESTS) @@ -380,30 +388,30 @@ if (BUILD_TESTS) endif () endif () -# pkgconfig file -set (prefix ${CMAKE_INSTALL_PREFIX}) -set (exec_prefix ${CMAKE_INSTALL_PREFIX}) -set (libdir ${CMAKE_INSTALL_FULL_LIBDIR}) -set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) -set (VERSION ${FFTW_VERSION}) -configure_file (fftw.pc.in fftw${PREC_SUFFIX}.pc @ONLY) -install (FILES - ${CMAKE_CURRENT_BINARY_DIR}/fftw${PREC_SUFFIX}.pc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig - COMPONENT Development) - -# cmake file -set (FFTW3_LIBRARIES "FFTW3::${fftw3_lib}") -configure_file (FFTW3Config.cmake.in FFTW3${PREC_SUFFIX}Config.cmake @ONLY) -configure_file (FFTW3ConfigVersion.cmake.in FFTW3${PREC_SUFFIX}ConfigVersion.cmake @ONLY) -install (FILES - ${CMAKE_CURRENT_BINARY_DIR}/FFTW3${PREC_SUFFIX}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/FFTW3${PREC_SUFFIX}ConfigVersion.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fftw3${PREC_SUFFIX} - COMPONENT Development) - -export (TARGETS ${fftw3_lib} NAMESPACE FFTW3:: FILE ${PROJECT_BINARY_DIR}/FFTW3LibraryDepends.cmake) -install(EXPORT FFTW3LibraryDepends - NAMESPACE FFTW3:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fftw3${PREC_SUFFIX} - COMPONENT Development) +## pkgconfig file +#set (prefix ${CMAKE_INSTALL_PREFIX}) +#set (exec_prefix ${CMAKE_INSTALL_PREFIX}) +#set (libdir ${CMAKE_INSTALL_FULL_LIBDIR}) +#set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) +#set (VERSION ${FFTW_VERSION}) +#configure_file (fftw.pc.in fftw${PREC_SUFFIX}.pc @ONLY) +#install (FILES +# ${CMAKE_CURRENT_BINARY_DIR}/fftw${PREC_SUFFIX}.pc +# DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +# COMPONENT Development) +# +## cmake file +#set (FFTW3_LIBRARIES "FFTW3::${fftw3_lib}") +#configure_file (FFTW3Config.cmake.in FFTW3${PREC_SUFFIX}Config.cmake @ONLY) +#configure_file (FFTW3ConfigVersion.cmake.in FFTW3${PREC_SUFFIX}ConfigVersion.cmake @ONLY) +#install (FILES +# ${CMAKE_CURRENT_BINARY_DIR}/FFTW3${PREC_SUFFIX}Config.cmake +# ${CMAKE_CURRENT_BINARY_DIR}/FFTW3${PREC_SUFFIX}ConfigVersion.cmake +# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fftw3${PREC_SUFFIX} +# COMPONENT Development) +# +#export (TARGETS ${fftw3_lib} NAMESPACE FFTW3:: FILE ${PROJECT_BINARY_DIR}/FFTW3LibraryDepends.cmake) +#install(EXPORT FFTW3LibraryDepends +# NAMESPACE FFTW3:: +# DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/fftw3${PREC_SUFFIX} +# COMPONENT Development) diff --git a/CMake/FileUtilities.cmake b/CMake/FileUtilities.cmake index 23e256dfd85b91b1980d168c676ef6a1d2b758ea..4d42efcedd5d6a06d3d1ca12106e26c0ac875b93 100644 --- a/CMake/FileUtilities.cmake +++ b/CMake/FileUtilities.cmake @@ -6,16 +6,26 @@ ################################################################################# macro(includeAllFiles targetName file_path) - set(collectTestFiles ON) - set(collectProductionFiles ON) + if(NOT DEFINED collectTestFiles) + set(collectTestFiles ON) + endif() + + if(NOT DEFINED collectProductionFiles) + set(collectProductionFiles ON) + endif() includeFiles(${targetName} "${file_path}") endmacro(includeAllFiles) macro(includeProductionFiles targetName file_path) - set(collectTestFiles OFF) - set(collectProductionFiles ON) + if(NOT DEFINED collectTestFiles) + set(collectTestFiles OFF) + endif() + + if(NOT DEFINED collectProductionFiles) + set(collectProductionFiles ON) + endif() includeFiles(${targetName} "${file_path}") endmacro(includeProductionFiles) @@ -23,8 +33,13 @@ endmacro(includeProductionFiles) macro(includeTestFiles targetName file_paths) - set(collectTestFiles ON) - set(collectProductionFiles OFF) + if(NOT DEFINED collectTestFiles) + set(collectTestFiles ON) + endif() + + if(NOT DEFINED collectProductionFiles) + set(collectProductionFiles OFF) + endif() includeFiles(${targetName} "${file_paths}") endmacro(includeTestFiles) @@ -47,6 +62,9 @@ macro(includeFiles targetName file_paths) endforeach() + unset(collectTestFiles) + unset(collectProductionFiles) + endmacro(includeFiles) diff --git a/CMake/VirtualFluidsMacros.cmake b/CMake/VirtualFluidsMacros.cmake index 676353ea2c2e03f2f55e096948643f85f8b87ec0..b17d4a3b8d6e08e5d21039ad644950438f07f1ae 100644 --- a/CMake/VirtualFluidsMacros.cmake +++ b/CMake/VirtualFluidsMacros.cmake @@ -84,6 +84,8 @@ function (vf_get_library_test_name library_test_name) endfunction() + + ################################################################################# ## Add a target, link the libraries and add the compiler flags to the target ## @@ -116,8 +118,7 @@ function(vf_add_library) collectFiles(sourceFiles "${ARG_FILES}" "${ARG_FOLDER}" "${ARG_EXCLUDE}") - includeProductionFiles (${library_name} "${sourceFiles}") - + includeProductionFiles(${library_name} "${sourceFiles}") ################################################################# ### EXCECUTABLE ### diff --git a/CMake/compilerflags/AppleClang.cmake b/CMake/compilerflags/AppleClang.cmake index ef97a54a4ebe17bde5e016e04a40a187371172e9..f84d6f27ec4a28bb86ad224f86b2866037a6a2e9 100644 --- a/CMake/compilerflags/AppleClang.cmake +++ b/CMake/compilerflags/AppleClang.cmake @@ -14,11 +14,6 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O3;-fomit-frame-pointer; ############################################################################################################# LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") -############################################################################################################# -# c++ 11 support -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++11") - # test #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE "-Wall") @@ -31,11 +26,6 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-deprecated") #deprec #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wbackslash-newline-escape") #backslash and newline separated by space LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wcomment") #'/*' within block comment -############################################################################################################# -# c++ 17 support -############################################################################################################# -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++17") -#LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-std=c++17") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-fext-numeric-literals") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0") diff --git a/CMake/compilerflags/Clang.cmake b/CMake/compilerflags/Clang.cmake index 4e79d520c0b91a41d62f658092489941926bda05..4e473e381ff7d9dc36e0a910e4504d355fb0ca60 100644 --- a/CMake/compilerflags/Clang.cmake +++ b/CMake/compilerflags/Clang.cmake @@ -14,10 +14,6 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O3;-fomit-frame-pointer; ############################################################################################################# LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") -############################################################################################################# -# c++ 11 support -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++11") ############################################################################################################# # disable warning @@ -26,11 +22,6 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-deprecated") #deprec #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wbackslash-newline-escape") #backslash and newline separated by space LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wcomment") #'/*' within block comment -############################################################################################################# -# c++ 17 support -############################################################################################################# -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++17") -#LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-std=c++17") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-fext-numeric-literals") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0") diff --git a/CMake/compilerflags/GNU.cmake b/CMake/compilerflags/GNU.cmake index 08dc75adc01375fc35ddd46bc00ae539dce4c96c..54a11f02a661b85a80fb7ce7fe9cfb8c60b04b0d 100644 --- a/CMake/compilerflags/GNU.cmake +++ b/CMake/compilerflags/GNU.cmake @@ -10,16 +10,7 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-deprecated") #deprec ############################################################################################################# LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") -############################################################################################################# -# c++ 11 support -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++11") -############################################################################################################# -# c++ 17 support -############################################################################################################# -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++17") -#LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-std=c++17") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-fext-numeric-literals") #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0") @@ -28,3 +19,5 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++11") list(APPEND VF_LINK_OPTIONS -lgomp) list(APPEND VF_LINK_OPTIONS -lrt) + +list(APPEND VF_LINK_OPTIONS -ldl) diff --git a/CMake/compilerflags/Intel.cmake b/CMake/compilerflags/Intel.cmake index 4f4c7bb3ed2dad45a6f91e644fa0d74e5b4d98be..83cb9f74c500cc748a6a1e8c7440fa643d314451 100644 --- a/CMake/compilerflags/Intel.cmake +++ b/CMake/compilerflags/Intel.cmake @@ -24,11 +24,6 @@ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-xHOST;-O3;-ip;-fno-alias ############################################################################################################### #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") -############################################################################################################# -# c++ 11 support -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-std=c++11") - list(APPEND VF_LINK_OPTIONS -parallel) list(APPEND VF_LINK_OPTIONS -irc) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01f46ac17ebe0a821ee6ba80489985591e604495..fbea2c2bdaca6f61428cffd6440d5eb3cddc0eaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,9 @@ project(VirtualFluids CXX) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CUDA_STANDARD 14) +set(CMAKE_CUDA_STANDARD_REQUIRED TRUE) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER ".cmake") set(libraryFolder "libs") @@ -45,6 +48,7 @@ option(BUILD_SHARED_LIBS "" ON) if(POLICY CMP0104) cmake_policy(SET CMP0104 NEW) set(CMAKE_CUDA_ARCHITECTURES 30) + # with cuda 11 the minimum architecture is 52 endif() ################################################################################# diff --git a/apps/gpu/tests/NumericalTestPostProcessing/3rdPartyLinking.cmake b/apps/gpu/tests/NumericalTestPostProcessing/3rdPartyLinking.cmake deleted file mode 100644 index 9bba373d677af90361bd87eda881973bcb70793a..0000000000000000000000000000000000000000 --- a/apps/gpu/tests/NumericalTestPostProcessing/3rdPartyLinking.cmake +++ /dev/null @@ -1,10 +0,0 @@ -#include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/GMock/Link.cmake) -#linkGMock(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake) -linkCuda(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MPI/Link.cmake) -linkMPI(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) -linkBoost(${targetName} "") -#include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MathLink/Link.cmake) -#linkMathLink(${targetName}) \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTestPostProcessing/CMakeLists.txt b/apps/gpu/tests/NumericalTestPostProcessing/CMakeLists.txt index 1ff89574c313cad237fa2196c8d6c58f1c21e9b7..137e2aa041030193afd2a8d52e3787fc845ab87d 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/CMakeLists.txt +++ b/apps/gpu/tests/NumericalTestPostProcessing/CMakeLists.txt @@ -1,14 +1,6 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) +project(NumericalTestPostProcessing) -set(linkDirectories "") -set(libsToLink VirtualFluids_GPU cudart_static VirtualFluidsBasics) -set(includeDirectories ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/VirtualFluids_GPU ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics) +vf_add_library(BUILDTYPE binary DEPENDS VirtualFluids_GPU basics cudart_static) -#glob files and save in MY_SRCS -include(CMakePackage.cmake) - -buildExe(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -groupTarget(${targetName} ${testFolder}) - -#Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) \ No newline at end of file +vf_get_library_name(library_name) +groupTarget(${library_name} ${testFolder}) diff --git a/apps/gpu/tests/NumericalTestPostProcessing/CMakePackage.cmake b/apps/gpu/tests/NumericalTestPostProcessing/CMakePackage.cmake deleted file mode 100644 index 317ed1a80f5c28a26ca65b4ade1d20ca1b422f0b..0000000000000000000000000000000000000000 --- a/apps/gpu/tests/NumericalTestPostProcessing/CMakePackage.cmake +++ /dev/null @@ -1,7 +0,0 @@ -#FILE ENDINGS -resetFileEndingsToCollect() -addCAndCPPFileTypes() - -#GLOB SOURCE FILES IN MY_SRCS -unset(MY_SRCS) -includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR}) \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/AlmostEquals.h b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/AlmostEquals.h index 72922c8a0b5660645ae36e6745da210ae5505c27..fd467aaa9ec710d909d4537aba3da7d9921bb59a 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/AlmostEquals.h +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/AlmostEquals.h @@ -37,6 +37,7 @@ #pragma once #include <limits> +#include <float.h> // This template class serves as a compile-time function from size to // type. It maps a size in bytes to a primitive type with that diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileDataAssistant/LogFileDataAssistant.h b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileDataAssistant/LogFileDataAssistant.h index ad0fe85a7d7cfc3324d9f23806bd247263270b2a..c3e78cf9aa122cdef1e49dc30dacc17ec5b39927 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileDataAssistant/LogFileDataAssistant.h +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileDataAssistant/LogFileDataAssistant.h @@ -5,6 +5,7 @@ #include <memory> #include <vector> +#include <string> enum DataCombination{ EqualSimulationsForDifferentKernels , EqualKernelSimulationsForDifferentViscosities}; diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileReader/LogFileReader.cpp b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileReader/LogFileReader.cpp index b100b2277d2d0672f259f551d79dc08c58625726..0f254c99746a98f0e8f2323ba0f89e73e9317052 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileReader/LogFileReader.cpp +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/LogFileReader/LogFileReader.cpp @@ -19,6 +19,7 @@ #include <filesystem> #include <fstream> #include <iostream> +#include <cstring> std::shared_ptr<LogFileReader> LogFileReader::getInstance() { @@ -42,16 +43,16 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string std::unique_ptr<input::Input> input = input::Input::makeInput(stream, "config"); logFileData->setFilePath(filePath); - logFileData->setDate(StringUtil::toString(input->getValue("Date"))); - logFileData->setTime(StringUtil::toString(input->getValue("Time"))); + logFileData->setDate(input->getValue("Date")); + logFileData->setTime(input->getValue("Time")); logFileData->setGpuDevices(StringUtil::toStringVector(input->getValue("GPU_Devices"))); - logFileData->setKernel(StringUtil::toString(input->getValue("Kernel"))); + logFileData->setKernel(input->getValue("Kernel")); logFileData->setNumberOfTimeSteps(StringUtil::toInt(input->getValue("NumberOfTimeSteps"))); logFileData->setViscosity(StringUtil::toDouble(input->getValue("Viscosity"))); logFileData->setBasisTimeStepLength(StringUtil::toInt(input->getValue("BasisTimeStepLength"))); - logFileData->setSimName(StringUtil::toString(input->getValue("SimulationName"))); + logFileData->setSimName(input->getValue("SimulationName")); @@ -139,10 +140,10 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string resultsCheckTimeOStringStream << "ResultsCheckTime_" << logFileData->getBasicGridLengths().at(i); testTimeOStringStream << "TestTime_" << logFileData->getBasicGridLengths().at(i); analyticalVTKWritingTimeOStringStream << "AnalyticalVTKFileWritingTime_" << logFileData->getBasicGridLengths().at(i); - std::string simTimeString = StringUtil::toString(input->getValue(simTimeOStringStream.str())); - std::string resultCheckTimeString = StringUtil::toString(input->getValue(resultsCheckTimeOStringStream.str())); - std::string testTimeString = StringUtil::toString(input->getValue(testTimeOStringStream.str())); - std::string analyticalVTKWritingTimeString = StringUtil::toString(input->getValue(analyticalVTKWritingTimeOStringStream.str())); + std::string simTimeString = input->getValue(simTimeOStringStream.str()); + std::string resultCheckTimeString = input->getValue(resultsCheckTimeOStringStream.str()); + std::string testTimeString = input->getValue(testTimeOStringStream.str()); + std::string analyticalVTKWritingTimeString = input->getValue(analyticalVTKWritingTimeOStringStream.str()); simTimeString.erase(simTimeString.end() - 3, simTimeString.end()); resultCheckTimeString.erase(resultCheckTimeString.end() - 3, resultCheckTimeString.end()); testTimeString.erase(testTimeString.end() - 3, testTimeString.end()); @@ -392,7 +393,7 @@ std::shared_ptr<LogFileData> LogFileReader::readLogFileToLogFileData(std::string std::vector<double> l2NormDivergentKernel; std::vector<double> l2NormBetweenKernels; std::shared_ptr<L2NormBetweenKernelsLogFileDataImp> aL2NormLogFileData = L2NormBetweenKernelsLogFileDataImp::getNewInstance(); - aL2NormLogFileData->setBasicKernel(StringUtil::toString(input->getValue("BasicKernel_L2Norm_BK"))); + aL2NormLogFileData->setBasicKernel(input->getValue("BasicKernel_L2Norm_BK")); aL2NormLogFileData->setDivergentKernel(logFileData->getKernel()); aL2NormLogFileData->setDataToCalculate(dataToCalc.at(i)); aL2NormLogFileData->setTimeStep(timeSteps.at(j)); @@ -492,12 +493,12 @@ LogFileReader::LogFileReader() std::vector<std::string> LogFileReader::getAllFilesInDir(const std::string &dirPath, const std::string &fileExtension) { std::vector<std::string> listOfFiles; - std::experimental::filesystem::path myPath = dirPath; - if (std::experimental::filesystem::exists(myPath) && std::experimental::filesystem::is_directory(myPath)) + std::filesystem::path myPath = dirPath; + if (std::filesystem::exists(myPath) && std::filesystem::is_directory(myPath)) { - for (auto& item : std::experimental::filesystem::recursive_directory_iterator(myPath)) + for (auto& item : std::filesystem::recursive_directory_iterator(myPath)) { - if (std::experimental::filesystem::is_regular_file(item.path()) && item.path().extension() == fileExtension) + if (std::filesystem::is_regular_file(item.path()) && item.path().extension() == fileExtension) listOfFiles.push_back(item.path().string()); } } @@ -506,7 +507,7 @@ std::vector<std::string> LogFileReader::getAllFilesInDir(const std::string &dirP std::string LogFileReader::removeCharsFromString(std::string str, char * charsToRemove) { - for (unsigned int i = 0; i < strlen(charsToRemove); ++i) + for (unsigned int i = 0; i < std::strlen(charsToRemove); ++i) str.erase(remove(str.begin(), str.end(), charsToRemove[i]), str.end()); return str; } diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaAssistant/MathematicaAssistant.h b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaAssistant/MathematicaAssistant.h index 7d6f326366f2f7001ba3db1192ee7472ba0a9041..cfbcf42eb7a171e6e8840de9f56ce0ec2541611e 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaAssistant/MathematicaAssistant.h +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaAssistant/MathematicaAssistant.h @@ -3,6 +3,7 @@ #include <memory> #include <vector> +#include <string> enum Assistant{Phi, Ny, L2Norm, L2NormBetweenKernels, Time }; diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaAssistant/MathematicaAssistantImp.cpp b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaAssistant/MathematicaAssistantImp.cpp index 26cedc408c58d4c66d45dd33d0ee249ebd0400a8..ef041d1cf5cd86f436a7acb9aed37c7e072a7c57 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaAssistant/MathematicaAssistantImp.cpp +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaAssistant/MathematicaAssistantImp.cpp @@ -3,6 +3,9 @@ #include "Utilities/DataPoint/DataPoint.h" #include "Utilities/MathematicaFunctionFactory/MathematicaFunctionFactory.h" +#include <cmath> + + MathematicaAssistantImp::MathematicaAssistantImp() { } @@ -137,7 +140,7 @@ void MathematicaAssistantImp::addFourthOrderOfAccuracyRef(std::vector<std::vecto } std::vector<double> fourth = { minData / 10.0 }; for (int l = 1; l < x.size(); l++) - fourth.push_back(fourth.at(l - 1) / exp(-4.0 * log(x.at(l - 1) / x.at(l)))); + fourth.push_back(fourth.at(l - 1) / std::exp(-4.0 * std::log(x.at(l - 1) / x.at(l)))); xAxesData.push_back(x); diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFile/MathematicaFile.cpp b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFile/MathematicaFile.cpp index 5e155fb1935ab14c4c7aeee5f1ccf3c34bcada30..84e7ee049ff8a1c1ec3def666f7a49bfc561312b 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFile/MathematicaFile.cpp +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFile/MathematicaFile.cpp @@ -3,7 +3,7 @@ #include "Utilities/MathematicaFunction/MathematicaFunktion.h" #include <ctime> -#include <experimental/filesystem> +#include <filesystem> #include <iomanip> #include <sstream> @@ -24,7 +24,7 @@ void MathematicaFile::finishFile() fileFinished = true; myFile.close(); - std::experimental::filesystem::rename(filePathTxtFile, filePathMathematicaFile); + std::filesystem::rename(filePathTxtFile, filePathMathematicaFile); std::system(filePathMathematicaFile.c_str()); } } diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/LinePlot/MathematicaListPlotImp.cpp b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/LinePlot/MathematicaListPlotImp.cpp index e8508061686cba1092f0f85012d3a9b81b6fc439..15cf9bdb90a9ddbf723c89e7a8965e0d5e4dbdac 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/LinePlot/MathematicaListPlotImp.cpp +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunction/LinePlot/MathematicaListPlotImp.cpp @@ -1,6 +1,6 @@ #include "MathematicaListPlotImp.h" -#include "Utilities\MathematicaFunction\PointList\MathematicaPointList.h" +#include "Utilities/MathematicaFunction/PointList/MathematicaPointList.h" std::shared_ptr<MathematicaListPlot> MathematicaListPlotImp::getNewInstance(std::vector<std::shared_ptr<MathematicaPointList>> pointList, std::string plotType, std::string xAxes, std::string yAxes) { diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/ListLinePlot/MathematicaListLinePlot.h b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/ListLinePlot/MathematicaListLinePlot.h index 21cb2f48156932db7730413935f690d92f78b925..665f596bbef4e55de3084ecf8f2f8b53c13201e8 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/ListLinePlot/MathematicaListLinePlot.h +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/ListLinePlot/MathematicaListLinePlot.h @@ -1,7 +1,7 @@ #ifndef MATHEMATICA_PLOT_H #define MATHEMATICA_PLOT_H -#include "../MathematicaFunktionImp.h" +#include "Utilities/MathematicaFunction/MathematicaFunktionImp.h" #include <memory> #include <vector> diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/PointList/MathematicaPointList.cpp b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/PointList/MathematicaPointList.cpp index ab6b2b2805bea3d39e78b51ee942a6eba258e820..7bacbc329e2daa359e6e0f8bcb3b4f14bd04d3b6 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/PointList/MathematicaPointList.cpp +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/PointList/MathematicaPointList.cpp @@ -1,6 +1,6 @@ #include "MathematicaPointList.h" -#include "Utilities\DataPoint\DataPoint.h" +#include "Utilities/DataPoint/DataPoint.h" std::shared_ptr<MathematicaPointList> MathematicaPointList::getNewInstance(std::string listName, std::vector< std::shared_ptr< DataPoint>> plotData) { diff --git a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/PointList/MathematicaPointList.h b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/PointList/MathematicaPointList.h index 2fa4e35db2c4aa9c0acb8196d246a39cc73b99ec..99869b1bc8d004834803efb51610597c655bd28e 100644 --- a/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/PointList/MathematicaPointList.h +++ b/apps/gpu/tests/NumericalTestPostProcessing/Utilities/MathematicaFunktion/PointList/MathematicaPointList.h @@ -1,7 +1,7 @@ #ifndef MATHEMATICA_POINT_LIST_H #define MATHEMATICA_POINT_LIST_H -#include "../MathematicaFunktionImp.h" +#include "Utilities/MathematicaFunction/MathematicaFunktionImp.h" #include <memory> #include <vector> diff --git a/apps/gpu/tests/NumericalTests/3rdPartyLinking.cmake b/apps/gpu/tests/NumericalTests/3rdPartyLinking.cmake deleted file mode 100644 index dd9d2ded976fe58dcd0fb3fb0527c53c2d466334..0000000000000000000000000000000000000000 --- a/apps/gpu/tests/NumericalTests/3rdPartyLinking.cmake +++ /dev/null @@ -1,10 +0,0 @@ -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/GMock/Link.cmake) -linkGMock(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake) -linkCuda(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MPI/Link.cmake) -linkMPI(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/fftw/Link.cmake) -linkFftw(${targetName}) -include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) -linkBoost(${targetName} "") diff --git a/apps/gpu/tests/NumericalTests/CMakeLists.txt b/apps/gpu/tests/NumericalTests/CMakeLists.txt index 1ff89574c313cad237fa2196c8d6c58f1c21e9b7..cf4cf7213037f43b0ee5027a407228f0149d5f41 100644 --- a/apps/gpu/tests/NumericalTests/CMakeLists.txt +++ b/apps/gpu/tests/NumericalTests/CMakeLists.txt @@ -1,14 +1,16 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) +project(NumericalTestsGPU) +set(collectTestFiles ON) +vf_add_library(BUILDTYPE binary DEPENDS VirtualFluids_GPU GridGenerator basics fftw3 gtest gmock gmock_main cudart_static) -set(linkDirectories "") -set(libsToLink VirtualFluids_GPU cudart_static VirtualFluidsBasics) -set(includeDirectories ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/VirtualFluids_GPU ${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics) +vf_get_library_name(library_name) +groupTarget(${library_name} ${testFolder}) -#glob files and save in MY_SRCS -include(CMakePackage.cmake) +if(BUILD_SHARED_LIBS) + # add compile option according to + # https://github.com/google/googletest/blob/master/googletest/README.md#as-a-shared-library-dll + set_target_properties(${library_name} + PROPERTIES + COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1") +endif() -buildExe(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -groupTarget(${targetName} ${testFolder}) - -#Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) \ No newline at end of file +linkCUDA() diff --git a/apps/gpu/tests/NumericalTests/CMakePackage.cmake b/apps/gpu/tests/NumericalTests/CMakePackage.cmake deleted file mode 100644 index 317ed1a80f5c28a26ca65b4ade1d20ca1b422f0b..0000000000000000000000000000000000000000 --- a/apps/gpu/tests/NumericalTests/CMakePackage.cmake +++ /dev/null @@ -1,7 +0,0 @@ -#FILE ENDINGS -resetFileEndingsToCollect() -addCAndCPPFileTypes() - -#GLOB SOURCE FILES IN MY_SRCS -unset(MY_SRCS) -includeRecursiveAllFilesFrom(${targetName} ${CMAKE_CURRENT_LIST_DIR}) \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Tests/NyTest/NyTest.cpp b/apps/gpu/tests/NumericalTests/Tests/NyTest/NyTest.cpp index 6ab597e5bbb90823053dfc60c9b466f63beed1c7..e3e7932e9d77481c26d3e9ffb80ce614de0d817c 100644 --- a/apps/gpu/tests/NumericalTests/Tests/NyTest/NyTest.cpp +++ b/apps/gpu/tests/NumericalTests/Tests/NyTest/NyTest.cpp @@ -8,6 +8,7 @@ #include "Tests/NyTest/NyTestParameterStruct.h" #include <iomanip> +#include <cmath> std::shared_ptr<NyTest> NyTest::getNewInstance(std::shared_ptr<ColorConsoleOutput> colorOutput, double viscosity, std::shared_ptr<NyTestParameterStruct> testPara, std::string dataToCalculate) { @@ -84,7 +85,7 @@ NyTest::NyTest(std::shared_ptr<ColorConsoleOutput> colorOutput, double viscosity double NyTest::calcOrderOfAccuracy(std::vector<double> data) { - double ooa = log(data.at(0) / data.at(1)) / log(lx.at(1) / lx.at(0)); + double ooa = std::log(data.at(0) / data.at(1)) / std::log(lx.at(1) / lx.at(0)); return ooa; } diff --git a/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp b/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp index ea8519cc090a8c2b0319e96a5a733a80ef6165ae..e3d749293793250893c78958eaa777fd1f3b87d7 100644 --- a/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp +++ b/apps/gpu/tests/NumericalTests/Tests/PhiTest/PhiTest.cpp @@ -8,6 +8,7 @@ #include "Tests/PhiTest/PhiTestParameterStruct.h" #include <iomanip> +#include <cmath> std::shared_ptr<PhiTest> PhiTest::getNewInstance(std::shared_ptr<ColorConsoleOutput> colorOutput, double viscosity, std::shared_ptr<PhiTestParameterStruct> testPara, std::string dataToCalculate) { @@ -72,7 +73,7 @@ PhiTest::PhiTest(std::shared_ptr<ColorConsoleOutput> colorOutput, double viscosi double PhiTest::calcOrderOfAccuracy(std::vector<double> data) { - double ooa = log(data.at(0) / data.at(1)) / log(lx.at(1) / lx.at(0)); + double ooa = std::log(data.at(0) / data.at(1)) / std::log(lx.at(1) / lx.at(0)); return ooa; } diff --git a/apps/gpu/tests/NumericalTests/Utilities/Calculator/AlmostEquals.h b/apps/gpu/tests/NumericalTests/Utilities/Calculator/AlmostEquals.h index 72922c8a0b5660645ae36e6745da210ae5505c27..fd467aaa9ec710d909d4537aba3da7d9921bb59a 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Calculator/AlmostEquals.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Calculator/AlmostEquals.h @@ -37,6 +37,7 @@ #pragma once #include <limits> +#include <float.h> // This template class serves as a compile-time function from size to // type. It maps a size in bytes to a primitive type with that diff --git a/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2CalculatorNormalizeWithAmplitude/L2CalculatorNormalizeWithAmplitude.cpp b/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2CalculatorNormalizeWithAmplitude/L2CalculatorNormalizeWithAmplitude.cpp index 9f6657e03e2b049c4ee8dd549619e27f94c05296..0ef35604920afd0d323ce389a169004d0d12ce23 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2CalculatorNormalizeWithAmplitude/L2CalculatorNormalizeWithAmplitude.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2CalculatorNormalizeWithAmplitude/L2CalculatorNormalizeWithAmplitude.cpp @@ -2,6 +2,8 @@ #include "Utilities/Calculator/FFTCalculator/FFTCalculator.h" +#include <cmath> + std::shared_ptr<L2NormCalculator> L2CalculatorNormalizeWithAmplitude::getInstance() { static std::shared_ptr<L2NormCalculator> uniqueInstance; @@ -17,7 +19,7 @@ double L2CalculatorNormalizeWithAmplitude::calc(std::vector<double> basicData, s if (equalDouble(amplitude, 0.0)) return -1.0; double counter = calcCounter(basicData, divergentData, level, lx, lz); - return sqrt(counter / (amplitude * amplitude)); + return std::sqrt(counter / (amplitude * amplitude)); } L2CalculatorNormalizeWithAmplitude::L2CalculatorNormalizeWithAmplitude() : L2NormCalculatorImp("Test could not run. Amplitude is zero. Normalization of the data is not possible.") diff --git a/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2CalculatorNormalizeWithBasicData/L2CalculatorNormalizeWithBasicData.cpp b/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2CalculatorNormalizeWithBasicData/L2CalculatorNormalizeWithBasicData.cpp index 20fb89c47622a543284aa77da0d25eac4ce71cbc..012c7fcf63a2210561d01b2ea05ed6b04d2fd44c 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2CalculatorNormalizeWithBasicData/L2CalculatorNormalizeWithBasicData.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/Calculator/L2NormCalculator/L2CalculatorNormalizeWithBasicData/L2CalculatorNormalizeWithBasicData.cpp @@ -1,5 +1,7 @@ #include "L2CalculatorNormalizeWithBasicData.h" +#include <cmath> + std::shared_ptr<L2NormCalculator> L2CalculatorNormalizeWithBasicData::getInstance() { static std::shared_ptr<L2NormCalculator> uniqueInstance; @@ -13,13 +15,13 @@ double L2CalculatorNormalizeWithBasicData::calc(std::vector<double> basicData, s double counter = calcCounter(basicData, divergentData, level, lx, lz); double denominator = 0.0; for (int i = 0; i < basicData.size(); i++) { - double area = (1 / pow(2.0, level.at(i))) * (1 / pow(2.0, level.at(i))); + double area = (1 / std::pow(2.0, level.at(i))) * (1 / std::pow(2.0, level.at(i))); denominator += (basicData.at(i)*basicData.at(i)) * area; } if (equalDouble(denominator, 0.0)) return -1.0; - return sqrt(counter / denominator); + return std::sqrt(counter / denominator); } L2CalculatorNormalizeWithBasicData::L2CalculatorNormalizeWithBasicData() : L2NormCalculatorImp("Test could not run. BasicData is zero. Normalization of the data is not possible.") diff --git a/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.h b/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.h index 418ef085aa7d1a319a2d0ad8fabd84c401e61d49..2a00f4286d59442046233ff19a7e95a105698928 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.h +++ b/apps/gpu/tests/NumericalTests/Utilities/ColorConsoleOutput/ColorConsoleOutputImp.h @@ -12,18 +12,6 @@ namespace testing { namespace internal { - enum GTestColor { - COLOR_DEFAULT, - COLOR_RED, - COLOR_GREEN, - COLOR_YELLOW - }; - - // in case of unresoved external while using shared libraries - // add in gtest.h line 167 and 168: - // enum GTestColor; - // void GTEST_API_ ColoredPrintf(GTestColor color, const char* fmt, ...); - // see commit: 4c0ed885ceab18b9df7a2495c77a51e236aee6f1 extern void ColoredPrintf(GTestColor color, const char* fmt, ...); } } diff --git a/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.cpp b/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.cpp index d0104b7e5edd4df82ea5bca02686f929b6511e68..ee75dcf29d0a4afa71fa66b4f168a191a585c088 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.cpp @@ -5,6 +5,7 @@ #include "VirtualFluids_GPU/Kernel/Utilities/Mapper/KernelMapper/KernelMapper.h" +#include <string> #include <fstream> std::shared_ptr<ConfigFileReader> ConfigFileReader::getNewInstance(const std::string aFilePath) @@ -130,7 +131,7 @@ std::vector<std::shared_ptr<TaylorGreenVortexUxParameterStruct> > ConfigFileRead aParameter->basicTimeStepLength = basisTimeStepLength.at(i); aParameter->l0 = l0; aParameter->rho0 = StringUtil::toDouble(input->getValue("Rho0")); - aParameter->vtkFilePath = StringUtil::toString(input->getValue("PathForVTKFileWriting")); + aParameter->vtkFilePath = input->getValue("PathForVTKFileWriting"); aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue("DataToCalcTests_TGV_Ux")); parameter.push_back(aParameter); } @@ -154,7 +155,7 @@ std::vector<std::shared_ptr<TaylorGreenVortexUzParameterStruct> > ConfigFileRead aParameter->basicTimeStepLength = basisTimeStepLength.at(i); aParameter->l0 = l0; aParameter->rho0 = StringUtil::toDouble(input->getValue("Rho0")); - aParameter->vtkFilePath = StringUtil::toString(input->getValue("PathForVTKFileWriting")); + aParameter->vtkFilePath = input->getValue("PathForVTKFileWriting"); aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue("DataToCalcTests_TGV_Uz")); parameter.push_back(aParameter); } @@ -177,7 +178,7 @@ std::vector<std::shared_ptr<ShearWaveParameterStruct> > ConfigFileReader::makeSh aParameter->basicTimeStepLength = basisTimeStepLength.at(i); aParameter->l0 = l0; aParameter->rho0 = StringUtil::toDouble(input->getValue("Rho0")); - aParameter->vtkFilePath = StringUtil::toString(input->getValue("PathForVTKFileWriting")); + aParameter->vtkFilePath = input->getValue("PathForVTKFileWriting"); aParameter->dataToCalcTests = StringUtil::toStringVector(input->getValue("DataToCalcTests_SW")); parameter.push_back(aParameter); } @@ -238,7 +239,7 @@ std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> ConfigFileReader::makeL std::shared_ptr<L2NormTestBetweenKernelsParameterStruct> testParameter = std::shared_ptr<L2NormTestBetweenKernelsParameterStruct>(new L2NormTestBetweenKernelsParameterStruct); testParameter->basicTestParameter = basicTestParameter; - testParameter->basicKernel = myKernelMapper->getEnum(StringUtil::toString(input->getValue("BasicKernel_L2NormBetweenKernels"))); + testParameter->basicKernel = myKernelMapper->getEnum(input->getValue("BasicKernel_L2NormBetweenKernels")); testParameter->kernelsToTest = readKernelList(input); testParameter->timeSteps = StringUtil::toIntVector(input->getValue("Timesteps_L2NormBetweenKernels")); testParameter->normalizeData = StringUtil::toStringVector(input->getValue("NormalizeData_L2Norm")); @@ -324,7 +325,7 @@ std::vector<KernelType> ConfigFileReader::readKernelList(std::shared_ptr<input:: { if (StringUtil::toBool(input->getValue("L2NormBetweenKernelsTest"))) { std::vector<std::string> kernelList = StringUtil::toStringVector(input->getValue("KernelsToTest")); - std::string beginnKernel = StringUtil::toString(input->getValue("BasicKernel_L2NormBetweenKernels")); + std::string beginnKernel = input->getValue("BasicKernel_L2NormBetweenKernels"); bool basicKernelInKernelList = false; for (int i = 0; i < kernelList.size(); i++) { if (kernelList.at(i) == beginnKernel) diff --git a/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.h b/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.h index 90bb9b53979b9165704552864ff2a7f14fba88ee..50794d4adc9b201aef2cfd3965e605f928c2fca0 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.h +++ b/apps/gpu/tests/NumericalTests/Utilities/ConfigFileReaderNT/ConfigFileReaderNT.h @@ -8,6 +8,7 @@ #include <memory> #include <string> +#include <vector> class KernelMapper; diff --git a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp index 9225174bc33de2061283a06fbd181474d7d41596..bfcb8aca231c14f601a3a0148c02b02f24026c4c 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/DataWriter/AnalyticalResults2DToVTKWriter/AnalyticalResults2DToVTKWriterImp.cpp @@ -12,7 +12,7 @@ #include "LBM/LB.h" #include "LBM/D3Q27.h" -#include <VirtualFluidsBasics/basics/writer/WbWriterVtkXmlBinary.h> +#include <basics/writer/WbWriterVtkXmlBinary.h> #include "Utilities/Results/AnalyticalResults/AnalyticalResult.h" #include <mpi.h> diff --git a/apps/gpu/tests/NumericalTests/Utilities/GridReaderforTesting/gridReaderforTesting.cpp b/apps/gpu/tests/NumericalTests/Utilities/GridReaderforTesting/gridReaderforTesting.cpp deleted file mode 100644 index bd6f96c06ae76e4a7ad6fabcbb4696f7c77dba94..0000000000000000000000000000000000000000 --- a/apps/gpu/tests/NumericalTests/Utilities/GridReaderforTesting/gridReaderforTesting.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "gridReaderforTesting.h" - -#include "VirtualFluids_GPU/Parameter/Parameter.h" - -#include "Utilities/InitialCondition/InitialCondition.h" - -#define _USE_MATH_DEFINES -#include <math.h> - - -std::shared_ptr<GridReaderforTesting> GridReaderforTesting::getNewInstance(std::shared_ptr<Parameter> para, std::shared_ptr<InitialCondition> initialCondition) -{ - return std::shared_ptr<GridReaderforTesting>(new GridReaderforTesting(para, initialCondition)); -} - -void GridReaderforTesting::setInitalNodeValues(const int numberOfNodes, const int level) const -{ - initialCondition->init(level); - for (int j = 0; j <= numberOfNodes; j++){ - para->getParH(level)->vx_SP[j] = initialCondition->getInitVX(j, level); - para->getParH(level)->vy_SP[j] = initialCondition->getInitVY(j, level); - para->getParH(level)->vz_SP[j] = initialCondition->getInitVZ(j, level); - para->getParH(level)->rho_SP[j] = initialCondition->getInitROH(j, level); - para->getParH(level)->press_SP[j] = initialCondition->getInitPRESS(j, level); - } -} - -GridReaderforTesting::GridReaderforTesting(std::shared_ptr<Parameter> para, std::shared_ptr<InitialCondition> initialCondition) :GridReader(FileFormat::BINARY, para), initialCondition(initialCondition) -{ - -} \ No newline at end of file diff --git a/apps/gpu/tests/NumericalTests/Utilities/LogFileWriter/LogFileWriterImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/LogFileWriter/LogFileWriterImp.cpp index d9f03bbc0611b3f9260d837ecb78f29fbcff9b8e..f8aa2c5ed87d752457610136f3f91551b5a300c2 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/LogFileWriter/LogFileWriterImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/LogFileWriter/LogFileWriterImp.cpp @@ -12,7 +12,7 @@ #include <helper_functions.h> #include <iomanip> #include <ctime> -#include <experimental/filesystem> +#include <filesystem> LogFileWriterImp::LogFileWriterImp(std::shared_ptr<LogFileHead> logFileHead, std::shared_ptr<BasicSimulationInfo> basicSimInfo, std::shared_ptr<BasicTestLogFileInformation> basicTestInfo, std::vector<std::shared_ptr<TestLogFileInformation> > testLogFiles, std::shared_ptr<LogFileTimeInformation> logFileTimeInfo, std::shared_ptr<SimulationLogFileInformation> simLogInfo, KernelType kernel, double viscosity) : viscosity(viscosity) { @@ -60,9 +60,9 @@ std::string LogFileWriterImp::buildFilePath(std::string basicFilePath) std::ostringstream filePath; filePath << basicFilePath << simLogInfo->getFilePathExtension().at(0) << "/viscosity_" << viscosity << "/" << simLogInfo->getFilePathExtension().at(1) << "/" << kernelName; - std::experimental::filesystem::path dir(filePath.str()); - if (!(std::experimental::filesystem::exists(dir))) - std::experimental::filesystem::create_directories(dir); + std::filesystem::path dir(filePath.str()); + if (!(std::filesystem::exists(dir))) + std::filesystem::create_directories(dir); filePath << "/logfile_" << calcDateAndTime() << "_" << kernelName << "_vis_" << viscosity << ".txt"; return filePath.str(); diff --git a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactory.h b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactory.h index 7fca7dbcaca3c00ce1ab42b971a3cc18cf0cf5df..b5facb26a1dd1e2e0439a415fae2c692340449fe 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactory.h +++ b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactory.h @@ -3,6 +3,7 @@ #include <memory> #include <vector> +#include <string> class TestSimulation; class TestQueue; diff --git a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp index 4ff8c9f502bf23f36e284624b3b5b936e4ec05e0..009f17d611ba9a60cb8ee697b4a9e2c55ab9619b 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/NumericalTestFactory/NumericalTestFactoryImp.cpp @@ -14,7 +14,7 @@ #include "Simulations/TaylorGreenVortexUx/SimulationParameter/SimulationParameterTaylorGreenVortexUx.h" #include "Simulations/TaylorGreenVortexUz/SimulationParameter/SimulationParameterTaylorGreenVortexUz.h" -#include "Simulations/TaylorGreenVortexUz/LogFileInformation/LogFileInformationTaylorGreenvortexUz.h" +#include "Simulations/TaylorGreenVortexUz/LogFileInformation/LogFileInformationTaylorGreenVortexUz.h" #include "Simulations/TaylorGreenVortexUz/SimulationInfo/SimulationInfoTaylorGreenVortexUz.h" #include "Simulations/TaylorGreenVortexUz/AnalyticalResults/AnalyticalResultsTaylorGreenVortexUz.h" #include "Simulations/TaylorGreenVortexUz/InitialConditions/InitialConditionTaylorGreenVortexUz.h" diff --git a/apps/gpu/tests/NumericalTests/Utilities/PostProcessingStrategy/PostProcessingStrategy.h b/apps/gpu/tests/NumericalTests/Utilities/PostProcessingStrategy/PostProcessingStrategy.h index eaf0cd2b3d7a16784e7d25bc05787b0f40fce230..686c2300e75257717820b6bb97554b37493d46e3 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/PostProcessingStrategy/PostProcessingStrategy.h +++ b/apps/gpu/tests/NumericalTests/Utilities/PostProcessingStrategy/PostProcessingStrategy.h @@ -3,6 +3,7 @@ #include <vector> #include <memory> +#include <string> class SimulationResults; diff --git a/apps/gpu/tests/NumericalTests/Utilities/SimulationParameter/SimulationParameterImp.cpp b/apps/gpu/tests/NumericalTests/Utilities/SimulationParameter/SimulationParameterImp.cpp index 6160e93a7007e32bba6c4e3607b59588bab5ddb0..870aab755f1981bb4ad29391ca752a8786c5d279 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/SimulationParameter/SimulationParameterImp.cpp +++ b/apps/gpu/tests/NumericalTests/Utilities/SimulationParameter/SimulationParameterImp.cpp @@ -5,7 +5,7 @@ #include "Utilities/Structs/BasicSimulationParameterStruct.h" #include "Utilities/Structs/GridInformationStruct.h" -#include <experimental/filesystem> +#include <filesystem> SimulationParameterImp::SimulationParameterImp(KernelType kernel, double viscosity, std::shared_ptr<BasicSimulationParameterStruct> basicSimPara, std::shared_ptr<GridInformationStruct> gridInfo) : viscosity(viscosity) @@ -25,9 +25,9 @@ SimulationParameterImp::SimulationParameterImp(KernelType kernel, double viscosi void SimulationParameterImp::generateFileDirectionInMyStystem(std::string filePath) { - std::experimental::filesystem::path dir(filePath); - if (!(std::experimental::filesystem::exists(dir))) - std::experimental::filesystem::create_directories(dir); + std::filesystem::path dir(filePath); + if (!(std::filesystem::exists(dir))) + std::filesystem::create_directories(dir); } double SimulationParameterImp::getViscosity() diff --git a/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h b/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h index 8fb9a928242a77ffb27d96ab992c278bdcdc8427..af180adb96e8d8f31ea746bb8ea55d16d170622c 100644 --- a/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h +++ b/apps/gpu/tests/NumericalTests/Utilities/Test/Test.h @@ -5,6 +5,7 @@ #include "TestStatus.h" #include <vector> +#include <string> class Test : public SimulationObserver { diff --git a/apps/gpu/tests/NumericalTests/config.txt b/apps/gpu/tests/NumericalTests/config.txt index 169db5e4fa19bd144117df9b7bc4e49e895a962f..cc66e3df54e42ff20d5515c07426983356e34e06 100644 --- a/apps/gpu/tests/NumericalTests/config.txt +++ b/apps/gpu/tests/NumericalTests/config.txt @@ -1,12 +1,12 @@ ################################################## # GPU Mapping # ################################################## -Devices="1" +Devices="0" ################################################## # Basic Simulation Parameter # ################################################## -KernelsToTest="CumulantAA2016CompSP27" +KernelsToTest="BGKCompSP27" #BGKCompSP27 BGKPlusCompSP27 CumulantAA2016CompSP27 CumulantOneCompSP27 CumulantF3CompSP27 CumulantF32018CompSP27 CumulantAll4CompSP27 NumberOfTimeSteps=20 Viscosity="0.001" @@ -75,7 +75,7 @@ DivergentTimeStep_L2=20 ################################################## L2NormBetweenKernelsTest=false -BasicKernel_L2NormBetweenKernels=CumulantF3CompSP27 +BasicKernel_L2NormBetweenKernels=BGKCompSP27 Timesteps_L2NormBetweenKernels="0 10 20" NormalizeWith=amplitude @@ -105,19 +105,27 @@ ShearWave512=false ################################################## NumberOfGridLevels=1 -GridPath32="C:\Users\Timon\Documents\studienarbeitIRMB\grids\gridUni32x4x48" -GridPath64="C:\Users\Timon\Documents\studienarbeitIRMB\grids\gridUni64x4x96" -GridPath128="C:\Users\Timon\Documents\studienarbeitIRMB\grids\gridUni128x4x192" -GridPath256="C:\Users\Timon\Documents\studienarbeitIRMB\grids\gridUni256x4x384" -GridPath512="C:\Users\Timon\Documents\studienarbeitIRMB\grids\gridUni512x4x768" +#GridPath32="C:\Users\Timon\Documents\studienarbeitIRMB\Grids\gridUni32x4x48" +#GridPath64="C:\Users\Timon\Documents\studienarbeitIRMB\grids\gridUni64x4x96" +#GridPath128="C:\Users\Timon\Documents\studienarbeitIRMB\grids\gridUni128x4x192" +#GridPath256="C:\Users\Timon\Documents\studienarbeitIRMB\grids\gridUni256x4x384" +#GridPath512="C:\Users\Timon\Documents\studienarbeitIRMB\grids\gridUni512x4x768" + +GridPath32="C:\Users\Soeren\Documents\testdata\Grids\gridUni32x4x48" +GridPath64="C:\Users\Soeren\Documents\testdata\Grids\gridUni64x4x96" +GridPath128="C:\Users\Soeren\Documents\testdata\Grids\gridUni128x4x192" +GridPath256="C:\Users\Soeren\Documents\testdata\Grids\gridUni256x4x384" +GridPath512="C:\Users\Soeren\Documents\testdata\Grids\gridUni512x4x768" ################################################## # File Writing Information # ################################################## WriteVTKFiles=false -PathForVTKFileWriting="C:\Users\Timon\Documents\studienarbeitIRMB\Output" +#PathForVTKFileWriting="C:\Users\Timon\Documents\studienarbeitIRMB\Output" +PathLogFile="C:\Users\Soeren\Documents\testdata\Output" StartStepFileWriter=0 WriteAnalyResultsToVTK=true -PathLogFile="C:\Users\Timon\Documents\studienarbeitIRMB\logFiles" \ No newline at end of file +#PathLogFile="C:\Users\Timon\Documents\studienarbeitIRMB\logFiles" +PathLogFile="C:\Users\Soeren\Documents\testdata\logFiles" \ No newline at end of file diff --git a/gpu.cmake b/gpu.cmake index b1c5bf6dfef1156bff2439a73e2e25886b115f77..bc056ea83a0659ccbf5e8469e7e9b85681c91b23 100644 --- a/gpu.cmake +++ b/gpu.cmake @@ -1,8 +1,4 @@ -if(UNIX) - set(CMAKE_CXX_STANDARD 14) -endif() - ############################################################# ### CUDAPATH ### ############################################################# @@ -35,7 +31,9 @@ ENDIF() ############################################################# -enable_language(CUDA) +if(VF.BUILD_NUMERIC_TESTS) + set(CMAKE_CXX_STANDARD 17) +endif() ############################################################# @@ -47,6 +45,9 @@ ENDIF() set(CMAKE_CUDA_FLAGS_DEBUG " -G" CACHE STRING "" FORCE) +############################################################# + +enable_language(CUDA) ########################################################################################################################## ### Subdirectories ### @@ -149,8 +150,8 @@ ENDIF() if(VF.BUILD_NUMERIC_TESTS) add_subdirectory(3rdParty/fftw/fftw-3.3.7) add_subdirectory(3rdParty/googletest) - add_subdirectory(targets/tests/NumericalTests) - add_subdirectory(targets/tests/NumericalTestPostProcessing) + add_subdirectory(apps/gpu/tests/NumericalTests) + add_subdirectory(apps/gpu/tests/NumericalTestPostProcessing) endif() #############################################################