diff --git a/.gitattributes b/.gitattributes index 8a4ad7f2e84e410e3515a9f2530717956177daa1..cbc9336c085d776ddbbda9b1c830c0fa19c3c6d5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,3 +9,4 @@ *.hpp text *.cuh text *.cu text +*.cmake text \ No newline at end of file diff --git a/3rdParty/MuParser/CMakeLists.txt b/3rdParty/MuParser/CMakeLists.txt index 3f2d48be099fd660030424c1d7f5b92c216ee8ac..14a1e4e4528181800f03adfd3695310783042707 100644 --- a/3rdParty/MuParser/CMakeLists.txt +++ b/3rdParty/MuParser/CMakeLists.txt @@ -32,6 +32,7 @@ if(MSVC) else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251 /wd4310 /wd4267") # disable all muparser warnings elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) # Update if necessary set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic") diff --git a/CMake/FileUtilities.cmake b/CMake/FileUtilities.cmake index 4d42efcedd5d6a06d3d1ca12106e26c0ac875b93..151000a681795923d4e31ed8c5f06dfd1e7af7fd 100644 --- a/CMake/FileUtilities.cmake +++ b/CMake/FileUtilities.cmake @@ -170,22 +170,23 @@ function(collectFiles source_files ARG_FILES ARG_FOLDER ARG_EXCLUDE) endforeach() endif() - if (NOT ARG_FILES AND NOT ARG_FOLDER) file ( GLOB_RECURSE all_files ${VIRTUAL_FLUIDS_GLOB_FILES} ) set(local_source_files ${local_source_files} ${all_files}) endif() - - + if (ARG_EXCLUDE) foreach(file_path ${local_source_files}) + set(exclude_file OFF) foreach(file_exclude ${ARG_EXCLUDE}) get_filename_component(file_name ${file_path} NAME) - if (NOT ${file_name} STREQUAL ${file_exclude}) - set(new_files ${new_files} ${file_path}) + if (${file_name} STREQUAL ${file_exclude}) + set(exclude_file TRUE) endif() - endforeach() + if (NOT ${exclude_file}) + set(new_files ${new_files} ${file_path}) + endif() endforeach() set(local_source_files ${new_files}) endif() diff --git a/CMake/compilerflags/AppleClang.cmake b/CMake/compilerflags/AppleClang.cmake index f84d6f27ec4a28bb86ad224f86b2866037a6a2e9..05c497165b6f395f98c52bd2fbcad6cdc1cc94cf 100644 --- a/CMake/compilerflags/AppleClang.cmake +++ b/CMake/compilerflags/AppleClang.cmake @@ -1,32 +1,26 @@ -############################################################################################################### -## -## apple clang -## -############################################################################################################### - ############################################################################################################# -# Flags +# compiler flags ############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O3;-fomit-frame-pointer;-finline-functions;-fPIC;-Wbackslash-newline-escape") -############################################################################################################# -# mt support -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") +# debug +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG "-g") # generates debug information. Works best with -O0. +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG "-O0") +# release +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE "-O3") # optimization level (-O3: most optimization which also could result in larger binaries) -# test -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE "-Wall") -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG "-Werror") +# all +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-fPIC") # position independent code for shared libraries ############################################################################################################# -# disable warning +# warnings ############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-deprecated") #deprecated header warning -#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 +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wall") +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wunreachable-code") +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-unused-function") +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-reorder-ctor") -#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") -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wregister") +# temp: +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-sometimes-uninitialized") +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-inconsistent-missing-override") \ No newline at end of file diff --git a/CMake/compilerflags/Clang.cmake b/CMake/compilerflags/Clang.cmake index 4e473e381ff7d9dc36e0a910e4504d355fb0ca60..434be42697165ea347b2c2728e9cf836b66650af 100644 --- a/CMake/compilerflags/Clang.cmake +++ b/CMake/compilerflags/Clang.cmake @@ -1,31 +1,27 @@ -############################################################################################################### -## -## clang -## -############################################################################################################### - ############################################################################################################# -# Flags +# compiler flags ############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O3;-fomit-frame-pointer;-finline-functions;-fPIC;-Wbackslash-newline-escape") -############################################################################################################# -# mt support -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") +# debug +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG "-g") # generates debug information. Works best with -O0. +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG "-O0") +# release +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE "-O3") # optimization level (-O3: most optimization which also could result in larger binaries) -############################################################################################################# -# disable warning -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-deprecated") #deprecated header warning -#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 +# all +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-fPIC") # position independent code for shared libraries -#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") -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wregister") +############################################################################################################# +# warnings +############################################################################################################# +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wall") +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-unused-function") +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-reorder-ctor") -LIST(APPEND CAB_ADDITIONAL_LINK_PROPS "-lrt") \ No newline at end of file +############################################################################################################# +# linker options +############################################################################################################# +list(APPEND VF_LINK_OPTIONS -lrt) \ No newline at end of file diff --git a/CMake/compilerflags/GNU.cmake b/CMake/compilerflags/GNU.cmake index 54a11f02a661b85a80fb7ce7fe9cfb8c60b04b0d..f44cafc66eced55f1cf28f05ca0ddc9ad24b3e7d 100644 --- a/CMake/compilerflags/GNU.cmake +++ b/CMake/compilerflags/GNU.cmake @@ -1,23 +1,31 @@ - ############################################################################################################# -# Flags +# compiler flags ############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O3;-fomit-frame-pointer;-finline-functions;-funroll-all-loops;-fPIC") -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-deprecated") #deprecated header warning (jarl benutzt sstream weil schneller und so) -############################################################################################################# -# mt support -############################################################################################################# -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") +# debug +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG "-g") # generates debug information. Works best with -O0. +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG "-O0") # no optimization +# release +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE "-O3") # optimization level (-O3: most optimization which also could result in larger binaries) +# all +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-fPIC") # position independent code for shared libraries +LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-funroll-all-loops") -#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") -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wregister") +############################################################################################################# +# warnings +############################################################################################################# +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wall") +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-unused-function") +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-reorder") +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-Wno-sign-compare") + +############################################################################################################# +# linker options +############################################################################################################# 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 83cb9f74c500cc748a6a1e8c7440fa643d314451..a53998d93eec146de6158d80bad2302536b2c252 100644 --- a/CMake/compilerflags/Intel.cmake +++ b/CMake/compilerflags/Intel.cmake @@ -1,6 +1,6 @@ -############################################################################################################### -## intel -############################################################################################################### +############################################################################################################# +# compiler flags +############################################################################################################# #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O") #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd654") @@ -13,20 +13,20 @@ #~ LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-wd266") #function "__GKfree" declared implicitly #LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-xHOST -O3 -ip -ipo -fno-alias -mcmodel=medium -qopt-streaming-stores=always") -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-wd1478") #auto_ptr warning from mu::Parser -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-xHOST;-O3;-ip;-fno-alias;-mcmodel=medium;-qopt-streaming-stores=always;-xCORE-AVX512;-qopt-zmm-usage=high") +# all +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-xHOST;-O3;-ip;-fno-alias;-mcmodel=medium;-qopt-streaming-stores=always;-xCORE-AVX512;-qopt-zmm-usage=high") -#Debug -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-g -traceback") +# debug +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG "-g -traceback") -############################################################################################################### -## mt support -############################################################################################################### -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-pthread") +############################################################################################################# +# linker options +############################################################################################################# list(APPEND VF_LINK_OPTIONS -parallel) -list(APPEND VF_LINK_OPTIONS -irc) - +############################################################################################################# +# preprocessor definitions +############################################################################################################# # LIST(APPEND VF_COMPILER_DEFINITION MPICH_IGNORE_CXX_SEEK) # LIST(APPEND VF_COMPILER_DEFINITION MPICH_SKIP_MPICXX) diff --git a/CMake/compilerflags/MSVC.cmake b/CMake/compilerflags/MSVC.cmake index 0a279571cc9aa2cba70476316068f52463246b03..937d9f4d5d1fead78f35e2442845b27f13bc9a54 100644 --- a/CMake/compilerflags/MSVC.cmake +++ b/CMake/compilerflags/MSVC.cmake @@ -1,27 +1,37 @@ -############################################################################################################### -## MSVC -############################################################################################################### - -############################################################################################################### -## USE_UNSECURE_STL_VECTORS_RELEASE ? -############################################################################################################### -OPTION(USE_UNSECURE_STL_VECTORS_RELEASE "_SECURE_SCL=0" OFF) -IF(USE_UNSECURE_STL_VECTORS_RELEASE) - # More MSVC specific compilation flags - LIST(APPEND VF_COMPILER_DEFINITION _SECURE_SCL=0) - LIST(APPEND VF_COMPILER_DEFINITION _SCL_SECURE_NO_WARNINGS) -ENDIF() - -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_RELEASE "/W1") -#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS_DEBUG "/Wall") - -############################################################################################################### -## Flags -############################################################################################################### -LIST(APPEND VF_COMPILER_DEFINITION _CRT_SECURE_NO_DEPRECATE) # disable warnings promoting Microsoft's security enhanced CRT -LIST(APPEND VF_COMPILER_DEFINITION _SCL_SECURE_NO_WARNINGS) # disable warnings triggered by Microsoft's checked iterators -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/wd4996") # deprecated strcpy... -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/wd4800") # forcing value to bool 'true' or 'false' (performance warning) -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/bigobj") # ansonsten funzt mit boost das compilieren unter windows nimmer - -LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-MP") # enable multi-threaded compiling \ No newline at end of file +############################################################################################################# +# compiler flags +############################################################################################################# +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/bigobj") # increases that address capacity to 4,294,967,296 (2^32). +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-MP") # enable multi-threaded compiling + + +############################################################################################################# +# warnings +############################################################################################################# +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/W4") # highest warning level + +# With W4 the following warnings appear many times. As long they are not eliminated they are suppressed: +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/wd4458") # C4458: declaration of 'XXX' hides class member +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/wd4100") # C4100: 'XXX': unreferenced formal parameter +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/wd4505") # C4505: 'XXX': unreferenced local function has been removed +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/wd4244") # C4244: '=': conversion from 'int' to 'char', possible loss of data, triggered by algorithm(2216,24) +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/wd4310") # C4310: cast truncates constant value, triggerd by muParserbase.h +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/wd4127") # C4127: conditional expression is constant: e.g. sizeof(int) + +# Urgent FIXME: This warning should be activated and fixed: +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/wd4701") # C4701: potentially uninitialized local variable 'lMaxX3' used + + +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/wd4251") # disable needs to have dll interface +list(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "/wd4005") # disable macro redefinition (triggered by metis.h) + +############################################################################################################# +# preprocessor definitions +############################################################################################################# +list(APPEND VF_COMPILER_DEFINITION _CRT_SECURE_NO_DEPRECATE) # disable warnings promoting Microsoft's security enhanced CRT + +option(USE_UNSECURE_STL_VECTORS_RELEASE "_SECURE_SCL=0" OFF) +if(USE_UNSECURE_STL_VECTORS_RELEASE) + list(APPEND VF_COMPILER_DEFINITION _SECURE_SCL=0) + list(APPEND VF_COMPILER_DEFINITION _SCL_SECURE_NO_WARNINGS) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index fbea2c2bdaca6f61428cffd6440d5eb3cddc0eaa..6c98c8aa639a81526606a7124bf97e1c150a6032 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ # ################################################################################# # required cmake versions -# CMAKE 3.9: CUDA support +# CMAKE 3.13: target_link_options ################################################################################# cmake_minimum_required(VERSION 3.13..3.18 FATAL_ERROR) diff --git a/src/basics/CMakeLists.txt b/src/basics/CMakeLists.txt index ff6c0c122ee9d2fc738e0fe67bba48ba621a95e1..0b643212ad9c5da74e711d72da085c1fe670704e 100644 --- a/src/basics/CMakeLists.txt +++ b/src/basics/CMakeLists.txt @@ -1,7 +1,7 @@ include(Core/buildInfo.cmake) -vf_add_library(BUILDTYPE static EXCLUDE buildInfo.in.cpp VirtualFluidsDefinitions.in.h) +vf_add_library(BUILDTYPE static EXCLUDE buildInfo.in.cpp) vf_get_library_name (library_name) target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Core) diff --git a/src/basics/Core/Input/ConfigFileReader/ConfigFileReader.cpp b/src/basics/Core/Input/ConfigFileReader/ConfigFileReader.cpp index 690c4b19edb07180de05d126fdd1be5e07b911d0..1053a7f5fcb2feb6280ebdbe563bd1a9c7196424 100644 --- a/src/basics/Core/Input/ConfigFileReader/ConfigFileReader.cpp +++ b/src/basics/Core/Input/ConfigFileReader/ConfigFileReader.cpp @@ -173,7 +173,7 @@ BASICS_EXPORT std::shared_ptr<ConfigData> ConfigFileReader::readConfigFile(const data->setGeometryFileF(input->getValue("GeometryF")); ////////////////////////////////////////////////////////////////////////// if (input->getValue("measureClockCycle") != "") - data->setClockCycleForMP(StringUtil::toFloat(input->getValue("measureClockCycle"))); + data->setClockCycleForMP(StringUtil::toInt(input->getValue("measureClockCycle"))); if (input->getValue("measureTimestep") != "") data->setTimestepForMP(StringUtil::toInt(input->getValue("measureTimestep"))); @@ -208,10 +208,10 @@ BASICS_EXPORT std::shared_ptr<ConfigData> ConfigFileReader::readConfigFile(const data->setNumberOfParticles(StringUtil::toInt(input->getValue("numberOfParticles"))); if (input->getValue("startXHotWall") != "") - data->setStartXHotWall(StringUtil::toDouble(input->getValue("startXHotWall"))); + data->setStartXHotWall(real(StringUtil::toDouble(input->getValue("startXHotWall")))); if (input->getValue("endXHotWall") != "") - data->setEndXHotWall(StringUtil::toDouble(input->getValue("endXHotWall"))); + data->setEndXHotWall(real(StringUtil::toDouble(input->getValue("endXHotWall")))); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Restart if (input->getValue("TimeDoCheckPoint") != "") diff --git a/src/basics/Core/Input/ConfigInput/ConfigInput.cpp b/src/basics/Core/Input/ConfigInput/ConfigInput.cpp index 75559844a13d23dc9f85138e914f860d1ed1e0b6..ce8ea0401d1baf6a44fa174022576eaa7df59149 100644 --- a/src/basics/Core/Input/ConfigInput/ConfigInput.cpp +++ b/src/basics/Core/Input/ConfigInput/ConfigInput.cpp @@ -218,6 +218,7 @@ namespace input bool isComment = false; while (!(stream.get(ch)).fail()) + { if (isCommentSign(ch)) isComment = true; else if (isNewLine(ch)) @@ -231,7 +232,8 @@ namespace input stream.putback(ch); return 0; } - return 0; + } + return 0; } bool ConfigInput::isRegularChar(bool isComment, char ch) diff --git a/src/basics/Core/Timer/Timer.h b/src/basics/Core/Timer/Timer.h index 9607cc5f9a72873e1da226b4d071e000777073a1..702cfafb4b2eaef7cf779136d58ce7c37bc1b1e5 100644 --- a/src/basics/Core/Timer/Timer.h +++ b/src/basics/Core/Timer/Timer.h @@ -9,7 +9,7 @@ class BASICS_EXPORT Timer { public: - + virtual ~Timer() = default; static SPtr<Timer> makeStart(); virtual void start() = 0; diff --git a/src/basics/Core/Timer/TimerImp.cpp b/src/basics/Core/Timer/TimerImp.cpp index 4fc234a29cab0639cb703cf5e9d29151b321873b..7942f970a8b2f3e1047ef93dbf484fbd019611ea 100644 --- a/src/basics/Core/Timer/TimerImp.cpp +++ b/src/basics/Core/Timer/TimerImp.cpp @@ -1,9 +1,5 @@ #include "TimerImp.h" -TimerImp::TimerImp() -{ - -} void TimerImp::start() { @@ -17,10 +13,10 @@ void TimerImp::end() real TimerImp::getTimeInSeconds() const { - return std::chrono::duration_cast<std::chrono::microseconds>( endTime - startTime ).count() / 1000000.0; + return real(std::chrono::duration_cast<std::chrono::microseconds>( endTime - startTime ).count() / 1000000.0); } real TimerImp::getCurrentRuntimeInSeconds() const { - return std::chrono::duration_cast<std::chrono::microseconds>( std::chrono::high_resolution_clock::now() - startTime ).count() / 1000000.0; + return real(std::chrono::duration_cast<std::chrono::microseconds>( std::chrono::high_resolution_clock::now() - startTime ).count() / 1000000.0); } diff --git a/src/basics/Core/Timer/TimerImp.h b/src/basics/Core/Timer/TimerImp.h index 20a11968005f88bebbc1e481149a6c9d939306a8..9cda82fb059e6a1dcb719aba8a4a972c4b363e9c 100644 --- a/src/basics/Core/Timer/TimerImp.h +++ b/src/basics/Core/Timer/TimerImp.h @@ -12,11 +12,8 @@ class BASICS_EXPORT TimerImp : public Timer { public: - typedef std::chrono::high_resolution_clock::time_point timePoint; - TimerImp(); - void start() override; void end() override; diff --git a/src/basics/Core/buildInfo.in.cpp b/src/basics/Core/buildInfo.in.cpp index 345331b737c4e205a72ad37c9c9cd6f05b668e5c..2cd55e8654c5a021d95ed584a8fb6d5def2014ee 100644 --- a/src/basics/Core/buildInfo.in.cpp +++ b/src/basics/Core/buildInfo.in.cpp @@ -1,5 +1,8 @@ +#include "buildInfo.h" + #include "basics_export.h" + namespace buildInfo { BASICS_EXPORT const char *gitCommitHash() { return "@git_commit_hash@"; } diff --git a/src/basics/basics/objects/ObObject.h b/src/basics/basics/objects/ObObject.h index c540005212a3798c7cfc773f5032ab5bbc5f1c72..0675ae68ff99f7db380c3d99500268bf94698b2b 100644 --- a/src/basics/basics/objects/ObObject.h +++ b/src/basics/basics/objects/ObObject.h @@ -40,17 +40,17 @@ class ObObject : public UbObservable { public: - ObObject() : name("") { } + ObObject() = default; ObObject(const std::string& name) : name(name) { } - virtual ~ObObject() { } + virtual ~ObObject() = default; - virtual ObObject* clone()=0; + virtual ObObject* clone() = 0; virtual std::string getName() { return name; } - void setName(std::string name) { this->name=name; } + void setName(std::string name) { this->name = name; } - virtual std::string toString()=0; + virtual std::string toString() override = 0; private: diff --git a/src/basics/basics/utilities/UbSystem.h b/src/basics/basics/utilities/UbSystem.h index dcfa4fc6d4aca45bd1370f2d843259888f7ed11f..8efe16cca5c988764bd1eb19f6ef62d41534355b 100644 --- a/src/basics/basics/utilities/UbSystem.h +++ b/src/basics/basics/utilities/UbSystem.h @@ -395,12 +395,14 @@ namespace UbSystem /*==========================================================*/ inline unsigned long getCurrentThreadID() { - #if defined UBSYSTEM_WINDOWS + #if defined UBSYSTEM_WINDOWS || defined(UBSYSTEM_CYGWIN) return (unsigned long)GetCurrentThreadId(); - #elif (defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE)) && !defined(UBSYSTEM_CYGWIN) + #elif defined(UBSYSTEM_APPLE) + uint64_t tid; + pthread_threadid_np(nullptr, &tid); + return (unsigned long)tid; + #elif defined(UBSYSTEM_LINUX) return (unsigned long)syscall(SYS_gettid); - #elif defined(UBSYSTEM_CYGWIN) - return (unsigned long)GetCurrentThreadId(); #elif defined(UBSYSTEM_AIX) return (unsigned long) getpid(); //WORKAROUND for IBM (for get thread id is another function necessary) #else @@ -444,8 +446,8 @@ namespace UbSystem //#define ByteSwap5(x) ByteSwap((unsigned char *) &x,sizeof(x)) inline void swapByteOrder(unsigned char* toSwap, int length) { - register int i = 0; - register int j = length-1; + int i = 0; + int j = length-1; while(i<j) { std::swap(toSwap[i], toSwap[j]); @@ -457,7 +459,6 @@ namespace UbSystem inline std::string getMachineName() { char Name[150]; - int i = 0; #if defined(UBSYSTEM_WINDOWS) || defined(UBSYSTEM_CYGWIN) TCHAR infoBuf[150]; @@ -465,14 +466,14 @@ namespace UbSystem memset(Name, 0, 150); if (GetComputerName(infoBuf, &bufCharCount)) { - for (i = 0; i<150; i++) + for (int i = 0; i<150; i++) { Name[i] = infoBuf[i]; } } else { - strcpy(Name, "Unknown_Host_Name"); + strcpy_s(Name, "Unknown_Host_Name"); } #elif (defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) || defined(UBSYSTEM_AIX)) && !defined(UBSYSTEM_CYGWIN) memset(Name, 0, 150); diff --git a/src/basics/basics/writer/WbWriterVtkXmlASCII.cpp b/src/basics/basics/writer/WbWriterVtkXmlASCII.cpp index 47b5d1fb26243d5c8b5d051ba2459e4219d5fe75..d4ad420ffcae457c74fbcc0b759b7be2098ab4f1 100644 --- a/src/basics/basics/writer/WbWriterVtkXmlASCII.cpp +++ b/src/basics/basics/writer/WbWriterVtkXmlASCII.cpp @@ -532,82 +532,82 @@ std::string WbWriterVtkXmlASCII::writeLines(const string& filename,vector<UbTupl return vtkfilename; } /*===============================================================================*/ -std::string WbWriterVtkXmlASCII::writeLinesWithNodeData(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata) -{ - string vtkfilename=filename+getFileExtension(); - UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeLinesWithNodeData to "<<vtkfilename<<" - start"); - - std::ofstream out(vtkfilename.c_str()); - if(!out) - { - out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());} - if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename); - } - - int nofNodes = (int)nodes.size(); - int nofLines = (int)lines.size(); - - //VTK FILE - out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n"; - out<<" <UnstructuredGrid>"<<"\n"; - out<<" <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofLines<<"\"> \n"; - - //POINTS SECTION - out<<" <Points>\n"; - out<<" <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n"; - for(int n=0; n<nofNodes; n++) - out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<" "; - - out<<"\n"; - out<<" </DataArray>\n"; - out<<" </Points>\n"; - - //CELLS SECTION - out<<" <Cells>\n"; - out<<" <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n"; - - for(int c=0; c<nofLines; c++) - out<< val<1>(lines[c]) <<" "<< val<2>(lines[c])<<" "; - out<<"\n"; - out<<" </DataArray>\n"; - out<<" <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n"; - for(int c=1; c<=nofLines; c++) - out<<c*2<<" " ; - - out<<"\n"; - out<<" </DataArray>\n"; - - out<<" <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n"; - - for(int c=0; c<nofLines; c++) - out<<"3 "; - out<<"\n"; - out<<" </DataArray>\n"; - out<<" </Cells>\n"; - - //write data section - out<<" <PointData Scalars=\"Scalars\"> \n"; - for(int s=0; s<(int)datanames.size(); ++s) - { - out<< " <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"ascii\"> \n"; - - for(int d=0; d<(int)nodedata[s].size(); d++) - out<<nodedata[s][d]<<" "; - - out<<"\n </DataArray>\n"; - } - out<<" </PointData>\n"; - out<<" </Piece>\n"; - out<<" </UnstructuredGrid>\n"; - out<<"</VTKFile>"; - out<<endl; - out.close(); - UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeLinesWithNodeData to "<<vtkfilename<<" - end"); - - return vtkfilename; -} +//std::string WbWriterVtkXmlASCII::writeLinesWithNodeData(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata) +//{ +// string vtkfilename=filename+getFileExtension(); +// UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeLinesWithNodeData to "<<vtkfilename<<" - start"); +// +// std::ofstream out(vtkfilename.c_str()); +// if(!out) +// { +// out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! +// string path = UbSystem::getPathFromString(vtkfilename); +// if(path.size()>0){UbSystem::makeDirectory(path);out.open(vtkfilename.c_str());} +// if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename); +// } +// +// int nofNodes = (int)nodes.size(); +// int nofLines = (int)lines.size(); +// +// //VTK FILE +// out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n"; +// out<<" <UnstructuredGrid>"<<"\n"; +// out<<" <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofLines<<"\"> \n"; +// +// //POINTS SECTION +// out<<" <Points>\n"; +// out<<" <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"ascii\">\n"; +// for(int n=0; n<nofNodes; n++) +// out<< val<1>(nodes[n]) <<" "<< val<2>(nodes[n]) <<" "<< val<3>(nodes[n]) <<" "; +// +// out<<"\n"; +// out<<" </DataArray>\n"; +// out<<" </Points>\n"; +// +// //CELLS SECTION +// out<<" <Cells>\n"; +// out<<" <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\">\n"; +// +// for(int c=0; c<nofLines; c++) +// out<< val<1>(lines[c]) <<" "<< val<2>(lines[c])<<" "; +// out<<"\n"; +// out<<" </DataArray>\n"; +// out<<" <DataArray type=\"Int32\" Name=\"offsets\" format=\"ascii\">\n"; +// for(int c=1; c<=nofLines; c++) +// out<<c*2<<" " ; +// +// out<<"\n"; +// out<<" </DataArray>\n"; +// +// out<<" <DataArray type=\"UInt8\" Name=\"types\" format=\"ascii\">\n"; +// +// for(int c=0; c<nofLines; c++) +// out<<"3 "; +// out<<"\n"; +// out<<" </DataArray>\n"; +// out<<" </Cells>\n"; +// +// //write data section +// out<<" <PointData Scalars=\"Scalars\"> \n"; +// for(int s=0; s<(int)datanames.size(); ++s) +// { +// out<< " <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"ascii\"> \n"; +// +// for(int d=0; d<(int)nodedata[s].size(); d++) +// out<<nodedata[s][d]<<" "; +// +// out<<"\n </DataArray>\n"; +// } +// out<<" </PointData>\n"; +// out<<" </Piece>\n"; +// out<<" </UnstructuredGrid>\n"; +// out<<"</VTKFile>"; +// out<<endl; +// out.close(); +// UBLOG(logDEBUG1,"WbWriterVtkXmlASCII::writeLinesWithNodeData to "<<vtkfilename<<" - end"); +// +// return vtkfilename; +//} /*===============================================================================*/ std::string WbWriterVtkXmlASCII::writeTriangles(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt3 >& triangles) { diff --git a/src/basics/basics/writer/WbWriterVtkXmlASCII.h b/src/basics/basics/writer/WbWriterVtkXmlASCII.h index 97e60486fc82deee1c634c4c5472781f48924b3a..e43d976494d46cb045df4c53ca2ff5f4bdc11f7d 100644 --- a/src/basics/basics/writer/WbWriterVtkXmlASCII.h +++ b/src/basics/basics/writer/WbWriterVtkXmlASCII.h @@ -58,7 +58,7 @@ private: static std::string pvdEndTag; public: - std::string getFileExtension() { return ".ascii.vtu"; } + std::string getFileExtension() override { return ".ascii.vtu"; } //write a metafile std::string writeCollection(const std::string& filename, const std::vector<std::string>& filenames, const double& timesteps, const bool& sepGroups);//std::vector<double>& groups, std::vector<double>& parts); @@ -67,16 +67,17 @@ public: ////////////////////////////////////////////////////////////////////////// //nodes - std::string writeNodes(const std::string& filename,std::vector< UbTupleFloat3 >& nodes); - std::string writeNodesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata); - std::string writeNodesWithNodeDataDouble(const std::string& filename,std::vector< UbTupleDouble3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata); + std::string writeNodes(const std::string& filename,std::vector< UbTupleFloat3 >& nodes) override; + std::string writeNodesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata) override; + std::string writeNodesWithNodeDataDouble(const std::string& filename,std::vector< UbTupleDouble3 >& nodes, std::vector<std::string >& datanames, std::vector<std::vector<double > >& nodedata) override; ////////////////////////////////////////////////////////////////////////// //lines // 0 ---- 1 //nodenumbering must start with 0! - std::string writeLines(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines); - std::string writeLinesWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata); + std::string writeLines(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines) override; + //std::string writeLinesWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata); + //FIXME: hides function in base class ////////////////////////////////////////////////////////////////////////// //triangles @@ -84,8 +85,8 @@ public: // // 0---1 //nodenumbering must start with 0! - std::string writeTriangles(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt3 >& triangles); - std::string writeTrianglesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt3 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata); + std::string writeTriangles(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt3 >& triangles) override; + std::string writeTrianglesWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt3 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata) override; ////////////////////////////////////////////////////////////////////////// //2D @@ -95,12 +96,12 @@ public: // 0---1 //nodenumbering must start with 0! - std::string writeQuads(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells); - std::string writeQuadsWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata); - std::string writeQuadsWithCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& celldata); + std::string writeQuads(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells) override; + std::string writeQuadsWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata) override; + std::string writeQuadsWithCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& celldata) override; std::string writeQuadsWithNodeAndCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt4 >& cells, std::vector< std::string >& nodedatanames, std::vector< std::vector< double > >& nodedata, std::vector< std::string >& celldatanames, - std::vector< std::vector< double > >& celldata ); + std::vector< std::vector< double > >& celldata) override; ////////////////////////////////////////////////////////////////////////// //octs @@ -111,9 +112,9 @@ public: // | 3 ---+ 2 // |/ |/ // 0 ---- 1 - std::string writeOcts(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt8 >& cells); - std::string writeOctsWithCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt8 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& celldata); - std::string writeOctsWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleUInt8 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata); + std::string writeOcts(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt8 >& cells) override; + std::string writeOctsWithCellData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleInt8 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& celldata) override; + std::string writeOctsWithNodeData(const std::string& filename,std::vector< UbTupleFloat3 >& nodes, std::vector< UbTupleUInt8 >& cells, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata) override; private: diff --git a/src/basics/basics/writer/WbWriterVtkXmlBinary.cpp b/src/basics/basics/writer/WbWriterVtkXmlBinary.cpp index a1133890e43538affe6d84eaa134b97706198a89..448aeb91f0c67aa0352f01e5df01c2469666d22c 100644 --- a/src/basics/basics/writer/WbWriterVtkXmlBinary.cpp +++ b/src/basics/basics/writer/WbWriterVtkXmlBinary.cpp @@ -237,125 +237,125 @@ string WbWriterVtkXmlBinary::writeLines(const string& filename,vector<UbTupleFlo return vtkfilename; } /*===============================================================================*/ -std::string WbWriterVtkXmlBinary::writeLinesWithNodeData(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata) -{ - string vtkfilename = filename+getFileExtension(); - UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeLinesWithNodeData to "<<vtkfilename<<" - start"); - - ofstream out(vtkfilename.c_str(),ios::out | ios::binary); - if(!out) - { - out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! - string path = UbSystem::getPathFromString(vtkfilename); - if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);} - if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename); - } - - int nofNodes = (int)nodes.size(); - int nofCells = (int)lines.size(); - - int bytesPerByteVal = 4; //==sizeof(int) - int bytesPoints = 3 /*x1/x2/x3 */ * nofNodes * sizeof(float); - int bytesCellConnectivty = 2 /*nodes per line */ * nofCells * sizeof(int ); - int bytesCellOffsets = 1 /*offset per line */ * nofCells * sizeof(int ); - int bytesCellTypes = 1 /*type of line */ * nofCells * sizeof(unsigned char); - int bytesScalarData = 1 /*scalar */ * nofNodes * sizeof(float); - - int offset = 0; - //VTK FILE - out<<"<?xml version=\"1.0\"?>\n"; - out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n"; - out<<" <UnstructuredGrid>"<<"\n"; - out<<" <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n"; - - //POINTS SECTION - out<<" <Points>\n"; - out<<" <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\" />\n"; - out<<" </Points>\n"; - offset += (bytesPerByteVal + bytesPoints); - - //CELLS SECTION - out<<" <Cells>\n"; - out<<" <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n"; - offset += (bytesPerByteVal + bytesCellConnectivty); - out<<" <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n"; - offset += (bytesPerByteVal + bytesCellOffsets); - out<<" <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n "; - offset += (bytesPerByteVal + bytesCellTypes); - out<<" </Cells>\n"; - - //DATA SECTION - out<<" <PointData>\n"; - for(size_t s=0; s<datanames.size(); ++s) - { - out<< " <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n"; - offset += (bytesPerByteVal + bytesScalarData); - } - out<<" </PointData>\n"; - - out<<" </Piece>\n"; - out<<" </UnstructuredGrid>\n"; - - // AppendedData SECTION - out<<" <AppendedData encoding=\"raw\">\n"; - out<<"_"; - - //POINTS SECTION - out.write((char*)&bytesPoints,bytesPerByteVal); - for(int n=0; n<nofNodes; n++) - { - out.write((char*)&val<1>(nodes[n]),sizeof(float)); - out.write((char*)&val<2>(nodes[n]),sizeof(float)); - out.write((char*)&val<3>(nodes[n]),sizeof(float)); - } - - //CELLS SECTION - //cellConnectivity - out.write( (char*)&bytesCellConnectivty, bytesPerByteVal ); - for(int c=0; c<nofCells; c++) - { - out.write( (char*)&val<1>(lines[c]), sizeof(int) ); - out.write( (char*)&val<2>(lines[c]), sizeof(int) ); - } - - //cellOffsets - out.write( (char*)&bytesCellOffsets, bytesPerByteVal ); - int itmp; - for(int c=1; c<=nofCells; c++) - { - itmp = 3 * c; - out.write( (char*)&itmp, sizeof(int) ); - } - - //cellTypes - out.write( (char*)&bytesCellTypes, bytesPerByteVal ); - unsigned char vtkCellType = 5; - for(int c=0; c<nofCells; c++) - { - out.write( (char*)&vtkCellType, sizeof(unsigned char) ); - } - - //DATA SECTION - //scalarData - for(size_t s=0; s<datanames.size(); ++s) - { - out.write((char*)&bytesScalarData,bytesPerByteVal); - for(size_t d=0; d<nodedata[s].size(); ++d) - { - //loake kopie machen, da in nodedata "doubles" sind - float tmp = (float)nodedata[s][d]; - out.write((char*)&tmp,sizeof(float)); - } - } - out<<"\n</AppendedData>\n"; - out<<"</VTKFile>"; - out<<endl; - out.close(); - UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeLinesWithNodeData to "<<vtkfilename<<" - end"); - - return vtkfilename; - -} +//std::string WbWriterVtkXmlBinary::writeLinesWithNodeData(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata) +//{ +// string vtkfilename = filename+getFileExtension(); +// UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeLinesWithNodeData to "<<vtkfilename<<" - start"); +// +// ofstream out(vtkfilename.c_str(),ios::out | ios::binary); +// if(!out) +// { +// out.clear(); //flags ruecksetzen (ansonsten liefert utern if(!out) weiterhin true!!! +// string path = UbSystem::getPathFromString(vtkfilename); +// if(path.size()>0){ UbSystem::makeDirectory(path); out.open(vtkfilename.c_str(),ios::out | ios::binary);} +// if(!out) throw UbException(UB_EXARGS,"couldn't open file "+vtkfilename); +// } +// +// int nofNodes = (int)nodes.size(); +// int nofCells = (int)lines.size(); +// +// int bytesPerByteVal = 4; //==sizeof(int) +// int bytesPoints = 3 /*x1/x2/x3 */ * nofNodes * sizeof(float); +// int bytesCellConnectivty = 2 /*nodes per line */ * nofCells * sizeof(int ); +// int bytesCellOffsets = 1 /*offset per line */ * nofCells * sizeof(int ); +// int bytesCellTypes = 1 /*type of line */ * nofCells * sizeof(unsigned char); +// int bytesScalarData = 1 /*scalar */ * nofNodes * sizeof(float); +// +// int offset = 0; +// //VTK FILE +// out<<"<?xml version=\"1.0\"?>\n"; +// out<<"<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\" >"<<"\n"; +// out<<" <UnstructuredGrid>"<<"\n"; +// out<<" <Piece NumberOfPoints=\""<<nofNodes<<"\" NumberOfCells=\""<<nofCells<<"\">\n"; +// +// //POINTS SECTION +// out<<" <Points>\n"; +// out<<" <DataArray type=\"Float32\" NumberOfComponents=\"3\" format=\"appended\" offset=\""<< offset <<"\" />\n"; +// out<<" </Points>\n"; +// offset += (bytesPerByteVal + bytesPoints); +// +// //CELLS SECTION +// out<<" <Cells>\n"; +// out<<" <DataArray type=\"Int32\" Name=\"connectivity\" format=\"appended\" offset=\""<< offset <<"\" />\n"; +// offset += (bytesPerByteVal + bytesCellConnectivty); +// out<<" <DataArray type=\"Int32\" Name=\"offsets\" format=\"appended\" offset=\""<< offset <<"\" />\n"; +// offset += (bytesPerByteVal + bytesCellOffsets); +// out<<" <DataArray type=\"UInt8\" Name=\"types\" format=\"appended\" offset=\""<< offset <<"\" />\n "; +// offset += (bytesPerByteVal + bytesCellTypes); +// out<<" </Cells>\n"; +// +// //DATA SECTION +// out<<" <PointData>\n"; +// for(size_t s=0; s<datanames.size(); ++s) +// { +// out<< " <DataArray type=\"Float32\" Name=\""<< datanames[s] <<"\" format=\"appended\" offset=\""<< offset <<"\" /> \n"; +// offset += (bytesPerByteVal + bytesScalarData); +// } +// out<<" </PointData>\n"; +// +// out<<" </Piece>\n"; +// out<<" </UnstructuredGrid>\n"; +// +// // AppendedData SECTION +// out<<" <AppendedData encoding=\"raw\">\n"; +// out<<"_"; +// +// //POINTS SECTION +// out.write((char*)&bytesPoints,bytesPerByteVal); +// for(int n=0; n<nofNodes; n++) +// { +// out.write((char*)&val<1>(nodes[n]),sizeof(float)); +// out.write((char*)&val<2>(nodes[n]),sizeof(float)); +// out.write((char*)&val<3>(nodes[n]),sizeof(float)); +// } +// +// //CELLS SECTION +// //cellConnectivity +// out.write( (char*)&bytesCellConnectivty, bytesPerByteVal ); +// for(int c=0; c<nofCells; c++) +// { +// out.write( (char*)&val<1>(lines[c]), sizeof(int) ); +// out.write( (char*)&val<2>(lines[c]), sizeof(int) ); +// } +// +// //cellOffsets +// out.write( (char*)&bytesCellOffsets, bytesPerByteVal ); +// int itmp; +// for(int c=1; c<=nofCells; c++) +// { +// itmp = 3 * c; +// out.write( (char*)&itmp, sizeof(int) ); +// } +// +// //cellTypes +// out.write( (char*)&bytesCellTypes, bytesPerByteVal ); +// unsigned char vtkCellType = 5; +// for(int c=0; c<nofCells; c++) +// { +// out.write( (char*)&vtkCellType, sizeof(unsigned char) ); +// } +// +// //DATA SECTION +// //scalarData +// for(size_t s=0; s<datanames.size(); ++s) +// { +// out.write((char*)&bytesScalarData,bytesPerByteVal); +// for(size_t d=0; d<nodedata[s].size(); ++d) +// { +// //loake kopie machen, da in nodedata "doubles" sind +// float tmp = (float)nodedata[s][d]; +// out.write((char*)&tmp,sizeof(float)); +// } +// } +// out<<"\n</AppendedData>\n"; +// out<<"</VTKFile>"; +// out<<endl; +// out.close(); +// UBLOG(logDEBUG1,"WbWriterVtkXmlBinary::writeLinesWithNodeData to "<<vtkfilename<<" - end"); +// +// return vtkfilename; +// +//} /*===============================================================================*/ string WbWriterVtkXmlBinary::writeTriangles(const string& filename,vector<UbTupleFloat3 >& nodes, vector<UbTupleInt3 >& triangles) { diff --git a/src/basics/basics/writer/WbWriterVtkXmlBinary.h b/src/basics/basics/writer/WbWriterVtkXmlBinary.h index b4b03cf68efe298d42a64d003ef6cb9d495e95ba..6119fd2205c79c2f1db6cffff13f9e9a32985285 100644 --- a/src/basics/basics/writer/WbWriterVtkXmlBinary.h +++ b/src/basics/basics/writer/WbWriterVtkXmlBinary.h @@ -75,7 +75,8 @@ public: // 0 ---- 1 //nodenumbering must start with 0! std::string writeLines(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines); - std::string writeLinesWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata); + //std::string writeLinesWithNodeData(const std::string& filename,std::vector<UbTupleFloat3 >& nodes, std::vector<UbTupleInt2 >& lines, std::vector< std::string >& datanames, std::vector< std::vector< double > >& nodedata); + // FIXME: hides function in base class ////////////////////////////////////////////////////////////////////////// //triangles diff --git a/src/basics/geometry3d/GbObject3D.h b/src/basics/geometry3d/GbObject3D.h index 09a3ef38bcd66d3dc907da2a49c0e5db6ae110a6..b0cca70e42ce8f9967f36f22b4dc69bb2edfe6b2 100644 --- a/src/basics/geometry3d/GbObject3D.h +++ b/src/basics/geometry3d/GbObject3D.h @@ -61,10 +61,8 @@ class GbObject3DCreator; class GbObject3D : public ObObject { public: - virtual ~GbObject3D(){} - //abstract Methods - virtual void finalize() =0 ; //detroys also all dynamic objects (e.g. GbPoints in GbLine) + virtual void finalize() = 0 ; //destroys also all dynamic objects (e.g. GbPoints in GbLine) /** * Returns the centroid x1 coordinate of this 3D object. * @return the centroid x1 coordinate of this 3D object @@ -136,7 +134,7 @@ public: virtual bool isInsideCell(const double& minX1,const double& minX2,const double& minX3,const double& maxX1,const double& maxX2,const double& maxX3); - virtual GbLine3D* createClippedLine3D (GbPoint3D &point1, GbPoint3D &point2)=0; + virtual GbLine3D* createClippedLine3D (GbPoint3D &point1, GbPoint3D &point2) = 0; virtual std::vector<GbTriangle3D*> getSurfaceTriangleSet()=0; virtual void addSurfaceTriangleSet(std::vector<UbTupleFloat3>& nodes, std::vector<UbTupleInt3>& triangles) { throw UbException("GbObject3D::addSurfaceTriangleSet - not implemented for "+(std::string)typeid(*this).name()); } diff --git a/src/basics/geometry3d/GbPolygon3D.h b/src/basics/geometry3d/GbPolygon3D.h index e9a499c0f12e040b9427424c03509440c32c7b8d..96b96a3acf08f9296f4584834a1390cec6d823e9 100644 --- a/src/basics/geometry3d/GbPolygon3D.h +++ b/src/basics/geometry3d/GbPolygon3D.h @@ -113,8 +113,8 @@ public: /* * Creates a 2D polygon as clone of this 2D polygon. */ - GbPolygon3D* clone() { return(new GbPolygon3D(this)); } - void finalize() + GbPolygon3D* clone() override { return(new GbPolygon3D(this)); } + void finalize() override { throw UbException(UB_EXARGS,"toDo"); } @@ -197,15 +197,15 @@ public: // if(!this.consistent) this.calculateValues(); // return(this.area); //} - double getX1Centroid(); - double getX1Minimum(); - double getX1Maximum(); - double getX2Centroid(); - double getX2Minimum(); - double getX2Maximum(); - double getX3Centroid(); - double getX3Minimum(); - double getX3Maximum(); + double getX1Centroid() override; + double getX1Minimum() override; + double getX1Maximum() override; + double getX2Centroid() override; + double getX2Minimum() override; + double getX2Maximum() override; + double getX3Centroid() override; + double getX3Minimum() override; + double getX3Maximum() override; /* * Adds a point to the end of this polygon. Notifies the observers of this 2D polygon. @@ -243,31 +243,32 @@ public: // } // catch(Exception e){ return(false); } // } - std::vector<GbTriangle3D*> getSurfaceTriangleSet() + std::vector<GbTriangle3D*> getSurfaceTriangleSet() override { std::cout<<"GbPolygon3D::getSurfaceTriangleSet() - not implemented\n"; std::vector<GbTriangle3D*> tmp; return tmp; } - bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3) + bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3) override { throw UbException(__FILE__, __LINE__, "GbPolygon3D::isPointInObject3D- not implemented"); } - bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3, bool& pointIsOnBoundary) + bool isPointInGbObject3D(const double& x1, const double& x2, const double& x3, bool& pointIsOnBoundary) override { throw UbException(__FILE__, __LINE__, "GbPolygon3D::isPointInObject3D- not implemented"); } - bool isCellInsideGbObject3D(double x11,double x21,double x31,double x12,double x22,double x32) { return false; } + bool isCellInsideGbObject3D(const double& x1a,const double& x2a,const double& x3a,const double& x1b,const double& x2b,const double& x3b) override { return false; } - GbLine3D* createClippedLine3D (GbPoint3D& point1, GbPoint3D &point2) + GbLine3D* createClippedLine3D (GbPoint3D& point1, GbPoint3D &point2) override { throw UbException(__FILE__, __LINE__, "GbPolygon3D::createClippedLine3D - not implemented"); - } + } + /* * Returns a string representation of this 2D polygon. * @return a string representation of this 2D polygon */ - std::string toString(); + std::string toString() override; /*======================================================================*/ /* Private Methoden */ diff --git a/src/cpu/VirtualFluids.h b/src/cpu/VirtualFluids.h index 84f2f35176d15eecbd3773fc9e5253311a68c94f..e3ba04218d311bfd25758397fb34d7052e46731b 100644 --- a/src/cpu/VirtualFluids.h +++ b/src/cpu/VirtualFluids.h @@ -10,7 +10,7 @@ // \ \| | | | __ __ __ __ ______ _______ // \ | | |_____ | | | | | | | | | _ \ / _____) // \ | | _____| | | | | | | | | | | \ \ \_______ -// \ | | | | |_____ | \_/ | | | | |_/ / _____ \ +// \ | | | | |_____ | \_/ | | | | |_/ / _____ | // \ _____| |__| |________| \_______/ |__| |______/ (_______/ // // This file is part of VirtualFluids. VirtualFluids is free software: you can diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h index d7bb9c0432e714cc0334487a7ef7838085dac8e2..45a06b56b72786dee4506b74421008f91ec536be 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/BCAlgorithm.h @@ -59,7 +59,7 @@ public: public: BCAlgorithm(); - virtual ~BCAlgorithm() {} + virtual ~BCAlgorithm() = default; virtual void addDistributions(SPtr<DistributionArray3D> distributions) = 0; void setNodeIndex(int x1, int x2, int x3); @@ -89,7 +89,7 @@ protected: typedef void(*CalcMacrosFct)(const LBMReal* const& /*f[27]*/, LBMReal& /*rho*/, LBMReal& /*vx1*/, LBMReal& /*vx2*/, LBMReal& /*vx3*/); typedef LBMReal(*CalcFeqForDirFct)(const int& /*direction*/, const LBMReal& /*(d)rho*/, const LBMReal& /*vx1*/, const LBMReal& /*vx2*/, const LBMReal& /*vx3*/); - typedef void(*CalcFeqFct)(LBMReal* const& /*feq/*[27]*/, const LBMReal& /*rho*/, const LBMReal& /*vx1*/, const LBMReal& /*vx2*/, const LBMReal& /*vx3*/); + typedef void(*CalcFeqFct)(LBMReal* const& /*feq[27]*/, const LBMReal& /*rho*/, const LBMReal& /*vx1*/, const LBMReal& /*vx2*/, const LBMReal& /*vx3*/); CalcFeqForDirFct calcFeqsForDirFct ; CalcMacrosFct calcMacrosFct; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.cpp index 677eb3ef7105db64e784bf369323d2815b33c961..b5b8e54c1f968327366ed8bae81fb978682f1920 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.cpp @@ -39,11 +39,6 @@ NoSlipBCAlgorithm::NoSlipBCAlgorithm() { BCAlgorithm::type = BCAlgorithm::NoSlipBCAlgorithm; BCAlgorithm::preCollision = false; -} -////////////////////////////////////////////////////////////////////////// -NoSlipBCAlgorithm::~NoSlipBCAlgorithm() -{ - } ////////////////////////////////////////////////////////////////////////// SPtr<BCAlgorithm> NoSlipBCAlgorithm::clone() diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.h index b2dfa7b39f9128c117c0338b09e6c2da013d5402..163ec5ae89deb614481ecc73fddb436a4086f404 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/NoSlipBCAlgorithm.h @@ -44,9 +44,8 @@ class NoSlipBCAlgorithm : public BCAlgorithm { public: NoSlipBCAlgorithm(); - virtual ~NoSlipBCAlgorithm(); - SPtr<BCAlgorithm> clone(); - void addDistributions(SPtr<DistributionArray3D> distributions); + SPtr<BCAlgorithm> clone() override; + void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; private: }; diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.cpp index 9284a71aee058c294abb9879710d673757c9fbd1..69759b7270f861acb9a2fd5483efc3e10119047d 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAdapter.cpp @@ -238,7 +238,7 @@ void VelocityBCAdapter::init(const D3Q27Interactor* const& interactor, const dou vx1BCs[pos].setStartTime( vx1BCs[pos].getStartTime() + timeStep ); vx1BCs[pos].setEndTime( vx1BCs[pos].getEndTime() + timeStep ); } - if( UbMath::equal(maxEndtime,BCFunction::INFCONST) ) + if( UbMath::equal(maxEndtime,BCFunction::INFCONST) ) for(size_t pos=0; pos<vx2BCs.size(); ++pos) { vx2BCs[pos].setStartTime( vx2BCs[pos].getStartTime() + timeStep ); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.cpp b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.cpp index 595907b5982ff6c1c1f53257b0850fd72450d798..f21ead4bb236b3c7646ed6840530f817144f308e 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.cpp +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.cpp @@ -41,10 +41,6 @@ VelocityBCAlgorithm::VelocityBCAlgorithm() BCAlgorithm::preCollision = false; } ////////////////////////////////////////////////////////////////////////// -VelocityBCAlgorithm::~VelocityBCAlgorithm() -{ -} -////////////////////////////////////////////////////////////////////////// SPtr<BCAlgorithm> VelocityBCAlgorithm::clone() { SPtr<BCAlgorithm> bc(new VelocityBCAlgorithm()); @@ -61,18 +57,18 @@ void VelocityBCAlgorithm::applyBC() LBMReal f[D3Q27System::ENDF+1]; LBMReal feq[D3Q27System::ENDF+1]; distributions->getDistributionInv(f, x1, x2, x3); - LBMReal rho, vx1, vx2, vx3, drho; + LBMReal vx1, vx2, vx3, drho; calcMacrosFct(f, drho, vx1, vx2, vx3); calcFeqFct(feq, drho, vx1, vx2, vx3); - rho = 1.0+drho*compressibleFactor; + //rho = 1.0+drho*compressibleFactor; for (int fdir = D3Q27System::FSTARTDIR; fdir<=D3Q27System::FENDDIR; fdir++) { if (bcPtr->hasVelocityBoundaryFlag(fdir)) { const int invDir = D3Q27System::INVDIR[fdir]; - LBMReal q = bcPtr->getQ(invDir); + //LBMReal q = bcPtr->getQ(invDir); LBMReal velocity = bcPtr->getBoundaryVelocity(invDir); LBMReal fReturn = f[invDir] - velocity; // TODO: compare with development distributions->setDistributionForDirection(fReturn, x1+D3Q27System::DX1[invDir], x2+D3Q27System::DX2[invDir], x3+D3Q27System::DX3[invDir], fdir); diff --git a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.h b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.h index f4d62f5367f1219fa782684232004de2a8244af0..fedd86982d400da5458d216640d8bbd634087ffe 100644 --- a/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.h +++ b/src/cpu/VirtualFluidsCore/BoundaryConditions/VelocityBCAlgorithm.h @@ -44,9 +44,8 @@ class VelocityBCAlgorithm : public BCAlgorithm { public: VelocityBCAlgorithm(); - ~VelocityBCAlgorithm(); - SPtr<BCAlgorithm> clone(); - void addDistributions(SPtr<DistributionArray3D> distributions); + SPtr<BCAlgorithm> clone() override; + void addDistributions(SPtr<DistributionArray3D> distributions) override; void applyBC() override; }; diff --git a/src/cpu/VirtualFluidsCore/CMakeLists.txt b/src/cpu/VirtualFluidsCore/CMakeLists.txt index cc25a66d6e6773005ddd173963691c58cd4633d9..7f4ecffbfd8512c374331b09a9f9cb27162de7cd 100644 --- a/src/cpu/VirtualFluidsCore/CMakeLists.txt +++ b/src/cpu/VirtualFluidsCore/CMakeLists.txt @@ -1,16 +1,16 @@ - - -vf_add_library(BUILDTYPE static DEPENDS basics muparser) - -vf_get_library_name(library_name) - -target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/BoundaryConditions) -target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Connectors) -target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Data) -target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Interactors) -target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/LBM) -target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Parallel) -target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Grid) -target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Visitors) -target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/CoProcessors) -target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Utilities) + + +vf_add_library(BUILDTYPE static DEPENDS basics muparser) + +vf_get_library_name(library_name) + +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/BoundaryConditions) +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Connectors) +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Data) +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Interactors) +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/LBM) +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Parallel) +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Grid) +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Visitors) +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/CoProcessors) +target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Utilities) diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp index 69f1562e66a90f009dbeb9fd8179db0517a8cebe..e881706cacc53a98076131da2022fc417d9bf1e7 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/CoProcessors/NUPSCounterCoProcessor.cpp @@ -40,10 +40,10 @@ NUPSCounterCoProcessor::NUPSCounterCoProcessor(SPtr<Grid3D> grid, SPtr<UbScheduler> s, int numOfThreads, SPtr<Communicator> comm) : CoProcessor(grid, s), numOfThreads(numOfThreads), - comm(comm), nup(0), nup_t(0), - nupsStep(0.0) + nupsStep(0.0), + comm(comm) { if (comm->getProcessID() == comm->getRoot()) { diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp index dc9549c205beacbaa931913def35c5e10b79a90f..5f2c8f08954585d4f990d6175d37884db854e3ba 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.cpp @@ -145,7 +145,6 @@ void WriteBoundaryConditionsCoProcessor::clearData() void WriteBoundaryConditionsCoProcessor::addDataGeo(SPtr<Block3D> block) { UbTupleDouble3 org = grid->getBlockWorldCoordinates(block); - UbTupleDouble3 blockLengths = grid->getBlockLengths(block); UbTupleDouble3 nodeOffset = grid->getNodeOffset(block); double dx = grid->getDeltaX(block); @@ -185,10 +184,6 @@ void WriteBoundaryConditionsCoProcessor::addDataGeo(SPtr<Block3D> block) maxX2 -= 1; maxX3 -= 1; - int s=0; - - - for (size_t ix3 = minX3; ix3<=maxX3; ix3++) { for (size_t ix2 = minX2; ix2<=maxX2; ix2++) diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h index 5786f038989f455236ff79b075219bea66fcd1e2..73bd92ffe485fad78adf34aaa2aeaf07e28b400d 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteBoundaryConditionsCoProcessor.h @@ -79,7 +79,6 @@ private: std::vector<std::vector<double> > data; std::string path; WbWriter* writer; - bool bcInformation; std::vector<std::vector<SPtr<Block3D> > > blockVector; int minInitLevel; int maxInitLevel; diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp index 6789ff59e0dc115c36a229253def15326d39fede..5a5edcd0c551c77f43666ad74781645e66561db8 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.cpp @@ -149,8 +149,6 @@ void WriteMacroscopicQuantitiesCoProcessor::clearData() ////////////////////////////////////////////////////////////////////////// void WriteMacroscopicQuantitiesCoProcessor::addDataMQ(SPtr<Block3D> block) { - double blockID = (double)block->getGlobalID(); - //This data is written: datanames.resize(0); datanames.push_back("DRho"); diff --git a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h index 67a1c61f3be38a91d2feb01657492508d523aa83..0386f938191630894e3facf04a2fa721e3fb6287 100644 --- a/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h +++ b/src/cpu/VirtualFluidsCore/CoProcessors/WriteMacroscopicQuantitiesCoProcessor.h @@ -88,7 +88,6 @@ private: std::string path; WbWriter* writer; SPtr<LBMUnitConverter> conv; - bool bcInformation; std::vector<std::vector<SPtr<Block3D> > > blockVector; int minInitLevel; int maxInitLevel; diff --git a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp index c5f6bd76d3043b07b4abb6e164dd481c856d6ff8..85af639e93a6e272ff42af97dee438dbad264f47 100644 --- a/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp +++ b/src/cpu/VirtualFluidsCore/Data/D3Q27EsoTwist3DSplittedVector.cpp @@ -194,64 +194,60 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionInv(const LBMReal* const f, s ////////////////////////////////////////////////////////////////////////// void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) { - bool directionFlag = false; if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE) - (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::E]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::E]; if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW) - (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::W]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::W]; if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS) - (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::S]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::S]; if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN) - (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::N]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::N]; if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB) - (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::B]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::B]; if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT) - (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::T]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::T]; if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW) - (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::SW]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::SW]; if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE) - (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::NE]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::NE]; if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW) - (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::NW]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::NW]; if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE) - (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::SE]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::SE]; if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW) - (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::BW]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::BW]; if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE) - (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::TE]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::TE]; if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW) - (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::TW]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::TW]; if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE) - (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::BE]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::BE]; if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS) - (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::BS]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::BS]; if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN) - (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::TN]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::TN]; if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS) - (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::TS]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::TS]; if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN) - (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::BN]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::BN]; if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW) - (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::BSW]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::BSW]; if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE) - (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::TNE]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::TNE]; if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE) - (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::BSE]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::BSE]; if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW) - (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::TNW]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::TNW]; if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW) - (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::BNW]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::BNW]; if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE) - (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::TSE]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::TSE]; if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE) - (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::BNE]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::BNE]; if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW) - (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1) = f[D3Q27System::TSW]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1) = f[D3Q27System::TSW]; if ((direction & EsoTwistD3Q27System::REST) == EsoTwistD3Q27System::REST) - (*this->restDistributions)(x1,x2,x3) = f[D3Q27System::REST]; directionFlag=true; -#ifdef _DEBUG - if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); -#endif //DEBUG + (*this->restDistributions)(x1,x2,x3) = f[D3Q27System::REST]; } ////////////////////////////////////////////////////////////////////////// void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, int direction) @@ -346,64 +342,60 @@ void D3Q27EsoTwist3DSplittedVector::setDistributionForDirection(LBMReal f, size_ ////////////////////////////////////////////////////////////////////////// void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(const LBMReal* const f, size_t x1, size_t x2, size_t x3, unsigned long int direction) { - bool directionFlag = false; if ((direction & EsoTwistD3Q27System::etE) == EsoTwistD3Q27System::etE) - (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::E]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_E,x1, x2, x3) = f[D3Q27System::E]; if ((direction & EsoTwistD3Q27System::etW) == EsoTwistD3Q27System::etW) - (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::W]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_W,x1+1,x2, x3 ) = f[D3Q27System::W]; if ((direction & EsoTwistD3Q27System::etS) == EsoTwistD3Q27System::etS) - (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::S]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_S,x1, x2+1,x3 ) = f[D3Q27System::S]; if ((direction & EsoTwistD3Q27System::etN) == EsoTwistD3Q27System::etN) - (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::N]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_N,x1, x2, x3) = f[D3Q27System::N]; if ((direction & EsoTwistD3Q27System::etB) == EsoTwistD3Q27System::etB) - (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::B]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_B,x1, x2, x3+1 ) = f[D3Q27System::B]; if ((direction & EsoTwistD3Q27System::etT) == EsoTwistD3Q27System::etT) - (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::T]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_T,x1, x2, x3) = f[D3Q27System::T]; if ((direction & EsoTwistD3Q27System::etSW) == EsoTwistD3Q27System::etSW) - (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::SW]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_SW,x1+1,x2+1,x3 ) = f[D3Q27System::SW]; if ((direction & EsoTwistD3Q27System::etNE) == EsoTwistD3Q27System::etNE) - (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::NE]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_NE,x1, x2, x3) = f[D3Q27System::NE]; if ((direction & EsoTwistD3Q27System::etNW) == EsoTwistD3Q27System::etNW) - (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::NW]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_NW,x1+1,x2, x3) = f[D3Q27System::NW]; if ((direction & EsoTwistD3Q27System::etSE) == EsoTwistD3Q27System::etSE) - (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::SE]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_SE,x1, x2+1,x3 ) = f[D3Q27System::SE]; if ((direction & EsoTwistD3Q27System::etBW) == EsoTwistD3Q27System::etBW) - (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::BW]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BW,x1+1,x2, x3+1 ) = f[D3Q27System::BW]; if ((direction & EsoTwistD3Q27System::etTE) == EsoTwistD3Q27System::etTE) - (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::TE]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TE,x1, x2, x3) = f[D3Q27System::TE]; if ((direction & EsoTwistD3Q27System::etTW) == EsoTwistD3Q27System::etTW) - (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::TW]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TW,x1+1,x2, x3) = f[D3Q27System::TW]; if ((direction & EsoTwistD3Q27System::etBE) == EsoTwistD3Q27System::etBE) - (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::BE]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BE,x1, x2, x3+1 ) = f[D3Q27System::BE]; if ((direction & EsoTwistD3Q27System::etBS) == EsoTwistD3Q27System::etBS) - (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::BS]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BS,x1, x2+1,x3+1 ) = f[D3Q27System::BS]; if ((direction & EsoTwistD3Q27System::etTN) == EsoTwistD3Q27System::etTN) - (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::TN]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TN,x1, x2, x3) = f[D3Q27System::TN]; if ((direction & EsoTwistD3Q27System::etTS) == EsoTwistD3Q27System::etTS) - (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::TS]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TS,x1, x2+1,x3) = f[D3Q27System::TS]; if ((direction & EsoTwistD3Q27System::etBN) == EsoTwistD3Q27System::etBN) - (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::BN]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BN,x1, x2, x3+1 ) = f[D3Q27System::BN]; if ((direction & EsoTwistD3Q27System::etBSW) == EsoTwistD3Q27System::etBSW) - (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BSW,x1+1,x2+1,x3+1) = f[D3Q27System::BSW]; if ((direction & EsoTwistD3Q27System::etTNE) == EsoTwistD3Q27System::etTNE) - (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::TNE]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TNE,x1, x2, x3) = f[D3Q27System::TNE]; if ((direction & EsoTwistD3Q27System::etBSE) == EsoTwistD3Q27System::etBSE) - (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::BSE]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BSE,x1, x2+1,x3+1) = f[D3Q27System::BSE]; if ((direction & EsoTwistD3Q27System::etTNW) == EsoTwistD3Q27System::etTNW) - (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::TNW]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TNW,x1+1,x2, x3) = f[D3Q27System::TNW]; if ((direction & EsoTwistD3Q27System::etBNW) == EsoTwistD3Q27System::etBNW) - (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::BNW]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BNW,x1+1,x2, x3+1) = f[D3Q27System::BNW]; if ((direction & EsoTwistD3Q27System::etTSE) == EsoTwistD3Q27System::etTSE) - (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::TSE]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TSE,x1, x2+1,x3) = f[D3Q27System::TSE]; if ((direction & EsoTwistD3Q27System::etBNE) == EsoTwistD3Q27System::etBNE) - (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1)= f[D3Q27System::BNE]; directionFlag=true; + (*this->nonLocalDistributions)(D3Q27System::ET_BNE,x1, x2, x3+1)= f[D3Q27System::BNE]; if ((direction & EsoTwistD3Q27System::etTSW) == EsoTwistD3Q27System::etTSW) - (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; directionFlag=true; + (*this->localDistributions)(D3Q27System::ET_TSW,x1+1,x2+1,x3) = f[D3Q27System::TSW]; if ((direction & EsoTwistD3Q27System::REST) == EsoTwistD3Q27System::REST) - (*this->restDistributions)(x1,x2,x3) = f[D3Q27System::REST]; directionFlag=true; -#ifdef _DEBUG - if(!directionFlag)UB_THROW( UbException(UB_EXARGS, "Direction didn't find") ); -#endif //DEBUG + (*this->restDistributions)(x1,x2,x3) = f[D3Q27System::REST]; } ////////////////////////////////////////////////////////////////////////// void D3Q27EsoTwist3DSplittedVector::setDistributionInvForDirection(LBMReal f, size_t x1, size_t x2, size_t x3, unsigned long int direction) diff --git a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp b/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp index c97081de67d388e70c2bf629034eb50803b8541e..0af807fcf1df659f9e956956f22a46bbd88e09d5 100644 --- a/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp +++ b/src/cpu/VirtualFluidsCore/Grid/BasicCalculator.cpp @@ -69,7 +69,6 @@ void BasicCalculator::calculate() int maxInitLevel = maxLevel-minLevel; int straightStartLevel = minInitLevel; int internalIterations = 1<<(maxInitLevel-minInitLevel); - int forwardStartLevel; int threshold; #ifdef TIMING @@ -87,7 +86,6 @@ void BasicCalculator::calculate() for (int staggeredStep = 1; staggeredStep<=internalIterations; staggeredStep++) { - forwardStartLevel = straightStartLevel; if (staggeredStep==internalIterations) straightStartLevel = minInitLevel; else { diff --git a/src/cpu/VirtualFluidsCore/Grid/Calculator.cpp b/src/cpu/VirtualFluidsCore/Grid/Calculator.cpp index 8155e33aedbda737bc5cb9ff9dd885dc843b9a70..45de9261c5d882a9f96a006974f53e9084ea02a4 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Calculator.cpp +++ b/src/cpu/VirtualFluidsCore/Grid/Calculator.cpp @@ -66,7 +66,7 @@ Calculator::Calculator(SPtr<Grid3D> grid, SPtr<UbScheduler> additionalGhostLayer { std::vector<SPtr<Block3D>> blockVector; grid->getBlocks(level, gridRank, true, blockVector); - for (SPtr<Block3D> const block : blockVector) + for (const auto& block : blockVector) if (block) blocks[block->getLevel()].push_back(block); } diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp index 6c00ae5b2e1cd9f4d89ea9aefd1fc979120b28c6..ac4577abfcb3b4dc3b453c9b9f6181a9fcca96b2 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp +++ b/src/cpu/VirtualFluidsCore/Grid/Grid3D.cpp @@ -183,7 +183,7 @@ void Grid3D::addBlock(SPtr<Block3D> block) { this->blockIdMap.insert(std::make_pair(block->getGlobalID(), block)); int level = block->getLevel(); - this->levelSet[level].insert(std::make_pair(Block3DKey(block->getX1(), block->getX2(), block->getX3()), block)).second; + this->levelSet[level].insert(std::make_pair(Block3DKey(block->getX1(), block->getX2(), block->getX3()), block)); } } ////////////////////////////////////////////////////////////////////////// diff --git a/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h b/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h index 8ed0d10e46cbf42f02da8cb90691b4c7b5904885..856b96d0fe0aaa8e80939e974eef32283df700c9 100644 --- a/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h +++ b/src/cpu/VirtualFluidsCore/Grid/Grid3DSystem.h @@ -144,7 +144,7 @@ namespace Grid3DSystem default : return "Cell3DSystem::getDrectionString(...) - unknown dir"; } } - static const int& getInvertDirection(const int& direction); + static const int& getInvertDirection(const int& direction); ////////////////////////////////////////////////////////////////////////// static inline void setNeighborCoordinatesForDirection(int &x1, int &x2,int &x3, const int& direction) diff --git a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp index ed3f9e932438634337ef170cb5906d4b16f6a8ba..7e5b482297cbdff20fea571339e9f91682eef7f6 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp +++ b/src/cpu/VirtualFluidsCore/Interactors/D3Q27Interactor.cpp @@ -129,7 +129,7 @@ void D3Q27Interactor::initInteractor(const double& timeStep) ////////////////////////////////////////////////////////////////////////// //init bcs int nofAdapter = (int)bcAdapters.size(); - if(nofAdapter==0) UBLOG(logWARNING,"WARNING - D3Q27Interactor::initInteractor Warning - no nodeAdapter available"); + if(nofAdapter==0) { UBLOG(logWARNING,"WARNING - D3Q27Interactor::initInteractor Warning - no nodeAdapter available"); } bool needTimeDependence = false; for(int pos=0; pos<nofAdapter; ++pos) { @@ -149,7 +149,7 @@ void D3Q27Interactor::updateInteractor(const double& timestep) ////////////////////////////////////////////////////////////////////////// //update bcs int nofAdapter = (int)bcAdapters.size(); - if(nofAdapter==0) UBLOG(logERROR,"WARNING - D3Q27Interactor::updateInteractor Warning - no nodeAdapter available for "); + if(nofAdapter==0) { UBLOG(logERROR,"WARNING - D3Q27Interactor::updateInteractor Warning - no nodeAdapter available for "); } bool needTimeDependence = false; @@ -220,9 +220,6 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) double internX1,internX2,internX3; - //width of ghost layer - int gl = kernel->getGhostLayerWidth(); - int startIX1 = 0; int startIX2 = 0; int startIX3 = 0; @@ -230,8 +227,7 @@ bool D3Q27Interactor::setDifferencesToGbObject3D(const SPtr<Block3D> block) int stopIX2 = (int)bcArray->getNX2(); int stopIX3 = (int)bcArray->getNX3(); - double dx = grid.lock()->getDeltaX(block); - UbTupleDouble3 orgDelta = grid.lock()->getNodeOffset(block); + double dx = grid.lock()->getDeltaX(block); //other boundingRect than in init, because here the boundrect has to be increased by one dx GbCuboid3D extendedBoundingGeoOfGeoObject( geoObject3D->getX1Minimum()-1.02*dx diff --git a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp index 307a34f727408e1ed9bc6bd5bb421170fd710b10..c05fc12ef3af5e50ee562423efd1ee703bf57740 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp +++ b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.cpp @@ -62,8 +62,7 @@ Interactor3D::Interactor3D() } ////////////////////////////////////////////////////////////////////////// Interactor3D::Interactor3D(SPtr<Grid3D> grid, int type) - : type(type) - , grid(grid) + : grid(grid), type(type) { } diff --git a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h index 9ff168bf80681547de91aac0f870cc306c78ad65..abfffbd316bcb17723a788b41728095fed83940d 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h +++ b/src/cpu/VirtualFluidsCore/Interactors/Interactor3D.h @@ -117,10 +117,10 @@ protected: bool isBlockInsideGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta); bool isBlockCuttingGeoObject(double minX1, double minX2, double minX3, double maxX1, double maxX2, double maxX3, double delta); - int type; - - WPtr<Grid3D> grid; + SPtr<GbObject3D> geoObject3D; + WPtr<Grid3D> grid; + int type; std::vector<SPtr<Block3D> > bcBlocks; std::vector<SPtr<Block3D> > solidBlocks; diff --git a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp index 21d9b87d21feef741c9c7a89f6d11fdaad326f1a..0411b4f19792559f5d8bcbc768e5a392005632e8 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp +++ b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.cpp @@ -69,7 +69,7 @@ void InteractorsHelper::selectBlocks() ////////////////////////////////////////////////////////////////////////// void InteractorsHelper::setBcBlocks() { - for(const SPtr<Interactor3D> interactor : interactors) + for(const auto& interactor : interactors) { SetBcBlocksBlockVisitor v(interactor); grid->accept(v); diff --git a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h index b05ccf8da96d7945f0284f2f024c77c724362024..579040c7e3dffddbd4693d077b4b71c27f4bc5dd 100644 --- a/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h +++ b/src/cpu/VirtualFluidsCore/Interactors/InteractorsHelper.h @@ -60,7 +60,6 @@ private: SPtr<Grid3D> grid; std::vector<SPtr<Block3D> > solidBlocks; SPtr<Grid3DVisitor> visitor; - bool deleteBlocks; }; #endif diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp index b3a3c989b5ad867eafb30bc8eba25421a34e8082..072d8cd90fa892bf72bebb13aa4fd28c5a4aa53c 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.cpp @@ -113,10 +113,6 @@ void CumulantK17LBMKernel::calculate(int step) muForcingX1.DefineVar("nu", &muNu); muForcingX2.DefineVar("nu", &muNu); muForcingX3.DefineVar("nu", &muNu); - - LBMReal forcingX1 = 0; - LBMReal forcingX2 = 0; - LBMReal forcingX3 = 0; } ///////////////////////////////////// @@ -245,9 +241,6 @@ void CumulantK17LBMKernel::calculate(int step) vvy += forcingX2 * deltaT * c1o2; // Y vvz += forcingX3 * deltaT * c1o2; // Z } - /////////////////////////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////////////////// - LBMReal oMdrho = c1; //////////////////////////////////////////////////////////////////////////////////// // calculate the square of velocities for this lattice node LBMReal vx2 = vvx * vvx; diff --git a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h index 49a8da4ac360b2bda8c8071f43d2b8d537e42522..033bf64091b8f6a86f9575c32369de97a6f10693 100644 --- a/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/CumulantK17LBMKernel.h @@ -53,8 +53,8 @@ class CumulantK17LBMKernel : public LBMKernel public: CumulantK17LBMKernel(); virtual ~CumulantK17LBMKernel(void); - virtual void calculate(int step); - virtual SPtr<LBMKernel> clone(); + virtual void calculate(int step) override; + virtual SPtr<LBMKernel> clone() override; protected: inline void forwardInverseChimeraWithK(LBMReal& mfa, LBMReal& mfb, LBMReal& mfc, LBMReal vv, LBMReal v2, LBMReal Kinverse, LBMReal K); diff --git a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h index f1c6c1c79a22124f5d3af7f088a0dfe155f7fd8e..3a7ca9b460a6793e725826dd1c500d7d25e10210 100644 --- a/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h +++ b/src/cpu/VirtualFluidsCore/LBM/D3Q27System.h @@ -531,8 +531,6 @@ namespace D3Q27System static inline void calcDistanceToNeighbors(std::vector<double>& distNeigh, const double& deltaX1,const double& deltaX2,const double& deltaX3) { //distNeigh.resize(FENDDIR+1, UbMath::sqrt2*deltaX1); - double sqrt3 = UbMath::sqrt3; - double sqrt2 = UbMath::sqrt2; distNeigh[E] = distNeigh[W] = deltaX1; distNeigh[N] = distNeigh[S] = deltaX2; distNeigh[T] = distNeigh[B] = deltaX3; diff --git a/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h index d2a657fb1945c274f8d2287f85ffc7f0980bdf57..7b9ba145f09de1f86e07c15816ccda0b9d3043b3 100644 --- a/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/ILBMKernel.h @@ -43,7 +43,7 @@ class DataSet3D; class ILBMKernel { public: - virtual ~ILBMKernel() {}; + virtual ~ILBMKernel() = default; virtual void calculate(int step) = 0; virtual void swapDistributions() = 0; diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp index 7be2e79a54e42db046c70020196389b8065c51dd..ec1bb4049181b613542fc66953a8f0e34859182a 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.cpp @@ -50,11 +50,6 @@ LBMKernel::LBMKernel() : ghostLayerWidth(1), this->nx[0] = 0; this->nx[1] = 0; this->nx[2] = 0; -} -////////////////////////////////////////////////////////////////////////// -LBMKernel::~LBMKernel() -{ - } ////////////////////////////////////////////////////////////////////////// void LBMKernel::setBCProcessor(SPtr<BCProcessor> bcp) diff --git a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h index ba7b5d9ccd7d6b831c39f964b6f8c6ca354ab579..c8b9bc4ebc94170538b282720f59f05b2d2122d6 100644 --- a/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h +++ b/src/cpu/VirtualFluidsCore/LBM/LBMKernel.h @@ -52,23 +52,20 @@ public: typedef std::numeric_limits<LBMReal> LBMRealLim; public: LBMKernel(); - virtual ~LBMKernel(); virtual SPtr<LBMKernel> clone() = 0; - virtual void calculate(int step) = 0; + void setBCProcessor(SPtr<BCProcessor> bcp) override; + SPtr<BCProcessor> getBCProcessor() const override; - void setBCProcessor(SPtr<BCProcessor> bcp); - SPtr<BCProcessor> getBCProcessor() const; - - void setCollisionFactor(double collFactor); - double getCollisionFactor() const; + void setCollisionFactor(double collFactor) override; + double getCollisionFactor() const override; void setGhostLayerWidth(int witdh); - int getGhostLayerWidth() const; + int getGhostLayerWidth() const override; void setDataSet(SPtr<DataSet3D> dataSet); - SPtr<DataSet3D> getDataSet() const; + SPtr<DataSet3D> getDataSet() const override; void setForcingX1(LBMReal forcingX1); void setForcingX2(LBMReal forcingX2); @@ -84,13 +81,13 @@ public: void setIndex(int x1, int x2, int x3); - LBMReal getDeltaT() const; + LBMReal getDeltaT() const override; void setDeltaT(LBMReal dt); - bool getCompressible() const; + bool getCompressible() const override; void setCompressible(bool val); - bool getWithForcing() const; + bool getWithForcing() const override; void setWithForcing(bool val); bool getWithSpongeLayer() const; @@ -102,7 +99,7 @@ public: void setBlock(SPtr<Block3D> block); SPtr<Block3D> getBlock() const; - bool isInsideOfDomain(const int &x1, const int &x2, const int &x3) const; + bool isInsideOfDomain(const int &x1, const int &x2, const int &x3) const override; void swapDistributions() override; diff --git a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp index 9bf49094cf2264e7fd2c95cfdd559d5b590d7b48..e75d09c2cb755204829bc277aba202a8f8f86079 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/BoundaryConditionsBlockVisitor.cpp @@ -75,7 +75,6 @@ void BoundaryConditionsBlockVisitor::visit(SPtr<Grid3D> grid, SPtr<Block3D> bloc bool compressible = kernel->getCompressible(); double collFactor = kernel->getCollisionFactor(); - int level = block->getLevel(); int minX1 = 0; int minX2 = 0; diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp index 0a49f68e6412350893090db7d7c22b27d10b91a0..1f313a21738504ce5604b55f9647a2dd9dbcafaf 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp @@ -168,10 +168,6 @@ void InitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> LBMReal f[D3Q27System::ENDF+1]; - size_t nx1 = distributions->getNX1(); - size_t nx2 = distributions->getNX2(); - size_t nx3 = distributions->getNX3(); - for(int ix3=0; ix3<bcArray->getNX3(); ix3++) for(int ix2=0; ix2<bcArray->getNX2(); ix2++) for(int ix1=0; ix1<bcArray->getNX1(); ix1++)