diff --git a/Applications/LidDrivenCavity/LidDrivenCavity.cpp b/Applications/LidDrivenCavity/LidDrivenCavity.cpp index ec66d2765a1cb5b414eae1cf57e46abcfb7a3b0a..6bc2a2926c24238de56f4f2e5ff11e94ed4a99ba 100644 --- a/Applications/LidDrivenCavity/LidDrivenCavity.cpp +++ b/Applications/LidDrivenCavity/LidDrivenCavity.cpp @@ -84,13 +84,16 @@ int main(int argc, char* argv[]) // set grid spacing grid->setDeltaX(dx); // set block size for three dimensions - grid->setBlockNX(32,32,32); + int blockSize = nx / 2; + grid->setBlockNX(blockSize,blockSize,blockSize); // Create simulation bounding box SPtr<GbObject3D> gridCube(new GbCuboid3D(g_minX1, g_minX2, g_minX3, g_maxX1, g_maxX2, g_maxX3)); GbSystem3D::writeGeoObject(gridCube.get(), path + "/geo/gridCube", WbWriterVtkXmlBinary::getInstance()); - UBLOG(logINFO, "Lid Driven Cavity"); + UBLOG(logINFO, "Lid Driven Cavity:"); + UBLOG(logINFO, "Domain size = " << nx << " x "<< nx << " x "<< nx); + UBLOG(logINFO, "Block size = " << blockSize << " x "<< blockSize << " x "<< blockSize); UBLOG(logINFO, "velocity = " << velocity << " m/s"); UBLOG(logINFO, "velocityLB = " << velocityLB); UBLOG(logINFO, "viscosityLB = " << viscosityLB); diff --git a/CMake/CMakeCompilerMacros.txt b/CMake/CMakeCompilerMacros.txt index ea0e5a9333aac8b6aa77aef7ea25a222fd30b98a..3a3f2c74e750258d38d813681e9a26293193a87f 100644 --- a/CMake/CMakeCompilerMacros.txt +++ b/CMake/CMakeCompilerMacros.txt @@ -89,6 +89,8 @@ MACRO(SET_CAB_COMPILER) IF(CMAKE_COMPILER_IS_GNUCXX) SET(CAB_COMPILER_NAME "gcc") + #SET(CAB_ADDITIONAL_LINK_FLAGS ${CAB_ADDITIONAL_LINK_FLAGS} -lgomp) + SET(USE_GCC ON) ENDIF() SET(CAB_COMPILER "${CAB_COMPILER_NAME}${CAB_COMPILER_VERSION_MAJOR}${CAB_COMPILER_VERSION_MINOR}") diff --git a/CMake/CMakeSetCompilerFlags.txt b/CMake/CMakeSetCompilerFlags.txt index 83e4a75bd5bcd5c224468a9348b55f2665bd82b8..060a82e5766c23ef09d859db2dff3e6d89d64ba4 100644 --- a/CMake/CMakeSetCompilerFlags.txt +++ b/CMake/CMakeSetCompilerFlags.txt @@ -40,7 +40,10 @@ MACRO(SET_COMPILER_SPECIFIC_FLAGS compiler_type build_type) ## unknown compiler ############################################################################################################### ELSE() - MESSAGE(FATAL_ERROR "CAB_COMPILER=${CAB_COMPILER} seems to be a not supported compiler") + #MESSAGE(FATAL_ERROR "CAB_COMPILER=${CAB_COMPILER} seems to be a not supported compiler") + MESSAGE(WARNING "CAB_COMPILER=${CAB_COMPILER} seems to be a not supported compiler; set to generic") + SET(CAB_COMPILER "gccGeneric") + INCLUDE( ${SOURCE_ROOT}/CMake/compilerflags/${CAB_COMPILER}.cmake) ENDIF() diff --git a/VirtualFluidsBasics/basics/utilities/UbSystem.h b/VirtualFluidsBasics/basics/utilities/UbSystem.h index ba99678715191bfd59acea594c1983c693faec56..cf416bbc912b8a409fb56f9e2b3775d50a516598 100644 --- a/VirtualFluidsBasics/basics/utilities/UbSystem.h +++ b/VirtualFluidsBasics/basics/utilities/UbSystem.h @@ -51,11 +51,11 @@ #include "sys/stat.h" #include <sys/syscall.h> #include <sys/stat.h> -#elif (defined(__amd64) || defined(__amd64__) || defined(__unix__) || defined(__CYGWIN__)) && !defined(__AIX__) +#elif (defined(__amd64) || defined(__amd64__) || defined(__unix__)) && !defined(__AIX__) #define UBSYSTEM_LINUX #include "dirent.h" #include "sys/stat.h" - #include <sys/syscall.h> + //#include <sys/syscall.h> #include <sys/stat.h> #include <unistd.h> #include <string.h> @@ -69,7 +69,12 @@ #error "UbSystem::UnknownMachine" #endif - +#if defined(__unix__) && defined(__CYGWIN__) + #define UBSYSTEM_CYGWIN + #include <windows.h> +#else + #include <sys/syscall.h> +#endif #if defined(min) || defined(max) //daruch kann man sich spaeter #undef min; #undef max erparen # error add NOMINMAX to preprocessor defines @@ -117,10 +122,12 @@ namespace UbSystem /*==========================================================*/ inline void sleepMs(const unsigned int& msec) { - #if defined UBSYSTEM_WINDOWS + #if defined(UBSYSTEM_WINDOWS) ::Sleep( (msec==0) ? 1 : msec ); // +1 here causes a context switch if SleepMSec(0) is called - #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) || defined(UBSYSTEM_AIX) + #elif (defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) || defined(UBSYSTEM_AIX)) && !defined(UBSYSTEM_CYGWIN) ::usleep(1000*msec); + #elif defined(UBSYSTEM_CYGWIN) + ::Sleep( (msec==0) ? 1 : msec ); #else #error "UbSystem::sleepMSec - UnknownMachine" #endif @@ -128,9 +135,9 @@ namespace UbSystem /*==========================================================*/ inline void sleepS(const unsigned int& sec) { - #if defined UBSYSTEM_WINDOWS + #if defined(UBSYSTEM_WINDOWS) && defined(UBSYSTEM_CYGWIN) ::Sleep( (sec==0) ? 1 : sec*1000 ); // +1 here causes a context switch if sleepS(0) is called - #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) || defined(UBSYSTEM_AIX) + #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) || defined(UBSYSTEM_AIX) && !defined(UBSYSTEM_CYGWIN) ::sleep(sec); #else #error "UbSystem::sleepS - UnknownMachine" @@ -255,7 +262,7 @@ namespace UbSystem if( stat(path.c_str(),&stFileInfo) != 0) { return false; - } + } #endif return true; @@ -391,8 +398,10 @@ namespace UbSystem { #if defined UBSYSTEM_WINDOWS return (unsigned long)GetCurrentThreadId(); - #elif defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) + #elif (defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE)) && !defined(UBSYSTEM_CYGWIN) 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 @@ -451,7 +460,7 @@ namespace UbSystem char Name[150]; int i = 0; -#ifdef UBSYSTEM_WINDOWS +#if defined(UBSYSTEM_WINDOWS) && defined(UBSYSTEM_CYGWIN) TCHAR infoBuf[150]; DWORD bufCharCount = 150; memset(Name, 0, 150); @@ -466,7 +475,7 @@ namespace UbSystem { strcpy(Name, "Unknown_Host_Name"); } -#else +#elif (defined(UBSYSTEM_LINUX) || defined(UBSYSTEM_APPLE) || defined(UBSYSTEM_AIX)) && !defined(UBSYSTEM_CYGWIN) memset(Name, 0, 150); gethostname(Name, 150); #endif @@ -542,7 +551,7 @@ namespace UbSystem //Anwendung z.B. zur Ueberpruefung von Funktionalitaeten, wie z.B. bei UbMath::getNegativeInfinity<double>(); // //Grund fuer macro ist einfach, dass es besser anzuwenden ist in der praxis! -//ansonsten würde es so aussehen: +//ansonsten w�rde es so aussehen: // UbSystem::ub_static_assert< aaa == 1 > test(); // da ist UB_STATIC_ASSERT(aaa == 1); schoener // diff --git a/VirtualFluidsCore/Utilities/MemoryUtil.h b/VirtualFluidsCore/Utilities/MemoryUtil.h index 0e67aed02049bde3f8f85b98901f411b2074fd79..5641d5286d64eef254a0447121853dbf51ccc711 100644 --- a/VirtualFluidsCore/Utilities/MemoryUtil.h +++ b/VirtualFluidsCore/Utilities/MemoryUtil.h @@ -46,7 +46,7 @@ #include "stdlib.h" #include "stdio.h" #include "string.h" -#elif (defined(__amd64) || defined(__amd64__) || defined(__unix__) || defined(__CYGWIN__)) && !defined(__AIX__) +#elif (defined(__amd64) || defined(__amd64__) || defined(__unix__)) && !defined(__AIX__) #define MEMORYUTIL_LINUX #include "sys/types.h" #include "sys/sysinfo.h" @@ -56,6 +56,10 @@ #else #error "MemoryUtil::UnknownMachine" #endif + +#if defined(__CYGWIN__) + #define MEMORYUTIL_CYGWIN +#endif ////////////////////////////////////////////////////////////////////////// //MemoryUtil ////////////////////////////////////////////////////////////////////////// @@ -64,7 +68,7 @@ namespace Utilities ////////////////////////////////////////////////////////////////////////// static long long getTotalPhysMem() { - #if defined MEMORYUTIL_WINDOWS + #if defined(MEMORYUTIL_WINDOWS) && !defined(MEMORYUTIL_CYGWIN) MEMORYSTATUSEX memInfo; memInfo.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&memInfo); @@ -75,10 +79,12 @@ namespace Utilities long long totalPhysMem = memInfo.totalram; //Multiply in next statement to avoid int overflow on right hand side... totalPhysMem *= memInfo.mem_unit; - #elif defined(MEMORYUTIL_APPLE) - long long totalPhysMem = 0; + #elif defined(MEMORYUTIL_APPLE) + long long totalPhysMem = 0; + #elif defined(MEMORYUTIL_CYGWIN) + long long totalPhysMem = 0; #else - #error "MemoryUtil::getTotalPhysMem - UnknownMachine" + #error "MemoryUtil::getTotalPhysMem - UnknownMachine" #endif return (long long)totalPhysMem; @@ -86,7 +92,7 @@ namespace Utilities ////////////////////////////////////////////////////////////////////////// static long long getPhysMemUsed() { - #if defined MEMORYUTIL_WINDOWS + #if defined(MEMORYUTIL_WINDOWS) && !defined(MEMORYUTIL_CYGWIN) MEMORYSTATUSEX memInfo; memInfo.dwLength = sizeof(MEMORYSTATUSEX); GlobalMemoryStatusEx(&memInfo); @@ -97,16 +103,18 @@ namespace Utilities long long physMemUsed = memInfo.totalram - memInfo.freeram; //Multiply in next statement to avoid int overflow on right hand side... physMemUsed *= memInfo.mem_unit; - #elif defined(MEMORYUTIL_APPLE) + #elif defined(MEMORYUTIL_APPLE) + long long physMemUsed = 0; + #elif defined(MEMORYUTIL_CYGWIN) long long physMemUsed = 0; #else - #error "MemoryUtil::getPhysMemUsed - UnknownMachine" + #error "MemoryUtil::getPhysMemUsed - UnknownMachine" #endif return (long long)physMemUsed; } ////////////////////////////////////////////////////////////////////////// -#if defined(MEMORYUTIL_LINUX) || defined(MEMORYUTIL_APPLE) +#if defined(MEMORYUTIL_LINUX) || defined(MEMORYUTIL_APPLE) || defined(MEMORYUTIL_CYGWIN) static int parseLine(char* line){ int i = strlen(line); while (*line < '0' || *line > '9') line++; @@ -134,12 +142,14 @@ namespace Utilities ////////////////////////////////////////////////////////////////////////// static long long getPhysMemUsedByMe() { - #if defined MEMORYUTIL_WINDOWS + #if defined(MEMORYUTIL_WINDOWS) && !defined(__CYGWIN__) PROCESS_MEMORY_COUNTERS pmc; GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)); SIZE_T physMemUsedByMe = pmc.WorkingSetSize; #elif defined(MEMORYUTIL_LINUX) || defined(MEMORYUTIL_APPLE) long long physMemUsedByMe = (long long)getValue() * (long long)1024; + #elif defined(MEMORYUTIL_CYGWIN) + long long physMemUsedByMe = (long long)getValue() * (long long)1024; #else #error "MemoryUtil::getPhysMemUsedByMe - UnknownMachine" #endif