diff --git a/CMake/3rd/mpi.cmake b/CMake/3rd/mpi.cmake index 9cfe89dc91b93a453f845f825bb2cacf9474ab76..a3c8826b6fe31f19c7d3d5e42c691796f395b49d 100644 --- a/CMake/3rd/mpi.cmake +++ b/CMake/3rd/mpi.cmake @@ -1,9 +1,10 @@ - vf_get_library_name(library_name) + find_package(MPI REQUIRED) -target_include_directories(${library_name} PRIVATE ${MPI_C_INCLUDE_PATH}) +target_include_directories(${library_name} PUBLIC ${MPI_CXX_INCLUDE_PATH}) -target_link_libraries(${library_name} PRIVATE ${MPI_C_LIBRARIES}) +#target_link_libraries(${library_name} PUBLIC ${MPI_CXX_LIBRARIES}) +target_link_libraries(${library_name} PRIVATE MPI::MPI_CXX) diff --git a/CMake/VirtualFluidsMacros.cmake b/CMake/VirtualFluidsMacros.cmake index 0a0389b40fdcd22250bc27de6ddeeb9c81a7c9b8..31c2ba3dec4b6824b02ef28c7ae7f25ac979301b 100644 --- a/CMake/VirtualFluidsMacros.cmake +++ b/CMake/VirtualFluidsMacros.cmake @@ -133,7 +133,7 @@ function(vf_add_library) ADD_COMPILER_FLAGS_TO_PROJECT(${CAB_COMPILER} ${library_name} "CXX" ${ARG_BUILDTYPE}) MESSAGE(STATUS "compiler flags for compiler ${CAB_COMPILER} on machine ${CAB_MACHINE} for project ${project_name} (${ARG_BUILDTYPE}) have been configured") - MESSAGE (COMPILE FLAGS: ${CAB_ADDTIONAL_COMPILER_FLAGS}) + #MESSAGE (COMPILE FLAGS: ${CAB_ADDTIONAL_COMPILER_FLAGS}) IF(CAB_ADDTIONAL_COMPILER_FLAGS) ADD_TARGET_PROPERTIES(${library_name} COMPILE_FLAGS ${CAB_ADDTIONAL_COMPILER_FLAGS}) ENDIF() diff --git a/CMake/compilerflags/clang.cmake b/CMake/compilerflags/clang.cmake index 98e13390792e78d65657c9660a1d75f238e62307..af6fd3b16255a64dd12bd3c5fd27a40e2f12c2f5 100644 --- a/CMake/compilerflags/clang.cmake +++ b/CMake/compilerflags/clang.cmake @@ -8,9 +8,9 @@ MACRO(SET_COMPILER_SPECIFIC_FLAGS_INTERN build_type use64BitOptions) ############################################################################################################# # Flags ############################################################################################################# - LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O3 -fomit-frame-pointer -finline-functions -fPIC -Wbackslash-newline-escape") + LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-O3;-fomit-frame-pointer;-finline-functions;-fPIC;-Wbackslash-newline-escape") - LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-O3 -fomit-frame-pointer -finline-functions -fPIC") + LIST(APPEND CAB_COMPILER_ADDTIONAL_C_COMPILER_FLAGS "-O3;-fomit-frame-pointer;-finline-functions;-fPIC") ############################################################################################################# # 64Bit support diff --git a/gpu.cmake b/gpu.cmake index 4dfb23e8db19f0f8487e960e351ebc44a956290a..7bbd0186b27ca174e08862d91439b23b245a564a 100644 --- a/gpu.cmake +++ b/gpu.cmake @@ -142,7 +142,7 @@ IF (VF.BUILD_VF_GPU) #add_subdirectory(targets/apps/LBM/BaselNU) #add_subdirectory(targets/apps/LBM/BaselMultiGPU) - #add_subdirectory(targets/apps/LBM/DrivenCavity) + add_subdirectory(gpu/targets/apps/LBM/DrivenCavity) #add_subdirectory(targets/apps/LBM/gridGeneratorTest) #add_subdirectory(targets/apps/LBM/TGV_3D) #add_subdirectory(targets/apps/LBM/TGV_3D_MultiGPU) diff --git a/gpu/targets/apps/LBM/DrivenCavity/CMakeLists.txt b/gpu/targets/apps/LBM/DrivenCavity/CMakeLists.txt index 733ac8e5dd00b97b658393ea13aea1c667394ccf..20cc76e8011bcdabf1960a2b24d4898df3411853 100644 --- a/gpu/targets/apps/LBM/DrivenCavity/CMakeLists.txt +++ b/gpu/targets/apps/LBM/DrivenCavity/CMakeLists.txt @@ -1,22 +1,31 @@ -setTargetNameToFolderName(${CMAKE_CURRENT_LIST_DIR}) +PROJECT(DrivenCavity) -set(linkDirectories "") -#set(libsToLink Core VirtualFluids_GPU GridGenerator GksMeshAdapter GksVtkAdapter GksGpu) -set(libsToLink Core VirtualFluids_GPU GridGenerator ) -set(includeDirectories "${CMAKE_SOURCE_DIR}/src" - "${CMAKE_SOURCE_DIR}/src/Core" - "${CMAKE_SOURCE_DIR}/src/VirtualFluids_GPU" - "${CMAKE_SOURCE_DIR}/src/GridGenerator" - "${CMAKE_SOURCE_DIR}/src/VirtualFluidsBasics" - "${CMAKE_SOURCE_DIR}/src/GksMeshAdapter" - "${CMAKE_SOURCE_DIR}/src/GksVtkAdapter" - "${CMAKE_SOURCE_DIR}/src/GksGpu") +#LIST(APPEND CAB_COMPILER_ADDTIONAL_CXX_COMPILER_FLAGS "-DOMPI_SKIP_MPICXX" ) -#glob files and save in MY_SRCS -include(CMakePackage.cmake) +vf_add_library(BUILDTYPE binary DEPENDS VirtualFluids_GPU basics GridGenerator FILES DrivenCavity.cpp ) -buildExe(${targetName} "${MY_SRCS}" "${linkDirectories}" "${libsToLink}" "${includeDirectories}") -groupTarget(${targetName} ${lbmAppFolder}) +include (${CMAKE_PATH}/3rd/cuda.cmake) +include (${CMAKE_PATH}/3rd/mpi.cmake) +include (${CMAKE_PATH}/3rd/boost.cmake) +linkBoost ("serialization") -# Specify the linking to 3rdParty libs -include(3rdPartyLinking.cmake) \ No newline at end of file +vf_get_library_name(library_name) +target_include_directories(${library_name} PRIVATE "${CMAKE_SOURCE_DIR}/src/basics") +target_include_directories(${library_name} PRIVATE "${CMAKE_SOURCE_DIR}/src/gpu") +target_include_directories(${library_name} PRIVATE "${CMAKE_SOURCE_DIR}/src/gpu/VirtualFluids_GPU") +target_include_directories(${library_name} PRIVATE "${CMAKE_SOURCE_DIR}/src/gpu/GridGenerator") +target_include_directories(${library_name} PRIVATE "${CMAKE_SOURCE_DIR}/src/basics/Core") + +#include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/MPI/Link.cmake) +#linkMPI(${targetName}) +#include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Cuda/Link.cmake) +#linkCuda(${targetName}) +#include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Boost/Link.cmake) +#linkBoost(${targetName} "serialization") +#include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/Metis/Link.cmake) +#linkMetis(${targetName}) + +#if(HULC.BUILD_JSONCPP) +# include (${CMAKE_SOURCE_DIR}/${cmakeMacroPath}/JsonCpp/Link.cmake) +# linkJsonCpp(${targetName}) +#endif() \ No newline at end of file diff --git a/src/basics/CMakeLists.txt b/src/basics/CMakeLists.txt index b668e432fcecc548e04f2541963e6a04f47eb0fd..1e7e200330ed4aed32aa9fa939086ffc6ef667ba 100644 --- a/src/basics/CMakeLists.txt +++ b/src/basics/CMakeLists.txt @@ -12,7 +12,7 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_LIST_DIR}/basics/writer) include (${CMAKE_SOURCE_DIR}/CMake/VirtualFluidsMacros.cmake) -SET(CAB_ADDITIONAL_LINK_LIBRARIES ${MPI_CXX_LIBRARIES}) +#SET(CAB_ADDITIONAL_LINK_LIBRARIES ${MPI_CXX_LIBRARIES}) include(Core/buildInfo.cmake) @@ -31,9 +31,20 @@ vf_add_library(BUILDTYPE static ${CMAKE_CURRENT_LIST_DIR}/basics/utilities ${CMAKE_CURRENT_LIST_DIR}/basics/writer ${CMAKE_CURRENT_LIST_DIR}/Core + ${CMAKE_CURRENT_LIST_DIR}/Core/Logger + ${CMAKE_CURRENT_LIST_DIR}/Core/Logger/implementations + ${CMAKE_CURRENT_LIST_DIR}/Core/Input + ${CMAKE_CURRENT_LIST_DIR}/Core/Input/ConfigData + ${CMAKE_CURRENT_LIST_DIR}/Core/Input/ConfigFileReader + ${CMAKE_CURRENT_LIST_DIR}/Core/Input/ConfigInput + ${CMAKE_CURRENT_LIST_DIR}/Core/Input/JsonInput + ${CMAKE_CURRENT_LIST_DIR}/Core/StringUtilities + ${CMAKE_CURRENT_LIST_DIR}/Core/Timer EXCLUDE buildInfo.in.cpp ) vf_get_library_name (library_name) target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/Core) target_include_directories(${library_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) + +include (${CMAKE_PATH}/3rd/mpi.cmake) \ No newline at end of file diff --git a/src/basics/Core/Logger/Logger.h b/src/basics/Core/Logger/Logger.h index a40292a302614c7e088a922579baac36bdc6abab..fa8a00040b63a4c9c8063be91376f500e2c96ba0 100644 --- a/src/basics/Core/Logger/Logger.h +++ b/src/basics/Core/Logger/Logger.h @@ -62,7 +62,7 @@ namespace logging static bool timeStampEnabled; }; - extern VF_SHARED_LIB_IMPORT std::shared_ptr<Logger> out; + extern BASICS_EXPORT std::shared_ptr<Logger> out; } diff --git a/src/basics/Core/Logger/implementations/LoggerImp.cpp b/src/basics/Core/Logger/implementations/LoggerImp.cpp index 41f9f78a149b366405fb4458d6d9d8881d91b970..b06523afbcee1fc26b8008a7b08ebdf82d68b579 100644 --- a/src/basics/Core/Logger/implementations/LoggerImp.cpp +++ b/src/basics/Core/Logger/implementations/LoggerImp.cpp @@ -1,6 +1,6 @@ #include "LoggerImp.h" -#include "mpi.h" +#include <mpi.h> #include <sstream> #include <iostream> #include <iomanip> diff --git a/src/basics/Core/Timer/Timer.h b/src/basics/Core/Timer/Timer.h index f982fe1ac35320fe21f3aac091862db45d665c3a..c25eb8274aa443384c6762482be8a27e54d37604 100644 --- a/src/basics/Core/Timer/Timer.h +++ b/src/basics/Core/Timer/Timer.h @@ -2,6 +2,7 @@ #define TIMER_H #include "VirtualFluidsDefinitions.h" +#include "basics_export.h" #include "DataTypes.h" #include "PointerDefinitions.h" diff --git a/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBox.cu b/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBox.cu index 3eb24ffd19b6dc3d5403072d05f56f0ba0ae4fc3..75ae002813541bfdb73b0f3dcc179270c31fa5df 100644 --- a/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBox.cu +++ b/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBox.cu @@ -21,7 +21,7 @@ BoundingBox::BoundingBox(const BoundingBox &t) : minX(t.minX), maxX(t.maxX), minY(t.minY), maxY(t.maxY), minZ(t.minZ), maxZ(t.maxZ) {} - HOST BoundingBox BoundingBox::makeInvalidMinMaxBox() + CUDA_HOST BoundingBox BoundingBox::makeInvalidMinMaxBox() { BoundingBox box = BoundingBox(std::numeric_limits<real>::max(), std::numeric_limits<real>::lowest(), @@ -157,7 +157,7 @@ } - HOST bool BoundingBox::operator==(const BoundingBox &box) const + CUDA_HOST bool BoundingBox::operator==(const BoundingBox &box) const { return vf::Math::equal(minX, box.minX) && vf::Math::equal(maxX, box.maxX) diff --git a/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBox.h b/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBox.h index 1094ed43c842a7eb50e643502eaefc0ce2ab6234..b25859e5172d1d38a1bfecf9d5b224ac8630a225 100644 --- a/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBox.h +++ b/src/gpu/GridGenerator/geometries/BoundingBox/BoundingBox.h @@ -25,7 +25,7 @@ public: BoundingBox(const BoundingBox &t); public: - HOST static BoundingBox makeInvalidMinMaxBox(); + CUDA_HOST static BoundingBox makeInvalidMinMaxBox(); void setMinMax(const Triangle& t); void print() const; @@ -37,7 +37,7 @@ public: std::vector<std::vector<Vertex> > getIntersectionPoints(const BoundingBox &b) const; bool intersect(const BoundingBox &box) const; - HOST bool operator==(const BoundingBox &box) const; + CUDA_HOST bool operator==(const BoundingBox &box) const; void extend(real delta); diff --git a/src/gpu/GridGenerator/geometries/Conglomerate/Conglomerate.h b/src/gpu/GridGenerator/geometries/Conglomerate/Conglomerate.h index 0089d368629c1a3477a8b536ad99a31fd404ebc9..1c965f7ac556eff4abd969e98d6feed50efaafb4 100644 --- a/src/gpu/GridGenerator/geometries/Conglomerate/Conglomerate.h +++ b/src/gpu/GridGenerator/geometries/Conglomerate/Conglomerate.h @@ -19,7 +19,7 @@ public: HOSTDEVICE Conglomerate(); HOSTDEVICE virtual ~Conglomerate(); - HOST static SPtr<Conglomerate> makeShared(); + CUDA_HOST static SPtr<Conglomerate> makeShared(); HOSTDEVICE void add(Object* object); HOSTDEVICE void subtract(Object* objectStub); @@ -41,7 +41,7 @@ public: HOSTDEVICE bool isPointInObject(const double& x1, const double& x2, const double& x3, const double& minOffset, const double& maxOffset) override; - HOST void findInnerNodes(SPtr<GridImp> grid) override; + CUDA_HOST void findInnerNodes(SPtr<GridImp> grid) override; protected: static double getMinimum(double val1, double val2); diff --git a/src/gpu/GridGenerator/geometries/Object.cu b/src/gpu/GridGenerator/geometries/Object.cu index 0fae18f668f14d86356b3e4a04be3a9f284dc1a0..a5167f7fb14970d520b7ebe4b92d4ae9a3dcc94b 100644 --- a/src/gpu/GridGenerator/geometries/Object.cu +++ b/src/gpu/GridGenerator/geometries/Object.cu @@ -7,7 +7,7 @@ void Object::findInnerNodes(SPtr<GridImp> grid) grid->getGridStrategy()->findInnerNodes( grid ); } -HOST int Object::getIntersection(const Vertex & P, const Vertex & direction, Vertex & pointOnObject, real & qVal) +CUDA_HOST int Object::getIntersection(const Vertex & P, const Vertex & direction, Vertex & pointOnObject, real & qVal) { return 1; } diff --git a/src/gpu/GridGenerator/geometries/Object.h b/src/gpu/GridGenerator/geometries/Object.h index 9a32abbf6b676877235afe9a193c1ae64cd3402f..175f06b4d3ecf80aafca8a73403589966c1d9bbc 100644 --- a/src/gpu/GridGenerator/geometries/Object.h +++ b/src/gpu/GridGenerator/geometries/Object.h @@ -48,9 +48,9 @@ public: return true; } - HOST virtual void findInnerNodes(SPtr<GridImp> grid); + CUDA_HOST virtual void findInnerNodes(SPtr<GridImp> grid); - HOST virtual int getIntersection(const Vertex &P, const Vertex &direction, Vertex &pointOnObject, real &qVal); + CUDA_HOST virtual int getIntersection(const Vertex &P, const Vertex &direction, Vertex &pointOnObject, real &qVal); }; diff --git a/src/gpu/GridGenerator/geometries/Sphere/Sphere.cu b/src/gpu/GridGenerator/geometries/Sphere/Sphere.cu index 7e93c98df737604686a7bf8994dbf4234266b385..85d353d393d082e9a6196b4ee3a59804b2b5c223 100644 --- a/src/gpu/GridGenerator/geometries/Sphere/Sphere.cu +++ b/src/gpu/GridGenerator/geometries/Sphere/Sphere.cu @@ -90,7 +90,7 @@ void Sphere::scale(double delta) this->radius += delta; } -HOST int Sphere::getIntersection(const Vertex & point, const Vertex & direction, Vertex & pointOnObject, real & qVal) +CUDA_HOST int Sphere::getIntersection(const Vertex & point, const Vertex & direction, Vertex & pointOnObject, real & qVal) { Vertex relativePoint( point.x - this->centerX, diff --git a/src/gpu/GridGenerator/geometries/Sphere/Sphere.h b/src/gpu/GridGenerator/geometries/Sphere/Sphere.h index 988c2a131e86264ec51335b4c19ad7764c6c673f..949c27c4d8b2db53e1ba2667e250a77df22c4aac 100644 --- a/src/gpu/GridGenerator/geometries/Sphere/Sphere.h +++ b/src/gpu/GridGenerator/geometries/Sphere/Sphere.h @@ -36,7 +36,7 @@ public: void scale(double delta) override; - HOST int getIntersection(const Vertex &P, const Vertex &direction, Vertex &pointOnObject, real &qVal) override; + CUDA_HOST int getIntersection(const Vertex &P, const Vertex &direction, Vertex &pointOnObject, real &qVal) override; protected: diff --git a/src/gpu/GridGenerator/geometries/Triangle/Triangle.cu b/src/gpu/GridGenerator/geometries/Triangle/Triangle.cu index 565167d9663cbc1faae7a8c7831a44f0909ca7c9..0b6aaa080e43f17323cb414e7cb1879446c29bb9 100644 --- a/src/gpu/GridGenerator/geometries/Triangle/Triangle.cu +++ b/src/gpu/GridGenerator/geometries/Triangle/Triangle.cu @@ -305,7 +305,7 @@ HOSTDEVICE void Triangle::print() const normal.print(); } -HOST bool Triangle::operator==(const Triangle &t) const +CUDA_HOST bool Triangle::operator==(const Triangle &t) const { return v1 == t.v1 && v2 == t.v2 && v3 == t.v3 && vf::Math::equal(alphaAngles[0], t.alphaAngles[0]) && vf::Math::equal(alphaAngles[1], t.alphaAngles[1]) && vf::Math::equal(alphaAngles[2], t.alphaAngles[2]); diff --git a/src/gpu/GridGenerator/geometries/Triangle/Triangle.h b/src/gpu/GridGenerator/geometries/Triangle/Triangle.h index 36c8b192b0f5a4ffdda322c1284920ec4b1d7356..66932840f2f023dcfcd378be802f1dfea3056c81 100644 --- a/src/gpu/GridGenerator/geometries/Triangle/Triangle.h +++ b/src/gpu/GridGenerator/geometries/Triangle/Triangle.h @@ -51,10 +51,10 @@ struct VF_PUBLIC Triangle HOSTDEVICE bool isQNode(const Vertex & point, const real &s) const; HOSTDEVICE bool isNegativeDirectionBorder(const Vertex & point) const; - HOST bool operator==(const Triangle &t) const; + CUDA_HOST bool operator==(const Triangle &t) const; - HOST TriangleMemento getState() const; - HOST void setState(const TriangleMemento &memento); + CUDA_HOST TriangleMemento getState() const; + CUDA_HOST void setState(const TriangleMemento &memento); HOSTDEVICE void setMinMax(real &minX, real &maxX, real &minY, real &maxY, real &minZ, real &maxZ) const; diff --git a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cu b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cu index 96bc858e40534a4bad8fb29633802f7f5732e23f..91144b8fe054e163e60de1680a8fd5c8b31d54be 100644 --- a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cu +++ b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.cu @@ -99,7 +99,7 @@ void TriangularMesh::initalizeDataFromTriangles() } } -HOST bool TriangularMesh::operator==(const TriangularMesh &geometry) const +CUDA_HOST bool TriangularMesh::operator==(const TriangularMesh &geometry) const { if (!(minmax == geometry.minmax)) return false; @@ -119,7 +119,7 @@ HOSTDEVICE GbTriFaceMesh3D* TriangularMesh::getGbTriFaceMesh3D() const return this->VF_GbTriFaceMesh3D.get(); } -HOST VF_PUBLIC void TriangularMesh::generateGbTriFaceMesh3D() +CUDA_HOST VF_PUBLIC void TriangularMesh::generateGbTriFaceMesh3D() { if( this->VF_GbTriFaceMesh3D ) return; diff --git a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h index db96292fa6353621d9f01cfbf772265a6c581423..0e5382ac7b909249629913be3a8aecbfbf09ff84 100644 --- a/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h +++ b/src/gpu/GridGenerator/geometries/TriangularMesh/TriangularMesh.h @@ -42,13 +42,13 @@ public: SPtr<GbTriFaceMesh3D> VF_GbTriFaceMesh3D; - HOST VF_PUBLIC bool operator==(const TriangularMesh &geometry) const; + CUDA_HOST VF_PUBLIC bool operator==(const TriangularMesh &geometry) const; VF_PUBLIC void findNeighbors(); HOSTDEVICE VF_PUBLIC GbTriFaceMesh3D* getGbTriFaceMesh3D() const; - HOST VF_PUBLIC void generateGbTriFaceMesh3D(); + CUDA_HOST VF_PUBLIC void generateGbTriFaceMesh3D(); private: diff --git a/src/gpu/GridGenerator/geometries/Vertex/Vertex.cu b/src/gpu/GridGenerator/geometries/Vertex/Vertex.cu index 878481977700ae81f4f86fffad710dd588254d88..48a30faad77cd174718a9bb65a6685d6af92f216 100644 --- a/src/gpu/GridGenerator/geometries/Vertex/Vertex.cu +++ b/src/gpu/GridGenerator/geometries/Vertex/Vertex.cu @@ -98,14 +98,14 @@ HOSTDEVICE void Vertex::print() const printf("(%2.8f,%2.8f,%2.8f)\n", x, y, z); } -HOST void Vertex::print(std::ostream &ost) const +CUDA_HOST void Vertex::print(std::ostream &ost) const { ost.write((char*)&x, 4); ost.write((char*)&y, 4); ost.write((char*)&z, 4); } -HOST void Vertex::printFormatted(std::ostream &ost) const +CUDA_HOST void Vertex::printFormatted(std::ostream &ost) const { ost << x << " " << y << " " << z; } @@ -118,17 +118,17 @@ HOSTDEVICE bool Vertex::operator==(const Vertex &v) const } -HOST bool Vertex::isXbetween(real min, real max) const +CUDA_HOST bool Vertex::isXbetween(real min, real max) const { return x >= min && x <= max; } -HOST bool Vertex::isYbetween(real min, real max) const +CUDA_HOST bool Vertex::isYbetween(real min, real max) const { return y >= min && y <= max; } -HOST bool Vertex::isZbetween(real min, real max) const +CUDA_HOST bool Vertex::isZbetween(real min, real max) const { return z >= min && z <= max; } diff --git a/src/gpu/GridGenerator/geometries/Vertex/Vertex.h b/src/gpu/GridGenerator/geometries/Vertex/Vertex.h index 51c7bb4602bf816d95851a2f9dbb76a5e9393b83..f854801a5ce7081ea2c74753ed29e13f6ef48910 100644 --- a/src/gpu/GridGenerator/geometries/Vertex/Vertex.h +++ b/src/gpu/GridGenerator/geometries/Vertex/Vertex.h @@ -36,19 +36,19 @@ public: HOSTDEVICE bool operator==(const Vertex &v) const; - HOST VertexMemento getState() const; - HOST void setState(const VertexMemento &memento); + CUDA_HOST VertexMemento getState() const; + CUDA_HOST void setState(const VertexMemento &memento); - HOST bool isXbetween(real min, real max) const; - HOST bool isYbetween(real min, real max) const; - HOST bool isZbetween(real min, real max) const; + CUDA_HOST bool isXbetween(real min, real max) const; + CUDA_HOST bool isYbetween(real min, real max) const; + CUDA_HOST bool isZbetween(real min, real max) const; HOSTDEVICE static void setMinMax(real &minX, real &maxX, real &minY, real &maxY, real &minZ, real &maxZ, const Vertex &v1, const Vertex &v2, const Vertex &v3); HOSTDEVICE static void calculateMinMax(const real &value1, const real &value2, const real &value3, real &min, real &max); HOSTDEVICE void print() const; - HOST void print(std::ostream &ost) const; - HOST void printFormatted(std::ostream &ost) const; + CUDA_HOST void print(std::ostream &ost) const; + CUDA_HOST void printFormatted(std::ostream &ost) const; }; diff --git a/src/gpu/GridGenerator/grid/Field.cu b/src/gpu/GridGenerator/grid/Field.cu index b3ae961aa171036f08bbd0fe53d02e5303baf863..9107e3942e1795d3c32ed9ffb200a6dac7c91bac 100644 --- a/src/gpu/GridGenerator/grid/Field.cu +++ b/src/gpu/GridGenerator/grid/Field.cu @@ -3,7 +3,7 @@ #include "grid/NodeValues.h" #include "grid/GridStrategy/GridStrategy.h" -HOST Field::Field(SPtr<GridStrategy> gridStrategy, uint size) : gridStrategy(gridStrategy), size(size) +CUDA_HOST Field::Field(SPtr<GridStrategy> gridStrategy, uint size) : gridStrategy(gridStrategy), size(size) { } @@ -18,12 +18,12 @@ Field::~Field() } -HOST void Field::allocateMemory() +CUDA_HOST void Field::allocateMemory() { gridStrategy->allocateFieldMemory(this); } -HOST void Field::freeMemory() +CUDA_HOST void Field::freeMemory() { gridStrategy->freeFieldMemory(this); } diff --git a/src/gpu/GridGenerator/grid/Field.h b/src/gpu/GridGenerator/grid/Field.h index 2bc891ba759bc02424fa4738f457247ce6de3ef4..1757d7e446c4b7c1b7509b1bc42a894358836528 100644 --- a/src/gpu/GridGenerator/grid/Field.h +++ b/src/gpu/GridGenerator/grid/Field.h @@ -9,11 +9,11 @@ class GridStrategy; class VF_PUBLIC Field : public enableSharedFromThis<Field> { public: - HOST Field(SPtr<GridStrategy> gridStrategy, uint size); + CUDA_HOST Field(SPtr<GridStrategy> gridStrategy, uint size); HOSTDEVICE Field(); HOSTDEVICE ~Field(); - HOST void allocateMemory(); - HOST void freeMemory(); + CUDA_HOST void allocateMemory(); + CUDA_HOST void freeMemory(); HOSTDEVICE uint getSize() const; HOSTDEVICE char getFieldEntry(uint index) const; diff --git a/src/gpu/GridGenerator/grid/Grid.h b/src/gpu/GridGenerator/grid/Grid.h index 5eb40dc2bd527512557156a36ac0fcf63b334920..8582d1606d6402f1559be1929423455e1308d5f1 100644 --- a/src/gpu/GridGenerator/grid/Grid.h +++ b/src/gpu/GridGenerator/grid/Grid.h @@ -50,83 +50,83 @@ public: HOSTDEVICE virtual char getFieldEntry(uint matrixIndex) const = 0; HOSTDEVICE virtual void setFieldEntry(uint matrixIndex, char type) = 0; - HOST virtual void getGridInterfaceIndices(uint* iCellCfc, uint* iCellCff, uint* iCellFcc, uint* iCellFcf) const = 0; + CUDA_HOST virtual void getGridInterfaceIndices(uint* iCellCfc, uint* iCellCff, uint* iCellFcc, uint* iCellFcf) const = 0; - HOST virtual int *getNeighborsX() const = 0; - HOST virtual int *getNeighborsY() const = 0; - HOST virtual int *getNeighborsZ() const = 0; - HOST virtual int *getNeighborsNegative() const = 0; + CUDA_HOST virtual int *getNeighborsX() const = 0; + CUDA_HOST virtual int *getNeighborsY() const = 0; + CUDA_HOST virtual int *getNeighborsZ() const = 0; + CUDA_HOST virtual int *getNeighborsNegative() const = 0; - HOST virtual uint* getCF_coarse() const = 0; - HOST virtual uint* getCF_fine() const = 0; - HOST virtual uint* getCF_offset() const = 0; + CUDA_HOST virtual uint* getCF_coarse() const = 0; + CUDA_HOST virtual uint* getCF_fine() const = 0; + CUDA_HOST virtual uint* getCF_offset() const = 0; - HOST virtual uint* getFC_coarse() const = 0; - HOST virtual uint* getFC_fine() const = 0; - HOST virtual uint* getFC_offset() const = 0; + CUDA_HOST virtual uint* getFC_coarse() const = 0; + CUDA_HOST virtual uint* getFC_fine() const = 0; + CUDA_HOST virtual uint* getFC_offset() const = 0; - HOST virtual real* getDistribution() const = 0; - HOST virtual int* getDirection() const = 0; - HOST virtual int getStartDirection() const = 0; - HOST virtual int getEndDirection() const = 0; + CUDA_HOST virtual real* getDistribution() const = 0; + CUDA_HOST virtual int* getDirection() const = 0; + CUDA_HOST virtual int getStartDirection() const = 0; + CUDA_HOST virtual int getEndDirection() const = 0; - HOST virtual void getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, uint *geo) const = 0; + CUDA_HOST virtual void getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, uint *geo) const = 0; - HOST virtual SPtr<GridStrategy> getGridStrategy() const = 0; + CUDA_HOST virtual SPtr<GridStrategy> getGridStrategy() const = 0; HOSTDEVICE virtual void transIndexToCoords(uint index, real &x, real &y, real &z) const = 0; HOSTDEVICE virtual uint transCoordToIndex(const real &x, const real &y, const real &z) const = 0; - HOST virtual void inital(const SPtr<Grid> fineGrid, uint numberOfLayers) = 0; + CUDA_HOST virtual void inital(const SPtr<Grid> fineGrid, uint numberOfLayers) = 0; - HOST virtual void setOddStart( bool xOddStart, bool yOddStart, bool zOddStart ) = 0; + CUDA_HOST virtual void setOddStart( bool xOddStart, bool yOddStart, bool zOddStart ) = 0; - HOST virtual void findGridInterface(SPtr<Grid> grid, LbmOrGks lbmOrGks) = 0; + CUDA_HOST virtual void findGridInterface(SPtr<Grid> grid, LbmOrGks lbmOrGks) = 0; - HOST virtual void repairGridInterfaceOnMultiGPU(SPtr<Grid> fineGrid) = 0; + CUDA_HOST virtual void repairGridInterfaceOnMultiGPU(SPtr<Grid> fineGrid) = 0; - HOST virtual void limitToSubDomain(SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks) = 0; + CUDA_HOST virtual void limitToSubDomain(SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks) = 0; - HOST virtual void enableFindSolidBoundaryNodes() = 0; - HOST virtual void enableComputeQs() = 0; + CUDA_HOST virtual void enableFindSolidBoundaryNodes() = 0; + CUDA_HOST virtual void enableComputeQs() = 0; - HOST virtual void mesh(TriangularMesh& geometry) = 0; - HOST virtual void mesh(Object* object) = 0; + CUDA_HOST virtual void mesh(TriangularMesh& geometry) = 0; + CUDA_HOST virtual void mesh(Object* object) = 0; - HOST virtual void closeNeedleCells() = 0; - HOST virtual void closeNeedleCellsThinWall() = 0; + CUDA_HOST virtual void closeNeedleCells() = 0; + CUDA_HOST virtual void closeNeedleCellsThinWall() = 0; - HOST virtual void findQs(Object* object) = 0; + CUDA_HOST virtual void findQs(Object* object) = 0; - HOST virtual void setPeriodicity(bool periodicityX, bool periodicityY, bool periodicityZ) = 0; - HOST virtual void setPeriodicityX(bool periodicity) = 0; - HOST virtual void setPeriodicityY(bool periodicity) = 0; - HOST virtual void setPeriodicityZ(bool periodicity) = 0; + CUDA_HOST virtual void setPeriodicity(bool periodicityX, bool periodicityY, bool periodicityZ) = 0; + CUDA_HOST virtual void setPeriodicityX(bool periodicity) = 0; + CUDA_HOST virtual void setPeriodicityY(bool periodicity) = 0; + CUDA_HOST virtual void setPeriodicityZ(bool periodicity) = 0; - HOST virtual bool getPeriodicityX() = 0; - HOST virtual bool getPeriodicityY() = 0; - HOST virtual bool getPeriodicityZ() = 0; + CUDA_HOST virtual bool getPeriodicityX() = 0; + CUDA_HOST virtual bool getPeriodicityY() = 0; + CUDA_HOST virtual bool getPeriodicityZ() = 0; - HOST virtual void setEnableFixRefinementIntoTheWall( bool enableFixRefinementIntoTheWall ) = 0; + CUDA_HOST virtual void setEnableFixRefinementIntoTheWall( bool enableFixRefinementIntoTheWall ) = 0; - HOST virtual void freeMemory() = 0; + CUDA_HOST virtual void freeMemory() = 0; HOSTDEVICE virtual bool nodeInCellIs(Cell& cell, char type) const = 0; - HOST virtual void findSparseIndices(SPtr<Grid> fineGrid) = 0; + CUDA_HOST virtual void findSparseIndices(SPtr<Grid> fineGrid) = 0; HOSTDEVICE virtual real getFirstFluidNode(real coords[3], int direction, real startCoord) const = 0; HOSTDEVICE virtual real getLastFluidNode(real coords[3], int direction, real startCoord) const = 0; - HOST virtual uint getNumberOfSolidBoundaryNodes() const = 0; - HOST virtual void setNumberOfSolidBoundaryNodes(uint numberOfSolidBoundaryNodes) = 0; + CUDA_HOST virtual uint getNumberOfSolidBoundaryNodes() const = 0; + CUDA_HOST virtual void setNumberOfSolidBoundaryNodes(uint numberOfSolidBoundaryNodes) = 0; - HOST virtual real getQValue(const uint index, const uint dir) const = 0; - HOST virtual uint getQPatch(const uint index) const = 0; + CUDA_HOST virtual real getQValue(const uint index, const uint dir) const = 0; + CUDA_HOST virtual uint getQPatch(const uint index) const = 0; - HOST virtual void setInnerRegionFromFinerGrid( bool innerRegionFromFinerGrid ) = 0; + CUDA_HOST virtual void setInnerRegionFromFinerGrid( bool innerRegionFromFinerGrid ) = 0; - HOST virtual void setNumberOfLayers( uint numberOfLayers ) = 0; + CUDA_HOST virtual void setNumberOfLayers( uint numberOfLayers ) = 0; virtual void findCommunicationIndices(int direction, SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks) = 0; diff --git a/src/gpu/GridGenerator/grid/GridImp.cu b/src/gpu/GridGenerator/grid/GridImp.cu index 795a2460ae64d3fb9545ba4ba7789b497337d869..16deb16fd7bd6f14a115615afa25545057beb454 100644 --- a/src/gpu/GridGenerator/grid/GridImp.cu +++ b/src/gpu/GridGenerator/grid/GridImp.cu @@ -29,7 +29,7 @@ CONSTANT int DIRECTIONS[DIR_END_MAX][DIMENSION]; -HOST GridImp::GridImp(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution distribution, uint level) +CUDA_HOST GridImp::GridImp(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution distribution, uint level) : object(object), startX(startX), startY(startY), @@ -61,7 +61,7 @@ HOST GridImp::GridImp(Object* object, real startX, real startY, real startZ, rea initalNumberOfNodesAndSize(); } -HOST SPtr<GridImp> GridImp::makeShared(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution d, uint level) +CUDA_HOST SPtr<GridImp> GridImp::makeShared(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution d, uint level) { SPtr<GridImp> grid(new GridImp(object, startX, startY, startZ, endX, endY, endZ, delta, gridStrategy, d, level)); return grid; @@ -85,7 +85,7 @@ void GridImp::initalNumberOfNodesAndSize() this->numberOfSolidBoundaryNodes = 0; } -HOST void GridImp::inital(const SPtr<Grid> fineGrid, uint numberOfLayers) +CUDA_HOST void GridImp::inital(const SPtr<Grid> fineGrid, uint numberOfLayers) { field = Field(gridStrategy, size); field.allocateMemory(); @@ -123,7 +123,7 @@ HOST void GridImp::inital(const SPtr<Grid> fineGrid, uint numberOfLayers) << "nodes: " << this->nx << " x " << this->ny << " x " << this->nz << " = " << this->size << "\n"; } -HOST void GridImp::setOddStart(bool xOddStart, bool yOddStart, bool zOddStart) +CUDA_HOST void GridImp::setOddStart(bool xOddStart, bool yOddStart, bool zOddStart) { this->xOddStart = xOddStart; this->yOddStart = yOddStart; @@ -135,20 +135,20 @@ HOSTDEVICE void GridImp::initalNodeToOutOfGrid(uint index) this->field.setFieldEntryToInvalidOutOfGrid(index); } -HOST void GridImp::freeMemory() +CUDA_HOST void GridImp::freeMemory() { gridStrategy->freeMemory(shared_from_this()); gridStrategy->freeFieldMemory(&field); } -HOST GridImp::GridImp() +CUDA_HOST GridImp::GridImp() { //printf("Constructor\n"); //this->print(); } -HOST GridImp::~GridImp() +CUDA_HOST GridImp::~GridImp() { //printf("Destructor\n"); //this->print(); @@ -695,7 +695,7 @@ void GridImp::setNonStopperOutOfGridCellTo(uint index, char type) } -HOST void GridImp::setPeriodicity(bool periodicityX, bool periodicityY, bool periodicityZ) +CUDA_HOST void GridImp::setPeriodicity(bool periodicityX, bool periodicityY, bool periodicityZ) { this->periodicityX = periodicityX; this->periodicityY = periodicityY; @@ -763,7 +763,7 @@ HOSTDEVICE void GridImp::transIndexToCoords(uint index, real &x, real &y, real & z = (z * delta) + startZ; } -HOST uint GridImp::getLevel(real startDelta) const +CUDA_HOST uint GridImp::getLevel(real startDelta) const { uint level = 0; real delta = this->delta; @@ -775,50 +775,50 @@ HOST uint GridImp::getLevel(real startDelta) const return level; } -HOST uint GridImp::getLevel() const +CUDA_HOST uint GridImp::getLevel() const { return this->level; } -HOST void GridImp::setTriangularMeshDiscretizationStrategy(TriangularMeshDiscretizationStrategy* triangularMeshDiscretizationStrategy) +CUDA_HOST void GridImp::setTriangularMeshDiscretizationStrategy(TriangularMeshDiscretizationStrategy* triangularMeshDiscretizationStrategy) { this->triangularMeshDiscretizationStrategy = triangularMeshDiscretizationStrategy; } -HOST TriangularMeshDiscretizationStrategy * GridImp::getTriangularMeshDiscretizationStrategy() +CUDA_HOST TriangularMeshDiscretizationStrategy * GridImp::getTriangularMeshDiscretizationStrategy() { return this->triangularMeshDiscretizationStrategy; } -HOST uint GridImp::getNumberOfSolidBoundaryNodes() const +CUDA_HOST uint GridImp::getNumberOfSolidBoundaryNodes() const { return this->numberOfSolidBoundaryNodes; } -HOST void GridImp::setNumberOfSolidBoundaryNodes(uint numberOfSolidBoundaryNodes) +CUDA_HOST void GridImp::setNumberOfSolidBoundaryNodes(uint numberOfSolidBoundaryNodes) { if (numberOfSolidBoundaryNodes >= 0 && numberOfSolidBoundaryNodes < INVALID_INDEX) this->numberOfSolidBoundaryNodes = numberOfSolidBoundaryNodes; } -HOST real GridImp::getQValue(const uint index, const uint dir) const +CUDA_HOST real GridImp::getQValue(const uint index, const uint dir) const { const int qIndex = dir * this->numberOfSolidBoundaryNodes + this->qIndices[index]; return this->qValues[qIndex]; } -HOST uint GridImp::getQPatch(const uint index) const +CUDA_HOST uint GridImp::getQPatch(const uint index) const { return this->qPatches[ this->qIndices[index] ]; } -HOST void GridImp::setInnerRegionFromFinerGrid(bool innerRegionFromFinerGrid) +CUDA_HOST void GridImp::setInnerRegionFromFinerGrid(bool innerRegionFromFinerGrid) { this->innerRegionFromFinerGrid = innerRegionFromFinerGrid; } -HOST void GridImp::setNumberOfLayers(uint numberOfLayers) +CUDA_HOST void GridImp::setNumberOfLayers(uint numberOfLayers) { this->numberOfLayers = numberOfLayers; } @@ -827,13 +827,13 @@ HOST void GridImp::setNumberOfLayers(uint numberOfLayers) // Set Sparse Indices // // --------------------------------------------------------- // -HOST void GridImp::findSparseIndices(SPtr<Grid> fineGrid) +CUDA_HOST void GridImp::findSparseIndices(SPtr<Grid> fineGrid) { this->gridStrategy->findSparseIndices(shared_from_this(), std::static_pointer_cast<GridImp>(fineGrid)); } -HOST void GridImp::updateSparseIndices() +CUDA_HOST void GridImp::updateSparseIndices() { int removedNodes = 0; int newIndex = 0; @@ -1006,7 +1006,7 @@ HOSTDEVICE int GridImp::getSparseIndex(const real &x, const real &y, const real // --------------------------------------------------------- // // Find Interface // // --------------------------------------------------------- // -HOST void GridImp::findGridInterface(SPtr<Grid> finerGrid, LbmOrGks lbmOrGks) +CUDA_HOST void GridImp::findGridInterface(SPtr<Grid> finerGrid, LbmOrGks lbmOrGks) { gridStrategy->findGridInterface(shared_from_this(), std::static_pointer_cast<GridImp>(finerGrid), lbmOrGks); } @@ -1016,7 +1016,7 @@ HOSTDEVICE void GridImp::repairGridInterfaceOnMultiGPU(SPtr<Grid> fineGrid) this->gridInterface->repairGridInterfaceOnMultiGPU( shared_from_this(), std::static_pointer_cast<GridImp>(fineGrid) ); } -HOST void GridImp::limitToSubDomain(SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks) +CUDA_HOST void GridImp::limitToSubDomain(SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks) { for( uint index = 0; index < this->size; index++ ){ @@ -1088,7 +1088,7 @@ HOSTDEVICE void GridImp::findInvalidBoundaryNodes(uint index) // --------------------------------------------------------- // // Mesh Triangle // // --------------------------------------------------------- // -HOST void GridImp::mesh(Object* object) +CUDA_HOST void GridImp::mesh(Object* object) { TriangularMesh* triangularMesh = dynamic_cast<TriangularMesh*>(object); if (triangularMesh) @@ -1105,7 +1105,7 @@ HOST void GridImp::mesh(Object* object) } -HOST void GridImp::mesh(TriangularMesh &triangularMesh) +CUDA_HOST void GridImp::mesh(TriangularMesh &triangularMesh) { const clock_t begin = clock(); @@ -1143,7 +1143,7 @@ HOSTDEVICE void GridImp::mesh(Triangle &triangle) } } -HOST void GridImp::closeNeedleCells() +CUDA_HOST void GridImp::closeNeedleCells() { *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start closeNeedleCells()\n"; @@ -1178,7 +1178,7 @@ HOSTDEVICE bool GridImp::closeCellIfNeedle(uint index) return false; } -HOST void GridImp::closeNeedleCellsThinWall() +CUDA_HOST void GridImp::closeNeedleCellsThinWall() { *logging::out << logging::Logger::INFO_INTERMEDIATE << "Start closeNeedleCellsThinWall()\n"; @@ -1220,7 +1220,7 @@ HOSTDEVICE bool GridImp::closeCellIfNeedleThinWall(uint index) -HOST void GridImp::findQs(Object* object) //TODO: enable qs for primitive objects +CUDA_HOST void GridImp::findQs(Object* object) //TODO: enable qs for primitive objects { TriangularMesh* triangularMesh = dynamic_cast<TriangularMesh*>(object); if (triangularMesh) @@ -1229,7 +1229,7 @@ HOST void GridImp::findQs(Object* object) //TODO: enable qs for primitive object findQsPrimitive(object); } -HOST void GridImp::findQs(TriangularMesh &triangularMesh) +CUDA_HOST void GridImp::findQs(TriangularMesh &triangularMesh) { const clock_t begin = clock(); @@ -1288,7 +1288,7 @@ HOSTDEVICE void GridImp::findQs(Triangle &triangle) } } -HOST void GridImp::findQsPrimitive(Object * object) +CUDA_HOST void GridImp::findQsPrimitive(Object * object) { if( this->qComputationStage == qComputationStageType::ComputeQs ){ @@ -1601,22 +1601,22 @@ HOSTDEVICE int GridImp::getSparseIndex(uint matrixIndex) const return this->sparseIndices[matrixIndex]; } -HOST real* GridImp::getDistribution() const +CUDA_HOST real* GridImp::getDistribution() const { return this->distribution.f; } -HOST int* GridImp::getDirection() const +CUDA_HOST int* GridImp::getDirection() const { return this->distribution.dirs; } -HOST int GridImp::getStartDirection() const +CUDA_HOST int GridImp::getStartDirection() const { return this->distribution.dir_start; } -HOST int GridImp::getEndDirection() const +CUDA_HOST int GridImp::getEndDirection() const { return this->distribution.dir_end; } @@ -1831,7 +1831,7 @@ uint* GridImp::getCF_fine() const return this->gridInterface->cf.fine; } -HOST uint * GridImp::getCF_offset() const +CUDA_HOST uint * GridImp::getCF_offset() const { return this->gridInterface->cf.offset; } @@ -1846,7 +1846,7 @@ uint* GridImp::getFC_fine() const return this->gridInterface->fc.fine; } -HOST uint * GridImp::getFC_offset() const +CUDA_HOST uint * GridImp::getFC_offset() const { return this->gridInterface->fc.offset; } @@ -1868,7 +1868,7 @@ void GridImp::getGridInterface(uint* gridInterfaceList, const uint* oldGridInter #define GEOFLUID 19 #define GEOSOLID 16 -HOST void GridImp::getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, uint *geo) const +CUDA_HOST void GridImp::getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, uint *geo) const { xCoords[0] = 0; yCoords[0] = 0; diff --git a/src/gpu/GridGenerator/grid/GridImp.h b/src/gpu/GridGenerator/grid/GridImp.h index 3eebd60340e3ef7ba83a649efc96bd72bf38e8cb..478e8c533378649f25933419cab04bafdfee0768 100644 --- a/src/gpu/GridGenerator/grid/GridImp.h +++ b/src/gpu/GridGenerator/grid/GridImp.h @@ -26,15 +26,15 @@ extern CONSTANT int DIRECTIONS[DIR_END_MAX][DIMENSION]; class VF_PUBLIC GridImp : public enableSharedFromThis<GridImp>, public Grid { private: - HOST GridImp(); - HOST GridImp(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution d, uint level); + CUDA_HOST GridImp(); + CUDA_HOST GridImp(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution d, uint level); public: virtual HOSTDEVICE ~GridImp(); - static HOST SPtr<GridImp> makeShared(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution d, uint level); + static CUDA_HOST SPtr<GridImp> makeShared(Object* object, real startX, real startY, real startZ, real endX, real endY, real endZ, real delta, SPtr<GridStrategy> gridStrategy, Distribution d, uint level); private: - HOST void initalNumberOfNodesAndSize(); + CUDA_HOST void initalNumberOfNodesAndSize(); HOSTDEVICE Cell getOddCellFromIndex(uint index) const; HOSTDEVICE bool isValidSolidStopper(uint index) const; HOSTDEVICE bool shouldBeBoundarySolidNode(uint index) const; @@ -88,11 +88,11 @@ private: bool enableFixRefinementIntoTheWall; public: - HOST void inital(const SPtr<Grid> fineGrid, uint numberOfLayers) override; - HOST void setOddStart( bool xOddStart, bool yOddStart, bool zOddStart ) override; + CUDA_HOST void inital(const SPtr<Grid> fineGrid, uint numberOfLayers) override; + CUDA_HOST void setOddStart( bool xOddStart, bool yOddStart, bool zOddStart ) override; HOSTDEVICE void fixOddCell(uint index); - HOST void setPeriodicity(bool periodicityX, bool periodicityY, bool periodicityZ) override; + CUDA_HOST void setPeriodicity(bool periodicityX, bool periodicityY, bool periodicityZ) override; void setPeriodicityX(bool periodicity) override; void setPeriodicityY(bool periodicity) override; void setPeriodicityZ(bool periodicity) override; @@ -109,28 +109,28 @@ public: HOSTDEVICE uint transCoordToIndex(const real &x, const real &y, const real &z) const override; HOSTDEVICE void transIndexToCoords(uint index, real &x, real &y, real &z) const override; - HOST virtual void findGridInterface(SPtr<Grid> grid, LbmOrGks lbmOrGks) override; + CUDA_HOST virtual void findGridInterface(SPtr<Grid> grid, LbmOrGks lbmOrGks) override; - HOST void repairGridInterfaceOnMultiGPU(SPtr<Grid> fineGrid) override; + CUDA_HOST void repairGridInterfaceOnMultiGPU(SPtr<Grid> fineGrid) override; - HOST virtual void limitToSubDomain(SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks) override; + CUDA_HOST virtual void limitToSubDomain(SPtr<BoundingBox> subDomainBox, LbmOrGks lbmOrGks) override; - HOST void freeMemory() override; + CUDA_HOST void freeMemory() override; - HOST uint getLevel(real levelNull) const; - HOST uint getLevel() const; - HOST void setTriangularMeshDiscretizationStrategy(TriangularMeshDiscretizationStrategy* triangularMeshDiscretizationStrategy); - HOST TriangularMeshDiscretizationStrategy* getTriangularMeshDiscretizationStrategy(); + CUDA_HOST uint getLevel(real levelNull) const; + CUDA_HOST uint getLevel() const; + CUDA_HOST void setTriangularMeshDiscretizationStrategy(TriangularMeshDiscretizationStrategy* triangularMeshDiscretizationStrategy); + CUDA_HOST TriangularMeshDiscretizationStrategy* getTriangularMeshDiscretizationStrategy(); - HOST uint getNumberOfSolidBoundaryNodes() const override; - HOST void setNumberOfSolidBoundaryNodes(uint numberOfSolidBoundaryNodes) override; + CUDA_HOST uint getNumberOfSolidBoundaryNodes() const override; + CUDA_HOST void setNumberOfSolidBoundaryNodes(uint numberOfSolidBoundaryNodes) override; - HOST real getQValue(const uint index, const uint dir) const override; - HOST uint getQPatch(const uint index) const override; + CUDA_HOST real getQValue(const uint index, const uint dir) const override; + CUDA_HOST uint getQPatch(const uint index) const override; - HOST void setInnerRegionFromFinerGrid( bool innerRegionFromFinerGrid ) override; + CUDA_HOST void setInnerRegionFromFinerGrid( bool innerRegionFromFinerGrid ) override; - HOST void setNumberOfLayers( uint numberOfLayers ) override; + CUDA_HOST void setNumberOfLayers( uint numberOfLayers ) override; public: Distribution distribution; @@ -179,10 +179,10 @@ public: HOSTDEVICE uint getSize() const override; HOSTDEVICE uint getSparseSize() const override; HOSTDEVICE int getSparseIndex(uint matrixIndex) const override; - HOST real* getDistribution() const override; - HOST int* getDirection() const override; - HOST int getStartDirection() const override; - HOST int getEndDirection() const override; + CUDA_HOST real* getDistribution() const override; + CUDA_HOST int* getDirection() const override; + CUDA_HOST int getStartDirection() const override; + CUDA_HOST int getEndDirection() const override; HOSTDEVICE Vertex getMinimumOnNode(Vertex exact) const; HOSTDEVICE Vertex getMaximumOnNode(Vertex exact) const; @@ -196,26 +196,26 @@ public: HOSTDEVICE uint getNumberOfNodesX() const override; HOSTDEVICE uint getNumberOfNodesY() const override; HOSTDEVICE uint getNumberOfNodesZ() const override; - HOST void getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, uint *geo) const override; + CUDA_HOST void getNodeValues(real *xCoords, real *yCoords, real *zCoords, uint *neighborX, uint *neighborY, uint *neighborZ, uint *neighborNegative, uint *geo) const override; HOSTDEVICE uint getNumberOfNodesCF() const override; HOSTDEVICE uint getNumberOfNodesFC() const override; - HOST void getGridInterfaceIndices(uint* iCellCfc, uint* iCellCff, uint* iCellFcc, uint* iCellFcf) const override; - HOST static void getGridInterface(uint* gridInterfaceList, const uint* oldGridInterfaceList, uint size); + CUDA_HOST void getGridInterfaceIndices(uint* iCellCfc, uint* iCellCff, uint* iCellFcc, uint* iCellFcf) const override; + CUDA_HOST static void getGridInterface(uint* gridInterfaceList, const uint* oldGridInterfaceList, uint size); int* getNeighborsX() const override; int* getNeighborsY() const override; int* getNeighborsZ() const override; int* getNeighborsNegative() const override; - HOST uint* getCF_coarse() const override; - HOST uint* getCF_fine() const override; - HOST uint* getCF_offset() const override; + CUDA_HOST uint* getCF_coarse() const override; + CUDA_HOST uint* getCF_fine() const override; + CUDA_HOST uint* getCF_offset() const override; - HOST uint* getFC_coarse() const override; - HOST uint* getFC_fine() const override; - HOST uint* getFC_offset() const override; + CUDA_HOST uint* getFC_coarse() const override; + CUDA_HOST uint* getFC_fine() const override; + CUDA_HOST uint* getFC_offset() const override; SPtr<GridStrategy> getGridStrategy() const override; @@ -224,9 +224,9 @@ public: public: - HOST virtual void findSparseIndices(SPtr<Grid> fineGrid); + CUDA_HOST virtual void findSparseIndices(SPtr<Grid> fineGrid); - HOST void updateSparseIndices(); + CUDA_HOST void updateSparseIndices(); HOSTDEVICE void setNeighborIndices(uint index); HOSTDEVICE real getFirstFluidNode(real coords[3], int direction, real startCoord) const; HOSTDEVICE real getLastFluidNode(real coords[3], int direction, real startCoord) const; @@ -246,22 +246,22 @@ private: public: HOSTDEVICE BoundingBox getBoundingBoxOnNodes(Triangle &triangle) const; - HOST void mesh(Object* object) override; + CUDA_HOST void mesh(Object* object) override; - HOST void mesh(TriangularMesh &geometry) override; + CUDA_HOST void mesh(TriangularMesh &geometry) override; HOSTDEVICE void mesh(Triangle &triangle); - HOST void closeNeedleCells() override; + CUDA_HOST void closeNeedleCells() override; HOSTDEVICE bool closeCellIfNeedle(uint index); - HOST void closeNeedleCellsThinWall() override; + CUDA_HOST void closeNeedleCellsThinWall() override; HOSTDEVICE bool closeCellIfNeedleThinWall(uint index); - HOST void findQs(Object* object) override; - HOST void findQs(TriangularMesh &triangularMesh); + CUDA_HOST void findQs(Object* object) override; + CUDA_HOST void findQs(TriangularMesh &triangularMesh); HOSTDEVICE void findQs(Triangle &triangle); - HOST void findQsPrimitive(Object* object); + CUDA_HOST void findQsPrimitive(Object* object); private: enum class qComputationStageType{ @@ -270,18 +270,18 @@ private: } qComputationStage; public: - HOST void enableFindSolidBoundaryNodes(){ qComputationStage = qComputationStageType::FindSolidBoundaryNodes; } - HOST void enableComputeQs(){ qComputationStage = qComputationStageType::ComputeQs; } + CUDA_HOST void enableFindSolidBoundaryNodes(){ qComputationStage = qComputationStageType::FindSolidBoundaryNodes; } + CUDA_HOST void enableComputeQs(){ qComputationStage = qComputationStageType::ComputeQs; } private: HOSTDEVICE void setDebugPoint(uint index, int pointValue); HOSTDEVICE void calculateQs(const Vertex &point, const Triangle &triangle) const; HOSTDEVICE void calculateQs(const uint index, const Vertex &point, const Triangle &triangle) const; - HOST void calculateQs(const uint index, const Vertex &point, Object* object) const; + CUDA_HOST void calculateQs(const uint index, const Vertex &point, Object* object) const; - HOST bool checkIfAtLeastOneValidQ(const uint index, const Vertex &point, const Triangle &triangle) const; + CUDA_HOST bool checkIfAtLeastOneValidQ(const uint index, const Vertex &point, const Triangle &triangle) const; - HOST bool checkIfAtLeastOneValidQ(const uint index, const Vertex &point, Object* object) const; + CUDA_HOST bool checkIfAtLeastOneValidQ(const uint index, const Vertex &point, Object* object) const; public: diff --git a/src/gpu/GridGenerator/grid/GridInterface.cu b/src/gpu/GridGenerator/grid/GridInterface.cu index 9dd16871c6ebaef3f915577f99201f92fb488a73..401773143cc6b909d8e41820567bcf468230cf0b 100644 --- a/src/gpu/GridGenerator/grid/GridInterface.cu +++ b/src/gpu/GridGenerator/grid/GridInterface.cu @@ -254,7 +254,7 @@ void GridInterface::findForGridInterfaceSparseIndexFC(GridImp* coarseGrid, GridI findSparseIndex(fc.fine, fineGrid, index); } -HOST void VF_PUBLIC GridInterface::repairGridInterfaceOnMultiGPU(SPtr<GridImp> coarseGrid, SPtr<GridImp> fineGrid) +CUDA_HOST void VF_PUBLIC GridInterface::repairGridInterfaceOnMultiGPU(SPtr<GridImp> coarseGrid, SPtr<GridImp> fineGrid) { { std::vector<uint> tmpCFC; diff --git a/src/gpu/GridGenerator/grid/GridInterface.h b/src/gpu/GridGenerator/grid/GridInterface.h index fa368daf30aac823db9e3f42dd2debc9f1bc9007..b979b60d6f9a08c19702ac8fa6e9081fa3cec599 100644 --- a/src/gpu/GridGenerator/grid/GridInterface.h +++ b/src/gpu/GridGenerator/grid/GridInterface.h @@ -25,7 +25,7 @@ public: HOSTDEVICE void VF_PUBLIC findForGridInterfaceSparseIndexCF(GridImp* coarseGrid, GridImp* fineGrid, uint index); HOSTDEVICE void VF_PUBLIC findForGridInterfaceSparseIndexFC(GridImp* coarseGrid, GridImp* fineGrid, uint index); - HOST void VF_PUBLIC repairGridInterfaceOnMultiGPU(SPtr<GridImp> coarseGrid, SPtr<GridImp> fineGrid); + CUDA_HOST void VF_PUBLIC repairGridInterfaceOnMultiGPU(SPtr<GridImp> coarseGrid, SPtr<GridImp> fineGrid); HOSTDEVICE void VF_PUBLIC print() const; diff --git a/src/gpu/GridGenerator/utilities/cuda/LaunchParameter.cu b/src/gpu/GridGenerator/utilities/cuda/LaunchParameter.cu index efe9b03814ba99f44c799711ad986af051c4c92a..8e7702ccde425f67a9755e4eebff82f63238ba11 100644 --- a/src/gpu/GridGenerator/utilities/cuda/LaunchParameter.cu +++ b/src/gpu/GridGenerator/utilities/cuda/LaunchParameter.cu @@ -2,12 +2,12 @@ #define MAXBLOCKSIZE 65535 -HOST LaunchParameter::LaunchParameter() +CUDA_HOST LaunchParameter::LaunchParameter() { } -HOST LaunchParameter LaunchParameter::make_2D1D_launchParameter(int size, int threadDim) +CUDA_HOST LaunchParameter LaunchParameter::make_2D1D_launchParameter(int size, int threadDim) { LaunchParameter para; para.threads = dim3(threadDim, 1, 1); @@ -22,7 +22,7 @@ HOST LaunchParameter LaunchParameter::make_2D1D_launchParameter(int size, int th return para; } -HOST LaunchParameter LaunchParameter::make_1D1D_launchParameter(int size, int threadDim) +CUDA_HOST LaunchParameter LaunchParameter::make_1D1D_launchParameter(int size, int threadDim) { LaunchParameter para; para.threads = dim3(threadDim, 1, 1); @@ -43,7 +43,7 @@ DEVICE int LaunchParameter::getGlobalIdx_1D_1D() return blockIdx.x *blockDim.x + threadIdx.x; } -HOST void LaunchParameter::print() const +CUDA_HOST void LaunchParameter::print() const { *logging::out << logging::Logger::INFO_INTERMEDIATE << "blocks: (" << blocks.x << ", " << blocks.y << ", " << blocks.z << ")" << ", threads: (" << threads.x << ", " << threads.y << ", " << threads.z << ")\n"; diff --git a/src/gpu/GridGenerator/utilities/cuda/LaunchParameter.cuh b/src/gpu/GridGenerator/utilities/cuda/LaunchParameter.cuh index cf88e6e3fc090a8804a09a32ad9e018d88b9fe6a..4bfc258495726770f3a9cafa99fd920e6a54bbfd 100644 --- a/src/gpu/GridGenerator/utilities/cuda/LaunchParameter.cuh +++ b/src/gpu/GridGenerator/utilities/cuda/LaunchParameter.cuh @@ -11,15 +11,15 @@ class LaunchParameter { public: - HOST VF_PUBLIC LaunchParameter(); + CUDA_HOST VF_PUBLIC LaunchParameter(); - HOST VF_PUBLIC static LaunchParameter make_2D1D_launchParameter(int size, int threadDim); - HOST VF_PUBLIC static LaunchParameter make_1D1D_launchParameter(int size, int threadDim); + CUDA_HOST VF_PUBLIC static LaunchParameter make_2D1D_launchParameter(int size, int threadDim); + CUDA_HOST VF_PUBLIC static LaunchParameter make_1D1D_launchParameter(int size, int threadDim); DEVICE static int getGlobalIdx_2D_1D(); DEVICE static int getGlobalIdx_1D_1D(); - HOST void print() const; + CUDA_HOST void print() const; dim3 threads; dim3 blocks; diff --git a/src/gpu/GridGenerator/utilities/cuda/cudaDefines.h b/src/gpu/GridGenerator/utilities/cuda/cudaDefines.h index 101b8418fac23b0cd0a093189f0ac30610c996ff..bc00947394452b7a4647faf82765180733bb8212 100644 --- a/src/gpu/GridGenerator/utilities/cuda/cudaDefines.h +++ b/src/gpu/GridGenerator/utilities/cuda/cudaDefines.h @@ -4,13 +4,13 @@ #include <cuda_runtime.h> #include <stdio.h> -#define HOST __host__ +#define CUDA_HOST __host__ #define DEVICE __device__ #define GLOBAL __global__ #define CONSTANT __constant__ -#define HOSTDEVICE HOST DEVICE +#define HOSTDEVICE CUDA_HOST DEVICE static void printCudaInformation(int i) { cudaDeviceProp prop; diff --git a/src/gpu/GridGenerator/utilities/cuda/cudaKernelCall.h b/src/gpu/GridGenerator/utilities/cuda/cudaKernelCall.h index b3334c832b1f2caabdfdf08b8108356754570cf4..5911977428cda9acd5e2190a4b5c1579e08a211f 100644 --- a/src/gpu/GridGenerator/utilities/cuda/cudaKernelCall.h +++ b/src/gpu/GridGenerator/utilities/cuda/cudaKernelCall.h @@ -6,7 +6,7 @@ #include "utilities/cuda/LaunchParameter.cuh" template<typename Functor, typename... TArgs> -HOST float runKernel(Functor kernel, const LaunchParameter& para, TArgs... args) +CUDA_HOST float runKernel(Functor kernel, const LaunchParameter& para, TArgs... args) { para.print(); diff --git a/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp b/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp index 1d4039e38d7f8da9819591722800a580cce6ed64..4473a849b97ba59ccc178093c1d36084372ec98b 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/Cp.cpp @@ -70,7 +70,7 @@ void printCpTopIntermediateStep(Parameter* para, unsigned int t, int lev) const char* fname = ffname.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream - ofstream ostr; + std::ofstream ostr; ////////////////////////////////////////////////////////////////////////// //open file ostr.open(fname); diff --git a/src/gpu/VirtualFluids_GPU/Calculation/DragLift.cpp b/src/gpu/VirtualFluids_GPU/Calculation/DragLift.cpp index e9d0f4ea015743e1440ec40cb814ca82b8ced24d..e709bf0970a373d6a43e781fe4674b32a04523f3 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/DragLift.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/DragLift.cpp @@ -50,8 +50,8 @@ void calcDragLift(Parameter* para, CudaMemoryManager* cudaManager, int lev) //double A = 110.0 * 28.0; //Ship width times height in fine nodes //double delta_x = 0.0045;//[m] fine //double delta_t = para->getVelocity() * delta_x / 15.96; - //double LBtoSI = 1.204 * (pow(delta_x, 4))/(pow(delta_t,2));//rho_SI * delta_x^4 / delta_t^2 = 1.204 kg/m³ * (0.0045m)^4 / (0.00000757s)^2 ... LB to kg*m/s² - //double LBtoSI = 1000 * (pow(delta_x, 4))/(pow(delta_t,2));//rho_SI * delta_x^4 / delta_t^2 = 1000 kg/m³ * (0.1m)^4 / (0.00187s)^2 ... LB to kg*m/s² + //double LBtoSI = 1.204 * (pow(delta_x, 4))/(pow(delta_t,2));//rho_SI * delta_x^4 / delta_t^2 = 1.204 kg/m� * (0.0045m)^4 / (0.00000757s)^2 ... LB to kg*m/s� + //double LBtoSI = 1000 * (pow(delta_x, 4))/(pow(delta_t,2));//rho_SI * delta_x^4 / delta_t^2 = 1000 kg/m� * (0.1m)^4 / (0.00187s)^2 ... LB to kg*m/s� for (int it = 0; it < para->getParH(lev)->QGeom.kQ; it++) { diff --git a/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp b/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp index 6cd73abf1c2139b77872f02fcc6998c63990f666..77835d66658acfa029c876188264f02204134777 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/ForceCalculations.cpp @@ -10,7 +10,7 @@ #include "Utilities/StringUtil.hpp" #include "GPU/CudaMemoryManager.h" -using namespace std; +//using namespace std; ////////////////////////////////////////////////////////////////////////// ForceCalculations::ForceCalculations(Parameter* para) @@ -129,12 +129,12 @@ void ForceCalculations::printForcing(Parameter* para) const char* fname = ffname.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream - ofstream ostr; + std::ofstream ostr; ////////////////////////////////////////////////////////////////////////// //open file ostr.open(fname, std::fstream::app); ostr << para->getForcesHost()[0] << " " << para->getForcesHost()[1] << " " << para->getForcesHost()[2]; - ostr << endl; + ostr << std::endl; ////////////////////////////////////////////////////////////////////////// //close file ostr.close(); diff --git a/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.cpp b/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.cpp index c4dad6256b380665f5bb902d18d8c3f58620d296..b92ddaaa3ee3449f657d84c7b7c044a51873f00f 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.cpp +++ b/src/gpu/VirtualFluids_GPU/Calculation/PlaneCalculations.cpp @@ -7,7 +7,7 @@ #include <stdio.h> #include <fstream> #include <sstream> -using namespace std; +//using namespace std; ////////////////////////////////////////////////////////////////////////// void setSizeOfPlane(Parameter* para, int lev, unsigned int z) @@ -274,7 +274,7 @@ void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) const char* fnameIn = ffnameIn.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream - ofstream ostrIn; + std::ofstream ostrIn; ////////////////////////////////////////////////////////////////////////// //open file ostrIn.open(fnameIn); @@ -282,7 +282,7 @@ void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) //fill file with data for (size_t i = 0; i < para->getParH(lev)->PlaneConcVectorIn.size(); i++) { - ostrIn << para->getParH(lev)->PlaneConcVectorIn[i] << endl ; + ostrIn << para->getParH(lev)->PlaneConcVectorIn[i] << std::endl ; } ////////////////////////////////////////////////////////////////////////// //close file @@ -294,7 +294,7 @@ void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) const char* fnameOut1 = ffnameOut1.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream - ofstream ostrOut1; + std::ofstream ostrOut1; ////////////////////////////////////////////////////////////////////////// //open file ostrOut1.open(fnameOut1); @@ -302,7 +302,7 @@ void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) //fill file with data for (size_t i = 0; i < para->getParH(lev)->PlaneConcVectorOut1.size(); i++) { - ostrOut1 << para->getParH(lev)->PlaneConcVectorOut1[i] << endl ; + ostrOut1 << para->getParH(lev)->PlaneConcVectorOut1[i] << std::endl ; } ////////////////////////////////////////////////////////////////////////// //close file @@ -314,7 +314,7 @@ void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) const char* fnameOut2 = ffnameOut2.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream - ofstream ostrOut2; + std::ofstream ostrOut2; ////////////////////////////////////////////////////////////////////////// //open file ostrOut2.open(fnameOut2); @@ -322,7 +322,7 @@ void printPlaneConc(Parameter* para, CudaMemoryManager* cudaManager) //fill file with data for (size_t i = 0; i < para->getParH(lev)->PlaneConcVectorOut2.size(); i++) { - ostrOut2 << para->getParH(lev)->PlaneConcVectorOut2[i] << endl ; + ostrOut2 << para->getParH(lev)->PlaneConcVectorOut2[i] << std::endl ; } ////////////////////////////////////////////////////////////////////////// //close file @@ -349,7 +349,7 @@ void printRE(Parameter* para, CudaMemoryManager* cudaManager, int timestep) const char* fname = ffname.c_str(); ////////////////////////////////////////////////////////////////////////// //set ofstream - ofstream ostr; + std::ofstream ostr; ////////////////////////////////////////////////////////////////////////// //open file ostr.open(fname); @@ -372,7 +372,7 @@ void printRE(Parameter* para, CudaMemoryManager* cudaManager, int timestep) { continue; } - ostr << endl; + ostr << std::endl; } ////////////////////////////////////////////////////////////////////////// //close file diff --git a/src/gpu/VirtualFluids_GPU/Calculation/PorousMedia.h b/src/gpu/VirtualFluids_GPU/Calculation/PorousMedia.h index 961a873ce329b5e657c64db4e5e852de515385ee..990894faf7a7de3c5028bb4eedcb83769236d360 100644 --- a/src/gpu/VirtualFluids_GPU/Calculation/PorousMedia.h +++ b/src/gpu/VirtualFluids_GPU/Calculation/PorousMedia.h @@ -8,7 +8,7 @@ #include <iostream> #include <vector> #include <stdio.h> -using namespace std; +//using namespace std; class PorousMedia { diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp index 895e50963fcde72012e47811b092794e3be9f1a5..f3a02fe351e8ea051126137194b6047f47123ccc 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/GridReader.cpp @@ -130,7 +130,7 @@ void GridReader::allocArrays_BoundaryValues() void GridReader::allocArrays_OffsetScale() { - cout << "-----Config Arrays OffsetScale------" << endl; + std::cout << "-----Config Arrays OffsetScale------" << std::endl; OffsetScale *obj_offCF = new OffsetScale(para->getscaleOffsetCF(), true); OffsetScale *obj_offFC = new OffsetScale(para->getscaleOffsetFC(), true); OffsetScale *obj_scaleCFC = new OffsetScale(para->getscaleCFC(), false); @@ -145,9 +145,9 @@ void GridReader::allocArrays_OffsetScale() for (int i = 0; i<level; i++) { unsigned int tempCF = obj_offCF->getSize(i); - cout << "Groesse der Daten CF vom Level " << i << " : " << tempCF << endl; + std::cout << "Groesse der Daten CF vom Level " << i << " : " << tempCF << std::endl; unsigned int tempFC = obj_offFC->getSize(i); - cout << "Groesse der Daten FC vom Level " << i << " : " << tempFC << endl; + std::cout << "Groesse der Daten FC vom Level " << i << " : " << tempFC << std::endl; AnzahlKnotenGesCF += tempCF; AnzahlKnotenGesFC += tempFC; @@ -194,8 +194,8 @@ void GridReader::allocArrays_OffsetScale() cudaMemoryManager->cudaCopyInterfaceOffFC(i); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// } - cout << "Gesamtanzahl Knoten CF = " << AnzahlKnotenGesCF << endl; - cout << "Gesamtanzahl Knoten FC = " << AnzahlKnotenGesFC << endl; + std::cout << "Gesamtanzahl Knoten CF = " << AnzahlKnotenGesCF << std::endl; + std::cout << "Gesamtanzahl Knoten FC = " << AnzahlKnotenGesFC << std::endl; delete obj_offCF; delete obj_offFC; @@ -203,7 +203,7 @@ void GridReader::allocArrays_OffsetScale() delete obj_scaleCFF; delete obj_scaleFCC; delete obj_scaleFCF; - cout << "-----Ende OffsetScale------" << endl; + std::cout << "-----Ende OffsetScale------" << std::endl; } diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/MeasuredPoints.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/MeasuredPoints.cpp index 358cbc74b17768740c81c2d7a5a38fb8dd933230..1916986d790e62849a951860c4498fb3b489b889 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/MeasuredPoints.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/MeasuredPoints.cpp @@ -2,17 +2,17 @@ #include <stdlib.h> #include <iostream> -using namespace std; +//using namespace std; MeasuredPoints::MeasuredPoints(void) { } MeasuredPoints::MeasuredPoints(std::string ad){ - file.open(ad.c_str(), ios::in | ios::binary); + file.open(ad.c_str(), std::ios::in | std::ios::binary); if (!file) { - cerr << "Fehler beim Oeffnen Measured Points" <<endl; + std::cerr << "Fehler beim Oeffnen Measured Points" << std::endl; exit(1); } @@ -29,7 +29,7 @@ MeasuredPoints::~MeasuredPoints(void) void MeasuredPoints::init() { - string bufferString; + std::string bufferString; unsigned int bufferInt; getline(file,bufferString); diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/OffsetScale.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/OffsetScale.cpp index 07e0cbcaeb030d183a7c36d726201d16a5adc3df..54ee53d79065210a9aca830f42e2fdcd8bc48955 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/OffsetScale.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderFiles/OffsetScale.cpp @@ -5,9 +5,9 @@ using namespace std; -OffsetScale::OffsetScale(string ad, bool off) +OffsetScale::OffsetScale(std::string ad, bool off) { - file.open(ad.c_str(), ios::in); + file.open(ad.c_str(), std::ios::in); if (!file) { cerr << "Fehler beim Oeffnen" <<endl; diff --git a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp index 92d3375c24991130bb7f6c4cb991f5b15205fc77..5cdf7ecd8bdfe3b7a81ca427a7c05565b533a85c 100644 --- a/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp +++ b/src/gpu/VirtualFluids_GPU/DataStructureInitializer/GridReaderGenerator/GridGenerator.cpp @@ -13,6 +13,7 @@ #include "utilities/communication.h" + GridGenerator::GridGenerator(std::shared_ptr<GridBuilder> builder, std::shared_ptr<Parameter> para, std::shared_ptr<CudaMemoryManager> cudaManager) { this->builder = builder; @@ -93,7 +94,7 @@ void GridGenerator::allocArrays_BoundaryValues() for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { const auto numberOfPressureValues = int(builder->getPressureSize(level)); - cout << "size pressure level " << level << " : " << numberOfPressureValues << endl; + std::cout << "size pressure level " << level << " : " << numberOfPressureValues << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// para->getParH(level)->QPress.kQ = numberOfPressureValues; para->getParD(level)->QPress.kQ = numberOfPressureValues; @@ -110,7 +111,7 @@ void GridGenerator::allocArrays_BoundaryValues() for (uint level = 0; level < builder->getNumberOfGridLevels(); level++) { const auto numberOfVelocityValues = int(builder->getVelocitySize(level)); - cout << "size velocity level " << level << " : " << numberOfVelocityValues << endl; + std::cout << "size velocity level " << level << " : " << numberOfVelocityValues << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// int blocks = (numberOfVelocityValues / para->getParH(level)->numberofthreads) + 1; para->getParH(level)->Qinflow.kArray = blocks * para->getParH(level)->numberofthreads; @@ -153,8 +154,8 @@ void GridGenerator::allocArrays_BoundaryValues() ////////////////////////////////////////////////////////////////////////// para->getParH(level)->TempVel.kTemp = numberOfVelocityValues; //cout << "Groesse kTemp = " << para->getParH(i)->TempPress.kTemp << endl; - cout << "getTemperatureInit = " << para->getTemperatureInit() << endl; - cout << "getTemperatureBC = " << para->getTemperatureBC() << endl; + std::cout << "getTemperatureInit = " << para->getTemperatureInit() << std::endl; + std::cout << "getTemperatureBC = " << para->getTemperatureBC() << std::endl; ////////////////////////////////////////////////////////////////////////// para->cudaAllocTempVeloBC(level); //cout << "nach alloc " << endl; @@ -182,7 +183,7 @@ void GridGenerator::allocArrays_BoundaryValues() para->setGeometryValues(true); for (uint i = 0; i < builder->getNumberOfGridLevels(); i++) { int numberOfGeometryValues = builder->getGeometrySize(i); - cout << "size geometry values, Level " << i << " : " << numberOfGeometryValues << endl; + std::cout << "size geometry values, Level " << i << " : " << numberOfGeometryValues << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// para->getParH(i)->QGeom.kQ = numberOfGeometryValues; para->getParD(i)->QGeom.kQ = numberOfGeometryValues; @@ -210,7 +211,7 @@ void GridGenerator::allocArrays_BoundaryValues() //para->getParH(i)->QGeom.Vz[m] = 0.0f; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - ////Täst + ////T�st //for (int m = 0; m < temp4; m++) //{ // para->getParH(i)->QGeom.Vx[m] = para->getVelocity();//0.035f; @@ -224,7 +225,7 @@ void GridGenerator::allocArrays_BoundaryValues() //if (para->getDiffOn()==true){ // ////////////////////////////////////////////////////////////////////////// // para->getParH(i)->Temp.kTemp = temp4; - // cout << "Groesse kTemp = " << para->getParH(i)->Temp.kTemp << endl; + // cout << "Groesse kTemp = " << para->getParH(i)->Temp.kTemp << std::endl; // ////////////////////////////////////////////////////////////////////////// // para->cudaAllocTempNoSlipBC(i); // ////////////////////////////////////////////////////////////////////////// @@ -622,7 +623,7 @@ void GridGenerator::allocArrays_BoundaryQs() int numberOfPressureValues = (int)builder->getPressureSize(i); if (numberOfPressureValues > 0) { - cout << "size Pressure: " << i << " : " << numberOfPressureValues << endl; + std::cout << "size Pressure: " << i << " : " << numberOfPressureValues << std::endl; //cout << "Groesse Pressure: " << i << " : " << temp1 << "MyID: " << para->getMyID() << endl; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //preprocessing @@ -668,7 +669,7 @@ void GridGenerator::allocArrays_BoundaryQs() //cout << "vor setzen von kTemp" << endl; para->getParH(i)->TempPress.kTemp = numberOfPressureValues; para->getParD(i)->TempPress.kTemp = numberOfPressureValues; - cout << "Groesse TempPress.kTemp = " << para->getParH(i)->TempPress.kTemp << endl; + std::cout << "Groesse TempPress.kTemp = " << para->getParH(i)->TempPress.kTemp << std::endl; ////////////////////////////////////////////////////////////////////////// para->cudaAllocTempPressBC(i); //cout << "nach alloc" << endl; @@ -697,8 +698,8 @@ void GridGenerator::allocArrays_BoundaryQs() const auto numberOfVelocityNodes = int(builder->getVelocitySize(i)); if (numberOfVelocityNodes > 0) { - cout << "size velocity level " << i << " : " << numberOfVelocityNodes << endl; - //cout << "Groesse velocity level: " << i << " : " << temp3 << "MyID: " << para->getMyID() << endl; + std::cout << "size velocity level " << i << " : " << numberOfVelocityNodes << std::endl; + //cout << "Groesse velocity level: " << i << " : " << temp3 << "MyID: " << para->getMyID() << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //preprocessing real* QQ = para->getParH(i)->Qinflow.q27[0]; @@ -738,12 +739,12 @@ void GridGenerator::allocArrays_BoundaryQs() ////////////////////////////////////////////////////////////////////////// para->getParH(i)->TempVel.kTemp = numberOfVelocityNodes; para->getParD(i)->TempVel.kTemp = numberOfVelocityNodes; - cout << "Groesse TempVel.kTemp = " << para->getParH(i)->TempPress.kTemp << endl; - cout << "getTemperatureInit = " << para->getTemperatureInit() << endl; - cout << "getTemperatureBC = " << para->getTemperatureBC() << endl; + std::cout << "Groesse TempVel.kTemp = " << para->getParH(i)->TempPress.kTemp << std::endl; + std::cout << "getTemperatureInit = " << para->getTemperatureInit() << std::endl; + std::cout << "getTemperatureBC = " << para->getTemperatureBC() << std::endl; ////////////////////////////////////////////////////////////////////////// para->cudaAllocTempVeloBC(i); - //cout << "nach alloc " << endl; + //cout << "nach alloc " << std::endl; ////////////////////////////////////////////////////////////////////////// for (int m = 0; m < numberOfVelocityNodes; m++) { @@ -753,9 +754,9 @@ void GridGenerator::allocArrays_BoundaryQs() para->getParH(i)->TempVel.k[m] = para->getParH(i)->Qinflow.k[m]; } ////////////////////////////////////////////////////////////////////////// - //cout << "vor copy " << endl; + //cout << "vor copy " << std::endl; para->cudaCopyTempVeloBCHD(i); - //cout << "nach copy " << endl; + //cout << "nach copy " << std::endl; ////////////////////////////////////////////////////////////////////////// } para->cudaCopyVeloBC(i); @@ -765,7 +766,7 @@ void GridGenerator::allocArrays_BoundaryQs() for (uint i = 0; i < builder->getNumberOfGridLevels(); i++) { const int numberOfGeometryNodes = builder->getGeometrySize(i); - cout << "size of GeomBoundaryQs, Level " << i << " : " << numberOfGeometryNodes << endl; + std::cout << "size of GeomBoundaryQs, Level " << i << " : " << numberOfGeometryNodes << std::endl; para->getParH(i)->QGeom.kQ = numberOfGeometryNodes; para->getParD(i)->QGeom.kQ = para->getParH(i)->QGeom.kQ; @@ -827,7 +828,7 @@ void GridGenerator::allocArrays_BoundaryQs() //{ // for (int tmp = 0; tmp < 27; tmp++) // { - // cout <<"Kuhs: " << Q.q27[tmp][test] << endl; + // cout <<"Kuhs: " << Q.q27[tmp][test] << std::endl; // } //} @@ -837,7 +838,7 @@ void GridGenerator::allocArrays_BoundaryQs() ////////////////////////////////////////////////////////////////////////// para->getParH(i)->Temp.kTemp = numberOfGeometryNodes; para->getParD(i)->Temp.kTemp = numberOfGeometryNodes; - cout << "Groesse Temp.kTemp = " << para->getParH(i)->Temp.kTemp << endl; + std::cout << "Groesse Temp.kTemp = " << para->getParH(i)->Temp.kTemp << std::endl; ////////////////////////////////////////////////////////////////////////// para->cudaAllocTempNoSlipBC(i); ////////////////////////////////////////////////////////////////////////// @@ -867,8 +868,8 @@ void GridGenerator::allocArrays_OffsetScale() const uint numberOfNodesPerLevelCF = builder->getNumberOfNodesCF(level); const uint numberOfNodesPerLevelFC = builder->getNumberOfNodesFC(level); - cout << "number of nodes CF Level " << level << " : " << numberOfNodesPerLevelCF << endl; - cout << "number of nodes FC level " << level << " : " << numberOfNodesPerLevelFC << endl; + std::cout << "number of nodes CF Level " << level << " : " << numberOfNodesPerLevelCF << std::endl; + std::cout << "number of nodes FC level " << level << " : " << numberOfNodesPerLevelFC << std::endl; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //size + memsize CF diff --git a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp index 9a81ec6f3c568dd4bced3e5132b36227a28378bf..b40291aab27144256f039786fce2456b4d77a7bb 100644 --- a/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp +++ b/src/gpu/VirtualFluids_GPU/LBM/Simulation.cpp @@ -78,12 +78,12 @@ void Simulation::setFactories(std::shared_ptr<KernelFactory> kernelFactory, std: void Simulation::addKineticEnergyAnalyzer(uint tAnalyse) { - this->kineticEnergyAnalyzer = make_shared<KineticEnergyAnalyzer>(this->para, tAnalyse); + this->kineticEnergyAnalyzer = std::make_shared<KineticEnergyAnalyzer>(this->para, tAnalyse); } void Simulation::addEnstrophyAnalyzer(uint tAnalyse) { - this->enstrophyAnalyzer = make_shared<EnstrophyAnalyzer>(this->para, tAnalyse); + this->enstrophyAnalyzer = std::make_shared<EnstrophyAnalyzer>(this->para, tAnalyse); } @@ -747,7 +747,7 @@ void Simulation::run() para->getParD(lev)->evenOrOdd); getLastCudaError("CalcMacSP27 execution failed"); - //überschreiben mit Wandknoten + //�berschreiben mit Wandknoten //SetOutputWallVelocitySP27( para->getParD(lev)->numberofthreads, // para->getParD(lev)->vx_SP, // para->getParD(lev)->vy_SP, diff --git a/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp b/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp index 16b56930fc9bb49f5ce4844e6ce8e5dce41e4353..01dd67f8d37e1e94ad59b192a1f6067a9cf1ea2a 100644 --- a/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp +++ b/src/gpu/VirtualFluids_GPU/Output/FileWriter.cpp @@ -383,10 +383,10 @@ void FileWriter::writeUnstrucuredGridLTConc(std::shared_ptr<Parameter> para, int void FileWriter::writeUnstrucuredGridMedianLT(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) { - vector< UbTupleFloat3 > nodes; - vector< UbTupleUInt8 > cells; - //vector< UbTupleUInt8 > cells2; - vector< string > nodedatanames; + std::vector< UbTupleFloat3 > nodes; + std::vector< UbTupleUInt8 > cells; + //std::vector< UbTupleUInt8 > cells2; + std::vector< std::string > nodedatanames; nodedatanames.push_back("pressMed"); nodedatanames.push_back("rhoMed"); nodedatanames.push_back("vx1Med"); @@ -400,7 +400,7 @@ void FileWriter::writeUnstrucuredGridMedianLT(std::shared_ptr<Parameter> para, i unsigned int startpos = 0; unsigned int endpos = 0; unsigned int sizeOfNodes = 0; - vector< vector< double > > nodedata(nodedatanames.size()); + std::vector< std::vector< double > > nodedata(nodedatanames.size()); //printf("\n test for if... \n"); for (unsigned int part = 0; part < fname.size(); part++) @@ -497,9 +497,9 @@ void FileWriter::writeUnstrucuredGridMedianLT(std::shared_ptr<Parameter> para, i void FileWriter::writeUnstrucuredGridMedianLTConc(std::shared_ptr<Parameter> para, int level, std::vector<std::string >& fname) { - vector< UbTupleFloat3 > nodes; - vector< UbTupleUInt8 > cells; - vector< string > nodedatanames; + std::vector< UbTupleFloat3 > nodes; + std::vector< UbTupleUInt8 > cells; + std::vector< std::string > nodedatanames; nodedatanames.push_back("concMed"); nodedatanames.push_back("pressMed"); nodedatanames.push_back("rhoMed"); @@ -513,7 +513,7 @@ void FileWriter::writeUnstrucuredGridMedianLTConc(std::shared_ptr<Parameter> par uint startpos = 0; uint endpos = 0; uint sizeOfNodes = 0; - vector< vector< double > > nodedata(nodedatanames.size()); + std::vector< std::vector< double > > nodedata(nodedatanames.size()); for (unsigned int part = 0; part < fname.size(); part++) { diff --git a/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp index d41b6a8a888540a8882d24bc46036b90bd2ce6be..c278f5349cb4bb2d0ce7f758733e143adbaea37a 100644 --- a/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/InterfaceDebugWriter.hpp @@ -14,15 +14,15 @@ #include <basics/writer/WbWriterVtkXmlBinary.h> -using namespace std; +//using namespace std; namespace InterfaceDebugWriter { void writeGridInterfaceLines(Parameter* para, int level, const uint* coarse, const uint* fine, uint numberOfNodes, const std::string& name) { - vector<UbTupleFloat3> nodes(numberOfNodes * 2); - vector<UbTupleInt2> cells(numberOfNodes); + std::vector<UbTupleFloat3> nodes(numberOfNodes * 2); + std::vector<UbTupleInt2> cells(numberOfNodes); int actualNodeNumber = 0; for (uint u = 0; u < numberOfNodes; u++) @@ -69,8 +69,8 @@ namespace InterfaceDebugWriter ////////////////////////////////////////////////////////////////////////// void writeGridInterfaceLinesNeighbors(Parameter* para, int level, const uint* interfaceIndices, uint numberOfNodes, const std::string& name) { - vector<UbTupleFloat3> nodes(numberOfNodes * 2); - vector<UbTupleInt2> cells(numberOfNodes); + std::vector<UbTupleFloat3> nodes(numberOfNodes * 2); + std::vector<UbTupleInt2> cells(numberOfNodes); int actualNodeNumber = 0; for (uint u = 0; u < numberOfNodes; u++) @@ -137,8 +137,8 @@ namespace InterfaceDebugWriter ////////////////////////////////////////////////////////////////////////// void writeInterfaceLinesDebugOff(Parameter* para){ - vector< UbTupleFloat3 > nodesVec; - vector< UbTupleInt2 > cellsVec; + std::vector< UbTupleFloat3 > nodesVec; + std::vector< UbTupleInt2 > cellsVec; int nodeNumberVec = 0; for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 @@ -188,7 +188,7 @@ namespace InterfaceDebugWriter void writeInterfacePointsDebugCFC(Parameter* para){ - vector< UbTupleFloat3 > nodesVec2; + std::vector< UbTupleFloat3 > nodesVec2; int nodeNumberVec = 0; for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 @@ -223,7 +223,7 @@ namespace InterfaceDebugWriter void writeBcPointsDebug(Parameter* para){ - vector< UbTupleFloat3 > nodesVec2; + std::vector< UbTupleFloat3 > nodesVec2; int nodeNumberVec = 0; for (int level = 0; level <= para->getMaxLevel(); level++) //evtl. Maxlevel + 1 @@ -258,7 +258,7 @@ namespace InterfaceDebugWriter void writePressPointsDebug(Parameter* para){ - vector< UbTupleFloat3 > nodesVec; + std::vector< UbTupleFloat3 > nodesVec; int nodeNumberVec = 0; for (int level = 0; level <= para->getMaxLevel(); level++) //evtl. Maxlevel + 1 @@ -290,7 +290,7 @@ namespace InterfaceDebugWriter void writePressNeighborPointsDebug(Parameter* para){ - vector< UbTupleFloat3 > nodesVec; + std::vector< UbTupleFloat3 > nodesVec; int nodeNumberVec = 0; for (int level = 0; level <= para->getMaxLevel(); level++) @@ -321,7 +321,7 @@ namespace InterfaceDebugWriter void writeNeighborXPointsDebug(Parameter* para){ - vector< UbTupleFloat3 > nodesVec; + std::vector< UbTupleFloat3 > nodesVec; int nodeNumberVec = 0; for (int level = 0; level <= para->getMaxLevel(); level++) @@ -350,8 +350,8 @@ namespace InterfaceDebugWriter void writeNeighborXLinesDebug(Parameter* para){ - vector< UbTupleFloat3 > nodesVec; - vector< UbTupleInt2 > cellsVec; + std::vector< UbTupleFloat3 > nodesVec; + std::vector< UbTupleInt2 > cellsVec; int nodeNumberVec = 0; for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 @@ -390,7 +390,7 @@ namespace InterfaceDebugWriter void writeNeighborYPointsDebug(Parameter* para){ - vector< UbTupleFloat3 > nodesVec; + std::vector< UbTupleFloat3 > nodesVec; int nodeNumberVec = 0; for (int level = 0; level <= para->getMaxLevel(); level++) @@ -419,8 +419,8 @@ namespace InterfaceDebugWriter void writeNeighborYLinesDebug(Parameter* para){ - vector< UbTupleFloat3 > nodesVec; - vector< UbTupleInt2 > cellsVec; + std::vector< UbTupleFloat3 > nodesVec; + std::vector< UbTupleInt2 > cellsVec; int nodeNumberVec = 0; for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 @@ -459,7 +459,7 @@ namespace InterfaceDebugWriter void writeNeighborZPointsDebug(Parameter* para){ - vector< UbTupleFloat3 > nodesVec; + std::vector< UbTupleFloat3 > nodesVec; int nodeNumberVec = 0; for (int level = 0; level <= para->getMaxLevel(); level++) @@ -488,8 +488,8 @@ namespace InterfaceDebugWriter void writeNeighborZLinesDebug(Parameter* para){ - vector< UbTupleFloat3 > nodesVec; - vector< UbTupleInt2 > cellsVec; + std::vector< UbTupleFloat3 > nodesVec; + std::vector< UbTupleInt2 > cellsVec; int nodeNumberVec = 0; for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 @@ -529,8 +529,8 @@ namespace InterfaceDebugWriter void writeInterfaceCellsDebugCFC(Parameter* para){ - vector< UbTupleFloat3 > nodesVec; - vector< UbTupleInt8 > cellsVec; + std::vector< UbTupleFloat3 > nodesVec; + std::vector< UbTupleInt8 > cellsVec; int nodeNumberVec = 0; for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 { @@ -576,8 +576,8 @@ namespace InterfaceDebugWriter void writeInterfaceCellsDebugCFF(Parameter* para){ - vector< UbTupleFloat3 > nodesVec; - vector< UbTupleInt8 > cellsVec; + std::vector< UbTupleFloat3 > nodesVec; + std::vector< UbTupleInt8 > cellsVec; int nodeNumberVec = 0; for (int level = 0; level < para->getMaxLevel(); level++) //evtl. Maxlevel + 1 { diff --git a/src/gpu/VirtualFluids_GPU/Output/MeasurePointWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/MeasurePointWriter.hpp index ab481e8eaa5241e1017461edc87de79c435f14fd..0fee62e7d2fc5ddb3acc4188671c9cbd10e8f0a3 100644 --- a/src/gpu/VirtualFluids_GPU/Output/MeasurePointWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/MeasurePointWriter.hpp @@ -23,7 +23,7 @@ public: static void writeMeasurePoints(Parameter* para, int level, int index, int t) { - ostringstream convert; // stream used for the conversion + std::ostringstream convert; // stream used for the conversion convert << t; // insert the textual representation of 'Number' in the characters in the stream std::string st = convert.str(); UbFileOutputASCII out(para->getFName()+"_MeasurePoint_"+para->getParH(level)->MP[index].name+"_"+st+".dat"); @@ -49,10 +49,10 @@ public: static void writeTestAcousticXY(Parameter* para, int level, int t) { - ostringstream convert; // stream used for the conversion + std::ostringstream convert; // stream used for the conversion convert << t; // insert the textual representation of 'Number' in the characters in the stream std::string st = convert.str(); - ostringstream convertLevel; // stream used for the conversion + std::ostringstream convertLevel; // stream used for the conversion convertLevel << level; // insert the textual representation of 'Number' in the characters in the stream std::string sLevel = convertLevel.str(); @@ -82,10 +82,10 @@ public: static void writeTestAcousticYZ(Parameter* para, int level, int t) { - ostringstream convert; // stream used for the conversion + std::ostringstream convert; // stream used for the conversion convert << t; // insert the textual representation of 'Number' in the characters in the stream std::string st = convert.str(); - ostringstream convertLevel; // stream used for the conversion + std::ostringstream convertLevel; // stream used for the conversion convertLevel << level; // insert the textual representation of 'Number' in the characters in the stream std::string sLevel = convertLevel.str(); @@ -114,10 +114,10 @@ public: static void writeTestAcousticXZ(Parameter* para, int level, int t) { - ostringstream convert; // stream used for the conversion + std::ostringstream convert; // stream used for the conversion convert << t; // insert the textual representation of 'Number' in the characters in the stream std::string st = convert.str(); - ostringstream convertLevel; // stream used for the conversion + std::ostringstream convertLevel; // stream used for the conversion convertLevel << level; // insert the textual representation of 'Number' in the characters in the stream std::string sLevel = convertLevel.str(); @@ -267,7 +267,7 @@ public: static void writeNodes(SPtr<Parameter> para, int level) { - ostringstream convert; // stream used for the conversion + std::ostringstream convert; // stream used for the conversion std::string st = convert.str(); UbFileOutputASCII out(para->getFName() + "_Nodes_" + std::to_string(level) + ".dat"); diff --git a/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp index 81a7979c446267d5871f718d4a212810bd387c69..583f36730320363dddc52bdce435cbb1f9095bf8 100644 --- a/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/QDebugWriter.hpp @@ -14,7 +14,7 @@ #include <basics/writer/WbWriterVtkXmlBinary.h> -using namespace std; +//using namespace std; namespace QDebugWriter { diff --git a/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp index aebef163d8dc5d0cfdbb4987e0b3a3d00e9b2767..e20fe79ab137ca13010062a9fde6e1add9b5f96f 100644 --- a/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/UnstructuredGridWriter.hpp @@ -14,7 +14,7 @@ #include <basics/writer/WbWriterVtkXmlASCII.h> #include <basics/utilities/UbTuple.h> -using namespace std; +//using namespace std; namespace UnstructuredGridWriter { diff --git a/src/gpu/VirtualFluids_GPU/Output/VtkSGWriter.hpp b/src/gpu/VirtualFluids_GPU/Output/VtkSGWriter.hpp index 28e79d673e8fac19bbc6687b8c5b29e81cbcc5ad..5313d7bfbde22533ed198acaee16cc83844425da 100644 --- a/src/gpu/VirtualFluids_GPU/Output/VtkSGWriter.hpp +++ b/src/gpu/VirtualFluids_GPU/Output/VtkSGWriter.hpp @@ -10,7 +10,7 @@ #include "LBM/D3Q27.h" #include "basics/utilities/UbSystem.h" -using namespace std; +//using namespace std; namespace VtkSGWriter { @@ -141,7 +141,7 @@ void writeVTKsgSP(unsigned int nx_D, unsigned int ny_D, unsigned int nz_D, int s unsigned int nx = nx_D; unsigned int ny = ny_D; unsigned int nz = nz_D; - ////für Geller + ////f�r Geller //startoffx = 0; //startoffy = 0; //startoffz = 0; @@ -832,7 +832,7 @@ void writeVTKsgThS(unsigned int nx, unsigned int ny, unsigned int nz, int starto ////////////////////////////////////////////////////////////////////////// if(coordX[count]==i && coordY[count]==j && coordZ[count]==k) { tmp = bcMatH[count]; - count++; //count wird nur im "if" erhöht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde + count++; //count wird nur im "if" erh�ht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde } else tmp = 99;//GEO_VOID; ////////////////////////////////////////////////////////////////////////// @@ -855,7 +855,7 @@ void writeVTKsgThS(unsigned int nx, unsigned int ny, unsigned int nz, int starto ////////////////////////////////////////////////////////////////////////// if(coordX[count]==i && coordY[count]==j && coordZ[count]==k) { tmp_rho = (float)(rhoH[count] / 3.0f * rho_ratio * v_ratio *v_ratio); - count++; //count wird nur im "if" erhöht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde + count++; //count wird nur im "if" erh�ht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde } else tmp_rho=0.0f; ////////////////////////////////////////////////////////////////////////// @@ -878,7 +878,7 @@ void writeVTKsgThS(unsigned int nx, unsigned int ny, unsigned int nz, int starto ////////////////////////////////////////////////////////////////////////// if(coordX[count]==i && coordY[count]==j && coordZ[count]==k) { tmp_rho = (float)(pressH[count] / 3.0f * rho_ratio * v_ratio *v_ratio); - count++; //count wird nur im "if" erhöht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde + count++; //count wird nur im "if" erh�ht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde } else tmp_rho=0.0f; ////////////////////////////////////////////////////////////////////////// @@ -902,7 +902,7 @@ void writeVTKsgThS(unsigned int nx, unsigned int ny, unsigned int nz, int starto tmp_ux=(float)(vxH[count] * v_ratio); tmp_uy=(float)(vyH[count] * v_ratio); tmp_uz=(float)(vzH[count] * v_ratio); - count++; //count wird nur im "if" erhöht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde + count++; //count wird nur im "if" erh�ht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde } else { tmp_ux=0.0f; @@ -990,7 +990,7 @@ void writeVTKsgThS(unsigned int nx, unsigned int ny, unsigned int nz, int starto ////////////////////////////////////////////////////////////////////////// if(coordX[count]==i && coordY[count]==j && coordZ[count]==k) { tmp = bcMatH[count]; - count++; //count wird nur im "if" erhöht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde + count++; //count wird nur im "if" erh�ht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde } else tmp = GEO_VOID; ////////////////////////////////////////////////////////////////////////// @@ -1013,7 +1013,7 @@ void writeVTKsgThS(unsigned int nx, unsigned int ny, unsigned int nz, int starto ////////////////////////////////////////////////////////////////////////// if(coordX[count]==i && coordY[count]==j && coordZ[count]==k) { tmp_rho = (float)((rhoH[count] / tdiff) / 3.0f * rho_ratio * v_ratio *v_ratio); - count++; //count wird nur im "if" erhöht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde + count++; //count wird nur im "if" erh�ht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde } else tmp_rho=0.0f; ////////////////////////////////////////////////////////////////////////// @@ -1036,7 +1036,7 @@ void writeVTKsgThS(unsigned int nx, unsigned int ny, unsigned int nz, int starto ////////////////////////////////////////////////////////////////////////// if(coordX[count]==i && coordY[count]==j && coordZ[count]==k) { tmp_rho = (float)((pressH[count] / tdiff) / 3.0f * rho_ratio * v_ratio *v_ratio); - count++; //count wird nur im "if" erhöht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde + count++; //count wird nur im "if" erh�ht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde } else tmp_rho=0.0f; ////////////////////////////////////////////////////////////////////////// @@ -1060,7 +1060,7 @@ void writeVTKsgThS(unsigned int nx, unsigned int ny, unsigned int nz, int starto tmp_ux=(float)((vxH[count] / tdiff) * v_ratio); tmp_uy=(float)((vyH[count] / tdiff) * v_ratio); tmp_uz=(float)((vzH[count] / tdiff) * v_ratio); - count++; //count wird nur im "if" erhöht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde + count++; //count wird nur im "if" erh�ht. stellt sicher, dass wir im array nur einen schritt weiter gehen wenn eine kombination gefunden wurde } else { tmp_ux=0.0f; diff --git a/src/gpu/VirtualFluids_GPU/Particles/Particles.cpp b/src/gpu/VirtualFluids_GPU/Particles/Particles.cpp index e4f0f624a5536e8fe491c5a063ee7a9b2ba4f6c5..9ec6f2e6485ffab2f9c80e2c583e6b110ae5ad23 100644 --- a/src/gpu/VirtualFluids_GPU/Particles/Particles.cpp +++ b/src/gpu/VirtualFluids_GPU/Particles/Particles.cpp @@ -13,7 +13,7 @@ //#include <math.h> //#include "LB.h" -using namespace std; +//using namespace std; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void allocParticles(Parameter* para, CudaMemoryManager* cudaManager) @@ -181,9 +181,9 @@ void initParticles(Parameter* para) ////////////////////////////////////////////////////////////////////////// //calc 1 size_t in_var_max = 50; //declearation of max size of input data values - vector<double>sum(in_var_max); //vector sum is used for calculation - vector<int>c(in_var_max); //This vector c stores the no.of counts that each particle size classes has occurred - vector <int> c_temp1(in_var_max); + std::vector<double>sum(in_var_max); //std::vector sum is used for calculation + std::vector<int>c(in_var_max); //This vector c stores the no.of counts that each particle size classes has occurred + std::vector <int> c_temp1(in_var_max); static int c_temp2[50]; //This loop is used to assign the no.of counts of the various particle size classes which are randomly generated @@ -193,14 +193,14 @@ void initParticles(Parameter* para) }//end of for loop int numberOfValues; //variable to store the number of actual values given in a file - vector<double>d_a(in_var_max); //vector to store the diameter of the actual data given - vector<double>q_a(in_var_max); //vector q_a to store vol % of the actual data given - vector<double>q(in_var_max); //vector q to store vol % of the calculated data + std::vector<double>d_a(in_var_max); //vector to store the diameter of the actual data given + std::vector<double>q_a(in_var_max); //vector q_a to store vol % of the actual data given + std::vector<double>q(in_var_max); //vector q to store vol % of the calculated data ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //read file - ifstream fin; //object fin to read the file data + std::ifstream fin; //object fin to read the file data fin.open("Actual_data.dat"); //opens the desired file name fin>>numberOfValues;