diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 372c04ae40069c25b5a0c960fb5ea37ebeb7c0e1..2c0b8503c17b9612dfe436ac2073d83fcc7f2695 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -26,6 +26,7 @@ stages: - $BUILD_FOLDER artifacts: + expire_in: 1 hrs paths: - $BUILD_FOLDER @@ -42,6 +43,7 @@ stages: - cd $CI_PROJECT_DIR/$BUILD_FOLDER - cmake .. --preset=all_make + -DBUILD_WARNINGS_AS_ERRORS=ON -DCMAKE_CUDA_ARCHITECTURES=60 - cmake . -LAH - make -j4 @@ -84,6 +86,7 @@ gcc_9_rebuild: - rm -r -f ./* - cmake .. --preset=all_make_ccache + -DBUILD_WARNINGS_AS_ERRORS=ON -DCMAKE_CUDA_ARCHITECTURES=60 - make -j4 2>&1 | tee gcc_warnings.txt - ccache -s @@ -97,38 +100,6 @@ gcc_9_rebuild: paths: - $CI_PROJECT_DIR/cache - -############################################################################### -gcc_9_warning_like_errors: - stage: build - - image: irmb/virtualfluids-deps-ubuntu20.04 - - tags: - - gpu - - linux - - before_script: - - export CCACHE_BASEDIR=$CI_PROJECT_DIR - - export CCACHE_DIR=$CI_PROJECT_DIR/cache - - ccache -s - - script: - - mkdir -p $CI_PROJECT_DIR/build - - cd $CI_PROJECT_DIR/build - - rm -r -f ./* - - cmake .. - --preset=all_make_ccache - -DCMAKE_CUDA_ARCHITECTURES=60 - -DBUILD_WARNINGS_AS_ERRORS=ON - - make -j4 - - ccache -s - - cache: - key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" - paths: - - $CI_PROJECT_DIR/cache - ############################################################################### msvc_16: stage: build @@ -154,7 +125,7 @@ msvc_16: - cd $CI_PROJECT_DIR - md -force $env:BUILD_FOLDER - cd $env:BUILD_FOLDER - - cmake .. --preset=all_msvc + - cmake .. --preset=all_msvc -DBUILD_WARNINGS_AS_ERRORS=ON - MSBuild.exe VirtualFluids.sln /property:Configuration=$env:BUILD_CONFIGURATION /verbosity:minimal /maxcpucount:4 cache: @@ -163,6 +134,7 @@ msvc_16: - $CI_PROJECT_DIR/$env:BUILD_FOLDER/ artifacts: + expire_in: 1 hrs paths: - $CI_PROJECT_DIR/$env:BUILD_FOLDER/ diff --git a/CMake/compilerflags/MSVC.cmake b/CMake/compilerflags/MSVC.cmake index 2af38d98e63cf04c4da476fb02754ce47510e4f6..3cde5bee9e17668fe24e57f84a39308f9a0ada18 100644 --- a/CMake/compilerflags/MSVC.cmake +++ b/CMake/compilerflags/MSVC.cmake @@ -8,7 +8,7 @@ list(APPEND CS_COMPILER_FLAGS_CXX "-MP") # enable multi-threaded compiling ############################################################################################################# # warnings ############################################################################################################# -list(APPEND CS_COMPILER_FLAGS_CXX "/W4") # highest warning level +list(APPEND CS_COMPILER_FLAGS_CXX "/W3") # highest warning level # With W4 the following warnings appear many times. As long they are not eliminated they are suppressed: list(APPEND CS_COMPILER_FLAGS_CXX "/wd4458") # C4458: declaration of 'XXX' hides class member @@ -25,6 +25,18 @@ list(APPEND CS_COMPILER_FLAGS_CXX "/wd4701") # C4701: potentially uninitialized list(APPEND CS_COMPILER_FLAGS_CXX "/wd4251") # disable needs to have dll interface list(APPEND CS_COMPILER_FLAGS_CXX "/wd4005") # disable macro redefinition (triggered by metis.h) + +list(APPEND CS_COMPILER_FLAGS_CXX "/wd26812") # disable the enum type is unscoped +list(APPEND CS_COMPILER_FLAGS_CXX "/wd4100") # unreferenced formal parameter +list(APPEND CS_COMPILER_FLAGS_CXX "/wd4324") # structure was padded +list(APPEND CS_COMPILER_FLAGS_CXX "/wd4201") # nonstandard extension used : nameless struct/union + + +if(BUILD_WARNINGS_AS_ERRORS) + list(APPEND CS_COMPILER_FLAGS_CXX "/WX") +endif() + + ############################################################################################################# # preprocessor definitions ############################################################################################################# diff --git a/CMakeLists.txt b/CMakeLists.txt index efce16caaf8d40ae3f5a9ca9bcedd5c5a6767bf5..5c67ec6b6359adfc7deb938d272309c6cdd783be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,9 +103,18 @@ if(BUILD_VF_GPU) message(FATAL_ERROR "CUDA Compiler was requested but is not found on the system.") endif() - set(CMAKE_CUDA_STANDARD 11) + if(MSVC) + # With the MSVC compiler we got this warning: nvcc : The -std=c++14 flag is not supported with the configured host compiler. Flag will be ignored. + # But we build the c++ code with C++14. Until we have not a solution here, we set the standard to 11 here. + set(CMAKE_CUDA_STANDARD 11) + else() + set(CMAKE_CUDA_STANDARD 14) + endif() + set(CMAKE_CUDA_STANDARD_REQUIRED TRUE) + set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcudafe --display_error_number") + if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES) message(WARNING "CMAKE_CUDA_ARCHITECTURES was not defined and is set to 30 (CUDA support until 10.1 only).") set(CMAKE_CUDA_ARCHITECTURES 30) diff --git a/apps/gpu/LidDrivenCavityGPU/LidDrivenCavity.cpp b/apps/gpu/LidDrivenCavityGPU/LidDrivenCavity.cpp index 4d2fdc51e94df73cbde1ec92e220e8b5ee5b2943..86b6f5f4a1176de85e689d6573a34667e0c74d47 100644 --- a/apps/gpu/LidDrivenCavityGPU/LidDrivenCavity.cpp +++ b/apps/gpu/LidDrivenCavityGPU/LidDrivenCavity.cpp @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) const real L = 1.0; const real Re = 1000.0; const real velocity = 1.0; - const real dt = 0.5e-3; + const real dt = (real)0.5e-3; const uint nx = 64; const uint timeStepOut = 10000; @@ -222,7 +222,7 @@ int main(int argc, char *argv[]) parameters.K = 2.0; parameters.Pr = 1.0; - const real Ma = 0.1; + const real Ma = (real)0.1; real rho = 1.0; diff --git a/src/basics/basics/utilities/UbKeys.h b/src/basics/basics/utilities/UbKeys.h index 60dfbf56bffcf0569a85ded55a276e489deba322..56fb8839d0aa715a30972dfe15b17e7340de0a14 100644 --- a/src/basics/basics/utilities/UbKeys.h +++ b/src/basics/basics/utilities/UbKeys.h @@ -135,6 +135,8 @@ public: T1 getT1() const { return t1; } T2 getT2() const { return t2; } T3 getT3() const { return t3; } + + Key3(const Key3& other) : t1(other.t1), t2(other.t2), t3(other.t3) {} /*==========================================================*/ Key3 &operator=(const Key3 &srcKey) { diff --git a/src/basics/basics/utilities/UbLogger.h b/src/basics/basics/utilities/UbLogger.h index fc2b118715a0f4afc0251b8ed8e2373a7d488153..c0eb6bf243d52b6ed54a6b4f6cb7ac34ff24da64 100644 --- a/src/basics/basics/utilities/UbLogger.h +++ b/src/basics/basics/utilities/UbLogger.h @@ -217,8 +217,8 @@ inline std::string UbLogger<OutputPolicy>::logTimeString() } char result[100] = { 0 }; - static DWORD first = GetTickCount(); - std::sprintf(result, "%s.%03ld", buffer, (long)(GetTickCount() - first) % 1000); + static DWORD first = GetTickCount64(); + std::sprintf(result, "%s.%03ld", buffer, (long)(GetTickCount64() - first) % 1000); return result; } #else diff --git a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp index c424a6376a62159da2e4b9f73ccf01858fbde521..6cfdb7bf66c821d667d340433d589fd4ed162d61 100644 --- a/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp +++ b/src/cpu/VirtualFluidsCore/Visitors/InitDistributionsBlockVisitor.cpp @@ -178,7 +178,7 @@ void InitDistributionsBlockVisitor::visit(const SPtr<Grid3D> grid, SPtr<Block3D> for (size_t ix3 = 0; ix3 < bcArray->getNX3(); ix3++) for (size_t ix2 = 0; ix2 < bcArray->getNX2(); ix2++) for (size_t ix1 = 0; ix1 < bcArray->getNX1(); ix1++) { - Vector3D coords = grid->getNodeCoordinates(block, ix1, ix2, ix3); + Vector3D coords = grid->getNodeCoordinates(block, (int)ix1, (int)ix2, (int)ix3); x1 = coords[0]; x2 = coords[1]; x3 = coords[2]; diff --git a/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.cpp b/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.cpp index 72686be2e4a14e60613f7437595b12ef42772a18..781ba46d26df995446312199a805f6c8d499998e 100644 --- a/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.cpp +++ b/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.cpp @@ -136,7 +136,7 @@ void BoundaryCondition::findBoundaryCells(GksMeshAdapter & adapter, bool allowGh + numberOfCellsPerLevel[ level - 1 ]; } - this->numberOfCells = ghostCells.size(); + this->numberOfCells = (uint)ghostCells.size(); this->myAllocator->allocateMemory( shared_from_this(), ghostCells, domainCells, secondCells ); } diff --git a/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.h b/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.h index cb6c60d36e7911dccf928d89a17fbd86c6db2c86..c302aa002200f14f5fb1e61aabdfc8da995dcb64 100644 --- a/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.h +++ b/src/gpu/GksGpu/BoundaryConditions/BoundaryCondition.h @@ -78,7 +78,7 @@ struct GKSGPU_EXPORT BoundaryCondition : virtual public BoundaryConditionStruct, BoundaryCondition( SPtr<DataBase> dataBase ); //! destructor that initiates memory deallocation - ~BoundaryCondition(); + virtual ~BoundaryCondition(); //! \brief searches for boundary cells and allocates memory //! \param adapter reference to a <b>GksMeshAdapter</b>, in which the boundary cells are searched diff --git a/src/gpu/GksGpu/CudaUtility/CudaRunKernel.hpp b/src/gpu/GksGpu/CudaUtility/CudaRunKernel.hpp index c312098c0e10e1dbe317aa2df9082477976ccebb..7bbce4245c01c547eab04fc2f43a5ce20e8de2c8 100644 --- a/src/gpu/GksGpu/CudaUtility/CudaRunKernel.hpp +++ b/src/gpu/GksGpu/CudaUtility/CudaRunKernel.hpp @@ -51,7 +51,7 @@ void runKernel(KernelFunctor kernel, FunctionFunctor function, std::string devic else { #pragma omp parallel for - for( int index = 0; index < grid.numberOfEntities; index++ ) + for( int index = 0; index < (int)grid.numberOfEntities; index++ ) { function( args..., index ); } diff --git a/src/gpu/GksGpu/DataBase/DataBase.cpp b/src/gpu/GksGpu/DataBase/DataBase.cpp index 845f5d0effeb3c1b9f88020bf208de1e5f2393a6..a7319f049345bd6da76eeff29b347b0e45edcbf1 100644 --- a/src/gpu/GksGpu/DataBase/DataBase.cpp +++ b/src/gpu/GksGpu/DataBase/DataBase.cpp @@ -70,13 +70,13 @@ DataBase::~DataBase() void DataBase::setMesh(GksMeshAdapter & adapter) { - this->numberOfNodes = adapter.nodes.size(); + this->numberOfNodes = (uint)adapter.nodes.size(); - this->numberOfCells = adapter.cells.size(); + this->numberOfCells = (uint)adapter.cells.size(); - this->numberOfFaces = adapter.faces.size(); + this->numberOfFaces = (uint)adapter.faces.size(); - this->numberOfLevels = adapter.numberOfLevels; + this->numberOfLevels = (uint)adapter.numberOfLevels; this->perLevelCount.resize( this->numberOfLevels ); diff --git a/src/gpu/GksGpu/DataBase/DataBaseAllocator.h b/src/gpu/GksGpu/DataBase/DataBaseAllocator.h index 28b7266e9332826ea01ff0a2b75938adbab11676..dd6eb544a86b1841637540eac5b9c1729dc1f672 100644 --- a/src/gpu/GksGpu/DataBase/DataBaseAllocator.h +++ b/src/gpu/GksGpu/DataBase/DataBaseAllocator.h @@ -85,7 +85,7 @@ public: ////////////////////////////////////////////////////////////////////////// - ~DataBaseAllocator(); + virtual ~DataBaseAllocator(); // \return the device type as string virtual std::string getDeviceType() = 0; diff --git a/src/gpu/GksGpu/DataBase/DataBaseAllocatorCPU.h b/src/gpu/GksGpu/DataBase/DataBaseAllocatorCPU.h index 988cb419eeed156d7562039f353360f9c097af8c..b42bcdd49a58ca5c1c351f04e773fe190b123362 100644 --- a/src/gpu/GksGpu/DataBase/DataBaseAllocatorCPU.h +++ b/src/gpu/GksGpu/DataBase/DataBaseAllocatorCPU.h @@ -31,7 +31,7 @@ //! \author Stephan Lenz //======================================================================================= #ifndef DataBaseAllocatorCPU_H -#define DatabaseAllocatorCPU_H +#define DataBaseAllocatorCPU_H #include "Core/DataTypes.h" #include "PointerDefinitions.h" diff --git a/src/gpu/GksGpu/DataBase/DataBaseAllocatorGPU.h b/src/gpu/GksGpu/DataBase/DataBaseAllocatorGPU.h index 2f2504c2a73c0b27ed0213998636bd6b030b0cff..31f8117a0e091d01566732472bf8a2d70837e856 100644 --- a/src/gpu/GksGpu/DataBase/DataBaseAllocatorGPU.h +++ b/src/gpu/GksGpu/DataBase/DataBaseAllocatorGPU.h @@ -31,7 +31,7 @@ //! \author Stephan Lenz //======================================================================================= #ifndef DataBaseAllocatorGPU_H -#define DatabaseAllocatorGPU_H +#define DataBaseAllocatorGPU_H #include "Core/DataTypes.h" #include "PointerDefinitions.h" diff --git a/src/gpu/GksGpu/FluxComputation/FluxComputation.cu b/src/gpu/GksGpu/FluxComputation/FluxComputation.cu index b013bdfcee464e836aca5250be2dd2ae1bd07d62..2b31ba60abc51df2ce751227997761228807e15a 100644 --- a/src/gpu/GksGpu/FluxComputation/FluxComputation.cu +++ b/src/gpu/GksGpu/FluxComputation/FluxComputation.cu @@ -168,7 +168,9 @@ __host__ __device__ inline void fluxFunction(DataBaseStruct dataBase, Parameters real az[LENGTH_CELL_DATA]; real at[LENGTH_CELL_DATA]; +#ifndef _MSC_VER #pragma unroll +#endif for( uint i = 0; i < LENGTH_CELL_DATA; i++ ) { ax[i] = c0o1; diff --git a/src/gpu/GksGpu/FluxComputation/Moments.cuh b/src/gpu/GksGpu/FluxComputation/Moments.cuh index 058ddf5494dc2de8f43eca0d553a0611bffcbb77..b0d91ed72bc8f58311434b9512d121548155a0b2 100644 --- a/src/gpu/GksGpu/FluxComputation/Moments.cuh +++ b/src/gpu/GksGpu/FluxComputation/Moments.cuh @@ -67,19 +67,25 @@ __host__ __device__ inline void computeMoments( const PrimitiveVariables & faceP { momentU[0] = c1o1; momentU[1] = facePrim.U; +#ifndef _MSC_VER #pragma unroll +#endif for ( uint i = 2; i < NUMBER_OF_MOMENTS; i++ ) momentU[i] = facePrim.U * momentU[i - 1] + ( real(i - 1) * momentU[i - 2] )/( c2o1 * facePrim.lambda ); momentV[0] = c1o1; momentV[1] = facePrim.V; +#ifndef _MSC_VER #pragma unroll +#endif for ( uint i = 2; i < NUMBER_OF_MOMENTS; i++ ) momentV[i] = facePrim.V * momentV[i - 1] + ( real(i - 1) * momentV[i - 2] )/( c2o1 * facePrim.lambda ); momentW[0] = c1o1; momentW[1] = facePrim.W; +#ifndef _MSC_VER #pragma unroll +#endif for ( uint i = 2; i < NUMBER_OF_MOMENTS; i++ ) momentW[i] = facePrim.W * momentW[i - 1] + ( real(i - 1) * momentW[i - 2] )/( c2o1 * facePrim.lambda ); diff --git a/src/gpu/GksMeshAdapter/CMakeLists.txt b/src/gpu/GksMeshAdapter/CMakeLists.txt index cb00b3c016786c41ef5640eb362322bb0a3768f8..c413a797f18113b34b81e0efdac4724c9f2b4001 100644 --- a/src/gpu/GksMeshAdapter/CMakeLists.txt +++ b/src/gpu/GksMeshAdapter/CMakeLists.txt @@ -1,3 +1,7 @@ project(GksMeshAdapter LANGUAGES CUDA CXX) vf_add_library(PRIVATE_LINK basics GridGenerator) + +if(NOT MSVC) + target_compile_options(GksMeshAdapter PRIVATE "-Wno-unused-lambda-capture") +endif() \ No newline at end of file diff --git a/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp b/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp index a3dc8d8bd47f0497a6b7d233a10ceebb8ab7ce82..fcff658b3662bf5ce55bdc42c0a8d07e8e7c872d 100644 --- a/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp +++ b/src/gpu/GksMeshAdapter/GksMeshAdapter.cpp @@ -295,7 +295,7 @@ void GksMeshAdapter::generateNodes() real d = 0.5 * grids[cell.level]->getDelta(); - std::array<Vec3,8> dir; + //std::array<Vec3,8> dir; for( uint idx = 0; idx < 8; idx++ ) { @@ -308,7 +308,7 @@ void GksMeshAdapter::generateNodes() nodes.push_back( Vec3( x + dx, y + dy, z + dz ) ); - cell.cellToNode[idx] = nodes.size()-1; + cell.cellToNode[idx] = (uint)nodes.size() - 1; //// register new node at neighbor cells on same level for (uint idx = 0; idx < 8; idx++) @@ -329,7 +329,7 @@ void GksMeshAdapter::generateNodes() if ( neighborIdx != INVALID_INDEX ) { - this->cells[ neighborIdx ].cellToNode[idx] = nodes.size() - 1; + this->cells[neighborIdx].cellToNode[idx] = (uint)nodes.size() - 1; } } } diff --git a/src/gpu/GridGenerator/CMakeLists.txt b/src/gpu/GridGenerator/CMakeLists.txt index 1ce294bf420f657f35397c427929f9f310d04556..516e560470464c748f8fb605a7733f54661fa768 100644 --- a/src/gpu/GridGenerator/CMakeLists.txt +++ b/src/gpu/GridGenerator/CMakeLists.txt @@ -10,4 +10,21 @@ set_target_properties(${library_name} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) # https://stackoverflow.com/questions/50033435/cmake-cuda-separate-compilation-static-lib-link-error-on-windows-but-not-on-ubun if (NOT BUILD_SHARED_LIBRARY) set_target_properties(${library_name} PROPERTIES CUDA_RESOLVE_DEVICE_SYMBOLS ON) -endif() \ No newline at end of file +endif() + +# suppress warning 3123, 3126: calling a __host__ function from __host__ __device__ is not allowed +# suppress warning 3152: __host__ function redeclared with __host__ __device__, hence treated as a __host__ __device__ function +# suppress warning 3125, 3127: calling a constexpr __host__ function from a __host__ __device__ function +set(cuda_warnings_suppressions "--diag_suppress=3123 --diag_suppress=3126 --diag_suppress=3152 --diag_suppress=3125 --diag_suppress=3127") + +# suppress warning 3311: unrecognized #pragma in device code +if(NOT MSVC) + set(cuda_warnings_suppressions "${cuda_warnings_suppressions} --diag_suppress=3311") +endif() + +# suppress warning 2979: calling a __host__ function from __host__ __device__ is not allowed +if(MSVC) + set(cuda_warnings_suppressions "${cuda_warnings_suppressions} --diag_suppress=2979 --diag_suppress=2976 --diag_suppress=3005 --diag_suppress=2978 --diag_suppress=3009") +endif() + +target_compile_options(${library_name} PUBLIC $<$<COMPILE_LANGUAGE:CUDA>:-Xcudafe ${cuda_warnings_suppressions} >) diff --git a/src/gpu/GridGenerator/geometries/Cuboid/Cuboid.cu b/src/gpu/GridGenerator/geometries/Cuboid/Cuboid.cu index c670440570437de36cee794cb41e654a4e379420..7636c2bafd03be5bd18cb7dcd8546fbd09b42c96 100644 --- a/src/gpu/GridGenerator/geometries/Cuboid/Cuboid.cu +++ b/src/gpu/GridGenerator/geometries/Cuboid/Cuboid.cu @@ -113,12 +113,18 @@ double Cuboid::getMaximum(double x1, double x2) bool Cuboid::isPointInObject(const double& x1, const double& x2, const double& x3, const double& minOffset, const double& maxOffset) { //false, if 'not in Object' or 'on Boundary'! - if (vf::Math::lessEqual(x1, this->getX1Minimum() + minOffset)) return false; - if (vf::Math::lessEqual(x2, this->getX2Minimum() + minOffset)) return false; - if (vf::Math::lessEqual(x3, this->getX3Minimum() + minOffset)) return false; - if (vf::Math::greaterEqual(x1, this->getX1Maximum() - maxOffset)) return false; - if (vf::Math::greaterEqual(x2, this->getX2Maximum() - maxOffset)) return false; - if (vf::Math::greaterEqual(x3, this->getX3Maximum() - maxOffset)) return false; + if (vf::Math::lessEqual((real)x1, (real)this->getX1Minimum() + (real)minOffset)) + return false; + if (vf::Math::lessEqual((real)x2, (real)this->getX2Minimum() + (real)minOffset)) + return false; + if (vf::Math::lessEqual((real)x3, (real)this->getX3Minimum() + (real)minOffset)) + return false; + if (vf::Math::greaterEqual((real)x1, (real)this->getX1Maximum() - (real)maxOffset)) + return false; + if (vf::Math::greaterEqual((real)x2, (real)this->getX2Maximum() - (real)maxOffset)) + return false; + if (vf::Math::greaterEqual((real)x3, (real)this->getX3Maximum() - (real)maxOffset)) + return false; return true; } diff --git a/src/gpu/GridGenerator/geometries/Vertex/Vertex.cu b/src/gpu/GridGenerator/geometries/Vertex/Vertex.cu index 2392ef38a2e3a9e3a41b47cd90a81a13e028c909..23d49efa9d350a3a56ff754f33c0a7eb2351a974 100644 --- a/src/gpu/GridGenerator/geometries/Vertex/Vertex.cu +++ b/src/gpu/GridGenerator/geometries/Vertex/Vertex.cu @@ -65,8 +65,8 @@ Vertex Vertex::operator*(const real& value) const } Vertex Vertex::operator/(const real& value) const -{ - return *this * (1.0 / value); +{ + return *this * ((real)1.0 / value); } real Vertex::operator*(const Vertex &w) const diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h b/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h index 6d7ae50da444069769daafb3d36f1c0f3093aafc..7626a9492703f4796527e621dfa1deed2424b58b 100644 --- a/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h +++ b/src/gpu/GridGenerator/grid/BoundaryConditions/BoundaryCondition.h @@ -50,6 +50,8 @@ namespace gg class BoundaryCondition { public: + virtual ~BoundaryCondition() = default; + std::vector<uint> indices; SPtr<Side> side; std::vector<std::vector<real>> qs; diff --git a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h index d8bd6134448c3324fec5fef51db8db85c9a0d84e..260bc18967296e63cc21fc0454c86cdcb65e8719 100644 --- a/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h +++ b/src/gpu/GridGenerator/grid/BoundaryConditions/Side.h @@ -64,6 +64,7 @@ enum class SideType class Side { public: + virtual ~Side() = default; virtual void addIndices(std::vector<SPtr<Grid> > grid, uint level, SPtr<gg::BoundaryCondition> boundaryCondition) = 0; virtual int getCoordinate() const = 0; diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp index 3b9f91d9ef6e4e2564ff07b24d35630b804d5fa3..552c2578585b86fadf98ea0b8505b81fbd7475ff 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp +++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.cpp @@ -47,8 +47,9 @@ #define GEOFLUID 19 #define GEOSOLID 16 -LevelGridBuilder::LevelGridBuilder(Device device, const std::string& d3qxx) : device(device), d3qxx(d3qxx) +LevelGridBuilder::LevelGridBuilder(Device device, const std::string& d3qxx) : d3qxx(d3qxx) { + (void)device; } std::shared_ptr<LevelGridBuilder> LevelGridBuilder::makeShared(Device device, const std::string& d3qxx) @@ -95,7 +96,7 @@ void LevelGridBuilder::setNoSlipBoundaryCondition(SideType sideType) LevelGridBuilder::~LevelGridBuilder() { - for (const auto grid : grids) + for (const auto& grid : grids) grid->freeMemory(); } @@ -109,7 +110,7 @@ void LevelGridBuilder::getGridInformations(std::vector<int>& gridX, std::vector< std::vector<int>& gridZ, std::vector<int>& distX, std::vector<int>& distY, std::vector<int>& distZ) { - for (const auto grid : grids) + for (const auto &grid : grids) { gridX.push_back(int(grid->getNumberOfNodesX())); gridY.push_back(int(grid->getNumberOfNodesY())); @@ -203,9 +204,9 @@ void LevelGridBuilder::getVelocityValues(real* vx, real* vy, real* vz, int* indi { indices[allIndicesCounter] = grids[level]->getSparseIndex(boundaryCondition->indices[i]) +1; - vx[allIndicesCounter] = boundaryCondition->getVx(i); - vy[allIndicesCounter] = boundaryCondition->getVy(i); - vz[allIndicesCounter] = boundaryCondition->getVz(i); + vx[allIndicesCounter] = boundaryCondition->getVx((uint)i); + vy[allIndicesCounter] = boundaryCondition->getVy((uint)i); + vz[allIndicesCounter] = boundaryCondition->getVz((uint)i); allIndicesCounter++; } } diff --git a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h index 100dedede48d962174b852b88ede465777bc25c2..44af40b0a1d2e7575663d202788c7e760b83fe9e 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h +++ b/src/gpu/GridGenerator/grid/GridBuilder/LevelGridBuilder.h @@ -74,18 +74,18 @@ public: GRIDGENERATOR_EXPORT virtual std::shared_ptr<Grid> getGrid(int level, int box); - GRIDGENERATOR_EXPORT virtual unsigned int getNumberOfNodes(unsigned int level) const; + GRIDGENERATOR_EXPORT virtual unsigned int getNumberOfNodes(unsigned int level) const override; GRIDGENERATOR_EXPORT virtual void getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, uint *geo, const int level) const override; - GRIDGENERATOR_EXPORT virtual void getDimensions(int &nx, int &ny, int &nz, const int level) const; + GRIDGENERATOR_EXPORT virtual void getDimensions(int &nx, int &ny, int &nz, const int level) const override; - GRIDGENERATOR_EXPORT uint getVelocitySize(int level) const; - GRIDGENERATOR_EXPORT virtual void getVelocityValues(real* vx, real* vy, real* vz, int* indices, int level) const; - GRIDGENERATOR_EXPORT virtual void getVelocityQs(real* qs[27], int level) const; + GRIDGENERATOR_EXPORT uint getVelocitySize(int level) const override; + GRIDGENERATOR_EXPORT virtual void getVelocityValues(real* vx, real* vy, real* vz, int* indices, int level) const override; + GRIDGENERATOR_EXPORT virtual void getVelocityQs(real* qs[27], int level) const override; GRIDGENERATOR_EXPORT SPtr<gg::BoundaryCondition> getBoundaryCondition( SideType side, uint level ) const override; @@ -108,7 +108,6 @@ protected: void checkLevel(int level); private: - Device device; std::string d3qxx; public: diff --git a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp index 7d23df12d217ef1847029e6ef52dbd68e046bd6d..f3fdaa25d1eca3c60f0bd6c477b0a3984089b46f 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp +++ b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.cpp @@ -47,7 +47,7 @@ #include "grid/GridFactory.h" MultipleGridBuilder::MultipleGridBuilder(SPtr<GridFactory> gridFactory, Device device, const std::string &d3qxx) : - LevelGridBuilder(device, d3qxx), gridFactory(gridFactory), solidObject(nullptr), numberOfLayersFine(12), numberOfLayersBetweenLevels(8), subDomainBox(nullptr) + LevelGridBuilder(device, d3qxx), gridFactory(gridFactory), numberOfLayersFine(12), numberOfLayersBetweenLevels(8), subDomainBox(nullptr) { } diff --git a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h index e5c280bdc3519440c92766fd60bbb12d23d9a360..df13fa31f14d88546df08e9b68549b82bed42bf3 100644 --- a/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h +++ b/src/gpu/GridGenerator/grid/GridBuilder/MultipleGridBuilder.h @@ -81,7 +81,6 @@ private: SPtr<GridFactory> gridFactory; - Object* solidObject; uint numberOfLayersFine; uint numberOfLayersBetweenLevels; diff --git a/src/gpu/GridGenerator/grid/GridImp.cu b/src/gpu/GridGenerator/grid/GridImp.cu index ceb00315df89cb8e438705142f4f099adf0c2e0c..2684893e37a7336ee00ff75d52a9821727c6be4a 100644 --- a/src/gpu/GridGenerator/grid/GridImp.cu +++ b/src/gpu/GridGenerator/grid/GridImp.cu @@ -474,9 +474,9 @@ void GridImp::transIndexToCoords(uint index, real &x, real &y, real &z) const if (index == INVALID_INDEX) printf("Function: transIndexToCoords. GridImp Index: %d, size: %d. Exit Program!\n", index, size); - x = index % nx; - y = (index / nx) % ny; - z = ((index / nx) / ny) % nz; + x = (real)(index % nx); + y = (real)((index / nx) % ny); + z = (real)(((index / nx) / ny) % nz); x = (x * delta) + startX; y = (y * delta) + startY; diff --git a/src/gpu/GridGenerator/grid/GridImp.h b/src/gpu/GridGenerator/grid/GridImp.h index e9e7c203591a6320d8adfa667cf9cf292d976bf9..c81aa67b42852cc2fc974513c01e9fbc0d87343c 100644 --- a/src/gpu/GridGenerator/grid/GridImp.h +++ b/src/gpu/GridGenerator/grid/GridImp.h @@ -180,12 +180,12 @@ public: public: - virtual void findSparseIndices(SPtr<Grid> fineGrid); + virtual void findSparseIndices(SPtr<Grid> fineGrid) override; void updateSparseIndices(); void setNeighborIndices(uint index); - real getFirstFluidNode(real coords[3], int direction, real startCoord) const; - real getLastFluidNode(real coords[3], int direction, real startCoord) const; + real getFirstFluidNode(real coords[3], int direction, real startCoord) const override; + real getLastFluidNode(real coords[3], int direction, real startCoord) const override; private: void setStopperNeighborCoords(uint index); void getNeighborCoords(real &neighborX, real &neighborY, real &neighborZ, real x, real y, real z) const; diff --git a/src/gpu/GridGenerator/grid/distributions/Distribution.cpp b/src/gpu/GridGenerator/grid/distributions/Distribution.cpp index 0aa7e40577172a9e0988f610a822729a34b71b8e..b0200812631aeff1947a56f78cae4232bd4d3ee7 100644 --- a/src/gpu/GridGenerator/grid/distributions/Distribution.cpp +++ b/src/gpu/GridGenerator/grid/distributions/Distribution.cpp @@ -263,7 +263,7 @@ std::vector<std::vector<real> > DistributionHelper::getVectorWithoutRowsWithOnly void DistributionHelper::printQs(std::vector<std::vector<real> > qs, int decimalPlaces) { for (std::size_t node = 0; node < qs.size(); node++) { - printf("index %lu: ", node); + printf("index %zu: ", node); for (std::size_t dir = 1; dir < qs[node].size(); dir++) { printf("%d ", (int)qs[node][0]); printf("%.*f ", decimalPlaces, qs[node][dir]);